Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

itemView with nowrap=true doesn't work when template produces TR #873

Open
npoppeli opened this issue Feb 6, 2016 · 1 comment
Open

Comments

@npoppeli
Copy link

npoppeli commented Feb 6, 2016

When you have an itemView with option nowrap=true and a template that produces a single TR element (with lots of things inside the TR), Chaplin raises an error in line 432 of view.coffee. Try this for demonstration:

$ ->
  html = """<tr><td>text1</td><td>text2</td>
            <td><button id='id1'><span class='fa fa-pencil'></span></button></td>
            <td><button id='id2'><span class='fa fa-pencil'></span></button></td>
          </tr>"""
  el = document.createElement 'div'
  el.innerHTML = html
  for child, l in el.children
    console.log "child #{l}: #{child.tagName} id=#{child.id}"

There are two elements in el.children, namely the two buttons. Appararently the innerHTML() method discards the TR and TD nodes (tested on Chromium 48.0 and Firefox 44.0). I don't know if this should be fixed in the code, or clarified in the documentation.

@npoppeli
Copy link
Author

npoppeli commented Feb 6, 2016

Could an alternative be:
parser = new DOMParser()
el = parser.parseFromString(html, 'text/xml')`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant