readium/readium-js — pull request #29 by aadamowski (2014-03-23 21:18:26+00:00)
Title: Fix Firefox XML namespace handling incompatibilities in package document parser

Hi!

When working on the readium-js data model, I've discovered a bug on non-WebKit browsers. On WebKit, jQuery selectors against XML Dom work without regard for XML namespaces. On the other hand, other engines do the opposite - they won't match an element if in the original document it's physically prefixed with a namespace prefix. In such a case, they require matching against the full element name (prefix:localName), which is not portable (the used prefix can change from document to document).

My partial fix (more complex jQuery selectors still need conversion, as noted in the TODO comment) is to use the getElementsByTagNameNS() function, with a "*" namespace wildcard, based on information from this article: http://wiki.orbeon.com/forms/doc/contributor-guide/browser#TOC-Get-elements-with-prefixes.

This approach should also work for IE9 and IE10 (but not for IE <= 8).