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: mathieu.de-kermadec@bewoopi.net Owned by:
Priority: low Milestone: None
Component: manipulation Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:
Description

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

With this code:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html><head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
  var xmlstr = '<test><val attr="<popo" /></test>';
  var xmldoc = $(xmlstr);
  xmldoc.find('val').attr('pilou', '<toto>&');
  console.log(xmldoc.html());
});
</script>
</body></html>

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.

Regards,

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: http://jsfiddle.net/F8Pgk/

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:

http://jsfiddle.net/F8Pgk/1/

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.