Skip to main content

Bug Tracker

Side navigation

#4208 closed bug (wontfix)

Opened February 22, 2009 12:09AM UTC

Closed July 11, 2011 06:20PM UTC

Last modified October 30, 2013 04:12PM UTC

Selector inconsistency with XML Namespaces

Reported by: janrito Owned by: john
Priority: minor Milestone: 1.next
Component: selector Version: 1.3.2
Keywords: needsreview xml Cc:
Blocked by: Blocking:
Description

On a namespaced xml element like:

<media:thumbnail>

In Firefox it will match with:

jQuery('media\\\\:thumbnail')

This won't match the element in Safari though.

In Safari it will match with:

jQuery('thumbnail')

This is a problem, since it will match any element regardless of the namespace:

<media:thumbnail>

<dc:thumbnail>

<thumbnail>

Firefox won't match any without the namespace. I have been able to match the correct element by checking the node name:

jQuery('item', xml).find('[nodeName="media:thumbnail"]');

Attachments (0)
Change History (6)

Changed November 17, 2010 01:23AM UTC by dmethvin comment:1

keywords: → needsreview xml
status: newopen

Changed March 31, 2011 02:02AM UTC by danheberden comment:2

milestone: 1.41.next

Related to #4120

Changed April 01, 2011 08:47AM UTC by thingsinjars comment:3

This might be related to #4120 but this is more about the inconsistency between browsers. There's a test case here:

http://jsfiddle.net/thingsinjars/xaKLn/

I investigated this one a bit and found that nodes with a namespace created using document.createElement are

detectable in IE6/7/8 using an escaped jQuery selector:

div.appendChild(document.createElement('a:bc'))

$(div).find('a!\\\\:bc').length !// equals 1

But...

The same nodes created with the same namespace are not detectable

by IE6/7/8 when they are created with .html():

$('<div/>').html('<a:bc/>').find('a!\\\\:bc').length !// equals 0

Instead, those nodes are detectable without the namespace:

$('<div/>').html('<a:bc/>').find('bc').length !// equals 1

If there's no consistent way to get around the browser inconsistency, there's an addition to $.support to detect this behaviour in the jsfiddle.

Changed April 04, 2011 09:01AM UTC by thingsinjars comment:4

There's more IE namespace investigation detailed here along with more jsfiddle testcases:

http://thingsinjars.com/post/371/investigating-ies-innerhtml/

I'm now definitely of the opinion that there isn't a way to patch this odd namespace behaviour in IE6/7/8 and it should be added to $.support.

Changed July 11, 2011 06:20PM UTC by john comment:5

resolution: → wontfix
status: openclosed

This isn't something that we're going to fix:

http://docs.jquery.com/Won%27t_Fix

Changed October 30, 2013 04:12PM UTC by gavenkoa comment:6

FYI this page still live: http://contribute.jquery.org/wont-fix/ (support issues with SVG/WML/etc).