@candera true
@candera yes, many of them are irrelevant to the mutation observer, so you can attach the attribute anywhere and it doesn’t matter
https://github.com/hoplon/brew/blob/master/src/hoplon/observer.cljs
Requires hoplon 7.2?
But none of those let you see when your ancestors have changed, do they?
yep
oh ancestors no children yes
Yeah, I would think you’d need to know about ancestors to understand when you’ve been added to the DOM…
https://github.com/hoplon/brew/blob/master/src/hoplon/observer.cljs#L11-L13
I think thats the one you are looking for, but I would need to RTM again
But that doesn’t help, does it?
I don’t think there’s a great way to always know ahead of time who your parent is going to be and have him watch for you being added. I want to put something on the node that’s outside the DOM.
You can recursievly listen to the body or whatever, but that seems like madness.
@candera http://ryanmorr.com/using-mutation-observers-to-watch-for-element-availability/
maybe that would help?
That appears to require a selector. I assume that means you know where you’re going to add the element.
I don’t really want to have to bake global knowledge of the document. I just want a darn event to fire. 🙂
I guess maybe the selector could be by ID?
Fair enough, but a selector could be anything right?
you could use gensym and a custom attribute to find it
Yes, that actually might work. I dig it!
I feel like I tried this at one point but I’m not sure I got quite that far.
Yeah, this looks legit.
:thumbsup:
Thanks!
np, just thinking out loud 😛
It’s the usual tangled Javascript callback mess, so I’m trying to track if it calls code on every single mutation of the DOM. That might be an issue.
Ha. Still probably better than spinning in a loop forever like when-dom
Yes, it would run at every mutation.
So I guess it depends on how efficient querySelctorAll
is. If that’s super fast then you’re probably okay.
I would imagine it’
s pretty darn fast.
yesterday I read about another interesting alternative technique to MutationObservers. http://www.backalleycoder.com/2012/04/25/i-want-a-damnodeinserted/ https://github.com/naugtur/insertionQuery