#7201 closed bug (notabug)
Whitespace between </div> and following <div> tag results in error in jquery
Reported by: | edoloughlin | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.dialog | Version: | 1.8.11 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This works:
$('<div><p>Some Text</p></div><div><p>Some other Text</p></div>').dialog()
but if you put whitespace between the closing DIV tag and the next DIV tag it causes an error in jQuery code:
$('<div><p>Some Text</p></div> <div><p>Some other Text</p></div>').dialog()
The above causes the following error in jquery-1.4.2.js:5464
TypeError: Result of expression 'this[i].style' [undefined] is not an object.
Change History (5)
comment:1 follow-up: 3 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
Neither of them are valid. An html string passed to jQuery can only contain one top-level node.
comment:3 follow-up: 4 Changed 12 years ago by
Replying to scott.gonzalez:
You're creating a text node by placing that space between the elements and then trying to initialize a dialog against the text node. I'm not sure that this is even a valid use of jQuery.
This isn't exactly the code I'm using. I'm actually using the jQuery Template plugin:
$.tmpl('template-name').dialog()
The string identified by 'template-name' has whitespace because I'm using a heredoc in Coffeescript to make it readable.
This seemed valid to me - it's similar to the examples in the Nimikor Blog pointed to by the Dialog docs on the jQueryUI site.
You're creating a text node by placing that space between the elements and then trying to initialize a dialog against the text node. I'm not sure that this is even a valid use of jQuery.