Side navigation
#6380 closed bug (invalid)
Opened March 31, 2010 09:59AM UTC
Closed July 21, 2010 02:23AM UTC
newline between DOCTYPE and root element when using $(xxx).html() causes unexpected behaviour
Reported by: | bgriffin | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | core | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This was originally posted at http://forum.jquery.com/topic/newline-between-doctype-and-root-element-when-using-xxx-html-causes-unexpected-behaviour . My assumption has been that due to no obvious flaw in the proposal, this is indeed a bug.
The effect is that a valid xhtml fragment is not easily accessible via the jquery api when it has whitespace between the DOCTYPE and the root element in JQuery 1.4.2.
The problem is manifest (tested) on the following browsers: Windows Chrome 4.1,Windows Firefox 3.6.2,MacOS X Firefox 3.5.8,MacOS X Safari 4.05.
Note that on Windows IE 7 ,Windows IE 7 neither fragments are correctly displayed.
Three files are used to demonstrate this problem (see attachment).
The core code is as follows, and jquery is not behaving as expected for the loldiv.html text, which is a legal xhtml fragment; namely the 'loldiv' fragment is not being 'appended' into the div class='o' of the base document, and the html() accessor cannot correctly parse the jQuery object constructed from the loldiv.html xhtml.
lildiv.html has no ws between DOCTYPE and document element (no fail)
loldiv.html has ws between DOCTYPE and document element (fails)
var urli="lildiv.html", urlo="loldiv.html";
$.get(urli,function(data){ loadPanel(data,"div.i"); })
$.get(urlo,function(data){ loadPanel(data,"div.o"); })
function loadPanel(data,point) { $(point).append($(data).html()); }
Attachments (4)
Change History (1)
Changed July 21, 2010 02:23AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Sorry but that is in browser-dependent territory.
http://api.jquery.com/html/
http://api.jquery.com/load/