@camperextraordinaire - I simplified my question. Its problematic to post the whole code for this.
I hope my edit helps to clarify. Thanks on forehand.
@camperextraordinaire - So sorry, but I tried to simplify my question in such a way that hopefully someone can help me. The question in itself and the code might be clear enoughâŚ
@camperextraordinaire - Fair enough and I appreciate that. I myself just started developing since about a year and I try to keep things short, simple and easy. My above problem, in my modest opinion, is about me not being able to grab the correct selector. And second, not able to put a 2 X NOT label in the javascript exclusion. So more or less a syntax issue. Anyways, lets hope it gets resolved before Christmas, these little code mishaps are always the most nasty and annoyingâŚ
So your document.querySelectorAll("label:not(.label)"); says âselect any label without the css class âlabelâ applied to it.â I donât think thatâs what you intend.
In your second example, you are saying âselect any label without the class 'gm-styleâ or âgm-style-mtcâ." Which doesnât apply to the given label you want to exclude.
In short, you have no direct hook to this label. You could exclude a style, I think, like document.querySelectorAll(label:not([style="vertical-align:middle"]); but that may filter more than you intendâŚ
let myEl = document.querySelectorAll(".gm-style-mtc :not(label)")
console.log(myEl);
Wait. That isnât right either. I donât think youâll be able to select them that way. How about, instead, selecting all the labels, select the containers, then see if that container contains the label?
let myExclusiveEl = document.querySelectorAll(".gm-style-mtc");
let myEls = document.querySelectorAll("label");
myEls = [...myEls].filter(child => {
let containedByExclusionNode = [...myExclusiveEl].filter(parent => {
if (parent.contains(child)) {
return true
} else {
return false;
}
})
if (containedByExclusionNode.length > 0) {
return true;
} else {
return false
}
})
console.log(myEls);
I want to exclude (= not include), the above label (its the only one that has label style). This includes it obviously:
document.querySelectorAll(.alpha .beta label");
Now how to exclude it? I want to select all my labels with label class but this one that I want to exclude only has a label style. So how to get the label style one OUT of my ´querySelectorAll`?
@camperextraordinaire - You nailed it⌠that was it! I cant thank you enough, been struggling with this for days (⌠as you know)⌠awesome, thanks a lot, really, this made my day!!!