Side navigation
#1039 closed bug (fixed)
Opened March 11, 2007 09:55AM UTC
Closed December 07, 2007 01:53AM UTC
$(html) fails with html comment
| Reported by: | arrix | Owned by: | davidserduke |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.2 |
| Component: | core | Version: | 1.1.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
$('<!-- comment -->') -> [[undefined, undefined]]
$('<div></div><!-- comment --><div></div>') -> [div, [undefined, undefined, undefined, 6 more...], div]
Although it seems absurd to pass in html comment when hand coding, sometimes the argument is generated from a design html page. So there are chances that the html string passed to $ contains comments.
Attachments (1)
Change History (5)
Changed March 24, 2007 06:03PM UTC by comment:1
| need: | → Test Case |
|---|
Changed March 25, 2007 10:36AM UTC by comment:2
| need: | Test Case → Review |
|---|
What is the expected behaviour here?
$('<!-- comment -->') -> []?
$('<div></div><!-- comment --><div></div>') => [div, div]?
Changed November 20, 2007 08:11PM UTC by comment:3
| description: | {{{\ $('<!-- comment -->') -> [[undefined, undefined]]\ $('<div></div><!-- comment --><div></div>') -> [div, [undefined, undefined, undefined, 6 more...], div]\ }}}\ Although it seems absurd to pass in html comment when hand coding, sometimes the argument is generated from a design html page. So there are chances that the html string passed to $ contains comments. → {{{ \ $('<!-- comment -->') -> [[undefined, undefined]] \ $('<div></div><!-- comment --><div></div>') -> [div, [undefined, undefined, undefined, 6 more...], div] \ }}} \ Although it seems absurd to pass in html comment when hand coding, sometimes the argument is generated from a design html page. So there are chances that the html string passed to $ contains comments. |
|---|---|
| owner: | → davidserduke |
| status: | new → assigned |
Is this a bad thing? From what I can tell it is a comment node and works fine when inserted. Then the question would be can jQuery handle it and might be a similar ticket to #1733 which discusses the problems with text nodes. the [undefined, undefined, undefined, 6 more...] part is just FireBugs representation of the node as an array because it has a length property and not a problem in itself that I can see.
I don't see a problem with leaving the comments in as long as jQuery is robust enough to handle it correctly.
Changed December 06, 2007 11:31PM UTC by comment:4
| milestone: | 1.1.3 → 1.2.2 |
|---|
Changed December 07, 2007 01:53AM UTC by comment:5
| resolution: | → fixed |
|---|---|
| status: | assigned → closed |
Fixed in [4062] such that the comment node will be included if the browser allows it, but the rest of jQuery will not break having a comment node in the jQuery object.