Skip to main content

Bug Tracker

Side navigation

#6491 closed bug (patchwelcome)

Opened April 27, 2010 02:21PM UTC

Closed November 22, 2010 02:10AM UTC

Google Chrome vs. Firefox Ajax RSS Test

Reported by: jrevillini Owned by:
Priority: undecided Milestone:
Component: unfiled Version: 1.4.4
Keywords: rss,ajax Cc:
Blocked by: Blocking:
Description

This may need to be filed on one of the browsers' bug trackers, but I thought I'd start here first to confirm the bug.

In using jQuery to parse RSS feeds, I'm seeing different behavior in Chrome and Firefox when using the $('item title') selector.

Chrome considers <title> within <item> and <media:title> within <item> to match the query.

Firefox does not consider a <media:title> within <item> to match the same query.

I've attached a test case which can be launched in both browsers to show the issue. I think it needs to be placed into a website folder and viewed over http to work. Loading the html file using the Open command in each browser did not run the code.

Attachments (1)
  • Google Chrome vs. Firefox Ajax RSS Test.tar.gz (3.6 KB) - added by jrevillini April 27, 2010 02:23PM UTC.

    unzip this to a folder that you can access on a local web server, then access the html file over http in both chrome and firefox.

Change History (4)

Changed July 11, 2010 11:47PM UTC by dmethvin comment:1

component: unfiledselector

Changed November 01, 2010 09:14PM UTC by rwaldron comment:2

milestone: 1.4.3
owner: → jrevillini
priority: → undecided
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!

Changed November 22, 2010 01:35AM UTC by jitter comment:3

component: selectorunfiled
owner: jrevillini
status: pendingnew
version: 1.4.21.4.4

test case FF only return "item title" for first test. While Chrome and Opera return "item title" and "media title".

On the second test (of course) all 3 browsers return the same output.

Changed November 22, 2010 02:10AM UTC by snover comment:4

_comment0: So this appears like this may be a spec bug—or at least a kinda nasty, poorly-defined incompatibility between the css3-namespace spec and Selectors API spec. \ \ The [http://www.w3.org/TR/css3-namespace/#prefixes CSS3 namespace spec, prefixes section] states that if a namespace prefix is omitted, the namespace selected is the default namespace, and that the default namespace contains all elements with no explicitly defined namespace. Elements with explicitly defined namespaces are not part of the default namespace. \ \ The [http://www.w3.org/TR/selectors-api/ Selectors API], in contrast, implies (but does not state explicitly) that if a namespace prefix is omitted, the namespace to select from is ALL namespaces. This is based on the last example in Section 8. The spec itself only specifies that it should throw an Error if someone tries to use a namespace other than the null (default) namespace or the “all namespaces” selector. \ \ Given that the limitations in Selectors API § 6.3 would make it impossible to select some elements if the null namespace was used, it would seem that Firefox is violating the spec here by not returning media-namespaced elements. This is not strictly a jQuery bug, and since namespaces are not something that people use very often, I’m going to close this as patchwelcome.1290392591738111
resolution: → patchwelcome
status: newclosed

So this the Selectors API spec doesn’t do a great job of defining its behaviour here, but I think I figured this out.

The CSS3 namespace spec states that if a namespace prefix is omitted from a selector, the namespace to select from is the null (default) namespace. It also states that the null namespace contains all elements with no ''explicitly'' defined namespace (namespaces here are defined using CSS @namespace rules and are not based on the namespace prefixes used in the XML).

The Selectors API specifies that it should throw an Error if someone tries to select from a namespace other than the null (default) namespace, and does not provide any mechanism for defining non-default namespaces. As such, the null namespace selector is always equivalent to the all namespaces selector in the Selectors API.

It would seem that Firefox is violating the spec here by not returning XML-namespaced elements, even though they belong to the null namespace. This is not a jQuery bug, and since namespaces are not something that people use very often, I’m going to close this as patchwelcome—though I am not actually convinced this can even be worked around.