Opened 15 years ago
Closed 13 years ago
#1753 closed feature (duplicate)
inconsistent processing for xml vs html
Reported by: | jacktanner | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In jQuery 1.2.1, line 783 does this:
div = doc.createElement("div")
The attributes that Firefox 2.0.0.7 creates for div are different depending on whether a page is loaded as foo.html or foo.xml. In particular, when the file is XML, there's no div.innerHTML, only div.textContent. This causes a problem down on line 813:
When the file is HTML, that statement assigns a value to both div.innerHTML and div.textContent. When the file is XML, that statement creates div.innerHTML and assigns its value, but does not affect div.textContent.
A workaround is to do this:
div.innerHTML = wrap[1] + arg + wrap[2]; div.textContent = arg;
I'm not sure if this is a true workaround, because it fails if arg contains any HTML tags.
See http://pastie.caboo.se/101771. Save this code as foo.html and as foo.xml.
Change History (2)
comment:1 Changed 15 years ago by
Type: | bug → feature |
---|
comment:2 Changed 13 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I'm grouping these under #6693 as a feature request.
At this point jQuery doesn't support text parsing to xml. While it seems to sort of works in some browsers, really that is just non-standard html (which works in FF for example). While xml support for text parsing like:
may be added to the core at some point, for now it will work inconsistently at best. I'm going to change this to a feature request from a bug.
Related tickets #1850, #1991.