mozilla / popcorn-js

The HTML5 Media Framework. (Unmaintained. See https://github.com/menismu/popcorn-js for activity)
MIT License
2.14k stars 631 forks source link

querySelector requires escaped ids to be compatible with HTML5 #444

Open chadananda opened 9 years ago

chadananda commented 9 years ago

querySelectorAll is being called with a raw id value. This will not work with HTML5 style ids which are not CSS compatible.

For example, simply using a simple numeric id (id='1') results in the error:

Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '#1 ' is not a valid selector.

An official css.escape() method is in the works http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method

Meanwhile, Mathias Bynens has provided a polyfill: https://github.com/mathiasbynens/CSS.escape