4 ms·
document.querySelectorAll() uses the same kind of syntax for selectors as jQuery.
by dudus 13y ago
document.querySelectorAll() uses the same kind of syntax for selectors as jQuery.
- jonknee 13y agoAnd requires IE 9+ which rules it out for a lot of people...
- nelmaven 13y agoActually, no. IE8 supports it. http://caniuse.com/queryselector http://caniuse.com/queryselector
- mattmanser 13y agoIE8 is limited to the old CSS selectors so basically it sucks and doesn't really support it.
- sfeng 13y agoBut so is all of the actual CSS in your app.
- emn13 13y agoIn practice, especially for javascript usage, the old CSS selectors cover all the bases. The new-stuff, while great for styling, isn't all that relevant for scripting. nth-child, say, is often (though not always) simply an indexing operation on the return value of querySelectorAll; and in general you don't even want that since usually you have a specific element in mind and have labelled that element with a class to find it. I don't support IE8 anymore, and use CSS3 liberally in the actual css, yet I can't think of more than a handful of cases I used the selectors from javascript, certainly none of them critical. Do you actually use this?
- camus2 13y agoand support only a limited subset of the selectors jQuery supports.