I try to understand how the :not
selector works. First of all i guessed that everything that works inside of a querySelectorAll
function works in the same way in css.
What i'm trying to accomplish is to get a list of elements from a page excluding the one i don't need. Thats's why i'm using this small function:
getItems() {
return document.querySelectorAll('div:not(.sponsored):not(#hot_news) .item-story');
}
The important thing is that every section contain a <li>
that has the item-story
class, but i want to exclude the ones that are inside of a <div>
with the class sponsored
and a <section>
that has the id hot_news
.
In this fiddle you can find an example of what i tried already, it seems to work fine in CSS, but not in JS, and even if it seems to work i don't get why it should.