[latex]Mae govannen![/latex]
Die Frage war "wie", nicht "womit"!
Bis zu while und parentNode sind wir ja nun schon vorgedrungen.
Kannst aber auch gern nochmal Event-Bubbling in den Raum werfen.
Ich hatte da an eine Konstruktion wie
var el = .... // hier das Target-Element des Events bestimmen
while (el.className !== 'wunschklasse' && el !== document.body) { // test auf document.body, um Endlos-Schleifen zu vermeiden
el = el.parentNode;
}
// wenn die Schleife beendet wurde, ist el entweder das gesuchte Element oder document.body
if (el.className === 'wunschklasse') { // erneut auf className testen, um Schleifenabbruch bei document.body auszufiltern
// Aktionen
}
gedacht. [vereinfachtes Beispiel, wenn mehrere Klassen gesetzt sein können, muß die className-Abfrage entsprechend geändert werden]
Oder wie gesagt mit contains auf die vorher ermitteten Elemente oder direkt compareDocumentPosition herumspielen.
Cü,
Kai
--
A workaround for an avoidable problem often adds clutter and overhead to the program which
could have been avoided by not creating the problem in the first place.(Garrett Smith/clj)
Foren-Stylesheet Site Selfzeug JS-Lookup
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?
A workaround for an avoidable problem often adds clutter and overhead to the program which
could have been avoided by not creating the problem in the first place.(Garrett Smith/clj)
Foren-Stylesheet Site Selfzeug JS-Lookup
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?