Skip to main content

Bug Tracker

Side navigation

#1753 closed feature (duplicate)

Opened September 29, 2007 09:40PM UTC

Closed June 20, 2010 04:54PM UTC

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:

div.innerHTML = wrap[1] + arg + wrap[2];

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.

Attachments (0)
Change History (2)

Changed December 05, 2007 03:53AM UTC by davidserduke comment:1

type: bugfeature

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:

$("<root><child>text</child><child/></root>");

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.

Changed June 20, 2010 04:54PM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed

I'm grouping these under #6693 as a feature request.