Bug Tracker

Opened 6 years ago

Closed 6 years ago

#6491 closed bug (patchwelcome)

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:


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.

Change History (4)

comment:1 Changed 6 years ago by dmethvin

  • Component changed from unfiled to selector

comment:2 Changed 6 years ago by rwaldron

  • Milestone 1.4.3 deleted
  • Owner set to jrevillini
  • Priority set to undecided
  • Status changed from new to pending

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!

comment:3 Changed 6 years ago by jitter

  • Component changed from selector to unfiled
  • Owner jrevillini deleted
  • Status changed from pending to new
  • Version changed from 1.4.2 to 1.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.

comment:4 Changed 6 years ago by snover

  • Resolution set to patchwelcome
  • Status changed from new to closed

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.

Last edited 6 years ago by snover (previous) (diff)
Note: See TracTickets for help on using tickets.