I am working with EPUB.JS, which uses the following code to get some information from an ePub file:
var navEl = navHtml.querySelector('nav[*|type="toc"]')
This line of code fails in IE10, as the querySelector returns null. I've never seen an attribute selector in the format [*|attr="val"]
before, but what I think they were trying to say was, "Select all nav elements with any attribute or an attribute named 'type' with value 'toc'."
I couldn't find any information on this star-pipe syntax, but I presume it is some sort of logical OR command that works in Webkit/Mozilla but not in IE.
Altering that line to read:
var navEl = navHtml.querySelector('nav')
works, but I still wanted to fully understand why they may have chose that other syntax when I feel like it meaningless, just in case it has an actual purpose that could lead to errors elsewhere.
Is there any explanation for this *|...
and is it even necessary?
querySelector()
can only return either zero or one element, not "all of them" (unless there is only one anyway). – Erg