Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String as DomContent doesn't work for table-related elements #7

Closed
bobby opened this issue Jan 27, 2012 · 0 comments · Fixed by #9
Closed

String as DomContent doesn't work for table-related elements #7

bobby opened this issue Jan 27, 2012 · 0 comments · Fixed by #9

Comments

@bobby
Copy link
Collaborator

bobby commented Jan 27, 2012

Expected:

(.log js/console (single-node "<tr><td>Foo</td></tr>"))

to print to the console:

<tr><td>Foo</td></tr>

i.e. a Table Row Element

Actual

(.log js/console (single-node "<tr><td>Foo</td></tr>"))

printed to the console:

Foo

i.e. a Text Node Element

This discrepancy is due to a known bug in goog.dom.htmlToDocumentFragment: http://code.google.com/p/closure-library/issues/detail?id=210. The TR and TD (as well as TH, THEAD, TBODY, TFOOT) tags are stripped out when converting from a string to DOM elements, leaving only concatenated text nodes.

This issue impacts a use case that I think is quite common -- A string containing a table row is used as a template for each element of a collection, it is manipulated and inserted into the DOM.

bobby added a commit to bobby/domina that referenced this issue Feb 1, 2012
- Includes support for table fragments -- fixes levand#7
- Improvement in performance and consistency of apply-with-cloning
- HTML strings now act consistently with other content types
- Uses DocumentFragments only as an implementation detail, no DocumentFragments are ever returned from API functions -- closes levand#8
@bobby bobby mentioned this issue Feb 1, 2012
@levand levand closed this as completed Mar 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants