Skip to main content

Bug Tracker

Side navigation

#12466 closed bug (notabug)

Opened September 05, 2012 09:39AM UTC

Closed November 02, 2012 04:07AM UTC

Firefox 15.0 attr()/html() with special char not working

Reported by: Owned by:
Priority: low Milestone: None
Component: manipulation Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Since last update of firefox, I have a problem working with xml attribute and special characters.

With this code:

<script type="text/javascript" src=""></script>
<script type="text/javascript">
  var xmlstr = '<test><val attr="<popo" /></test>';
  var xmldoc = $(xmlstr);
  xmldoc.find('val').attr('pilou', '<toto>&');

In firefox < 15:

<val attr="<popo" pilou="<toto>&"></val> 

In firefox 15:

<val pilou="<toto>&" attr="<popo"></val>

In Chrome:

<val attr="<popo" pilou="<toto>&"></val> 

It seems that firefox 15 a problem escaping special characters in xml attributes.


Mathieu De Kermadec

Attachments (0)
Change History (3)

Changed September 05, 2012 09:42AM UTC by anonymous comment:1

Here is a jsFiddle to demonstrate:

Changed September 05, 2012 02:40PM UTC by timmywil comment:2

component: unfiledmanipulation
priority: undecidedlow
status: newopen

Confirmed, but this may not be jQuery. Needs investigation.

Changed November 02, 2012 04:07AM UTC by dmethvin comment:3

resolution: → notabug
status: openclosed

$() does not parse XML and eventually that ends up being assigned to a div.innerHTML, so that is throwing the characters at the mercy of the HTML parser. This is a similar example not using jQuery:

If you believe there was a bug or behavior change in Firefox starting at version 15, please report it to them and post your bug ticket back here. I will mark as notabug because it doesn't appear to be a jQuery bug.