Skip to main content

Bug Tracker

Side navigation

#8220 closed bug (fixed)

Opened February 09, 2011 11:39AM UTC

Closed February 10, 2011 12:31AM UTC

Last modified February 10, 2011 12:37AM UTC

is() bug on namespaced tag

Reported by: raid3n Owned by: jitter
Priority: high Milestone: 1.5.1
Component: selector Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

Hi,

var html = "<xsd\\:element>";
alert($(html).is("xsd\\\\:element"));

Outputs:

Chrome: true

Opera, Firefox: false

Solution: alert($(html).get(0).nodeName.toLowerCase() == "xsd\\:element");

Regards,

Andrea

Attachments (0)
Change History (4)

Changed February 09, 2011 11:59AM UTC by raid3n comment:1

this is the example:

http://jsfiddle.net/nBRHb/

Changed February 09, 2011 02:28PM UTC by jitter comment:2

component: unfiledselector
milestone: 1.next1.5.1
owner: → jitter
priority: undecidedhigh
status: newassigned

Changed February 10, 2011 12:31AM UTC by Anton M comment:3

resolution: → fixed
status: assignedclosed

Pull over tests from Sizzle. "Remove backslashes from tag name filter. Fixes #8220."

Changeset: f56b4a22a6cf37b3764939b0338bb545fa6b445f

Changed February 10, 2011 12:37AM UTC by jitter comment:4

description: Hi, \ \ var html = "<xsd\\:element>"; \ alert($(html).is("xsd\\\\:element")); \ \ \ Outputs: \ Chrome: true \ Opera, Firefox: false \ \ Solution: alert($(html).get(0).nodeName.toLowerCase() == "xsd\\:element"); \ \ Regards, \ Andrea \ \ Hi, \ {{{ \ var html = "<xsd\\:element>"; \ alert($(html).is("xsd\\\\:element")); \ }}} \ \ Outputs: \ Chrome: true \ Opera, Firefox: false \ \ Solution: alert($(html).get(0).nodeName.toLowerCase() == "xsd\\:element"); \ \ Regards, \ Andrea \ \

I fixed this for the XMLDocument case. e.g. when loading xml via ajax from server or when using jQuery.parseXML .

The use case as outlined in the report isn't supported at the moment. As you can't pass arbitrary xml string to $( html ). If that works is mainly browser dependent and fails in most versions of IE. Also the differences between the browsers probably derive from the fact that the DOM Level 1 method getElementsByTag handles namespaced tagnames differently across browsers. For further info check #7583 and #6491 or just search the bug tracker for namespace, xml related tickets.