Fork me on GitHub
#hoplon
<
2018-03-05
>
flyboarder18:03:20

@candera yes, many of them are irrelevant to the mutation observer, so you can attach the attribute anywhere and it doesn’t matter

flyboarder18:03:04

Requires hoplon 7.2?

candera18:03:23

But none of those let you see when your ancestors have changed, do they?

flyboarder18:03:53

oh ancestors no children yes

candera18:03:12

Yeah, I would think you’d need to know about ancestors to understand when you’ve been added to the DOM…

flyboarder18:03:03

I think thats the one you are looking for, but I would need to RTM again

candera18:03:10

But that doesn’t help, does it?

candera18:03:47

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.

candera18:03:06

You can recursievly listen to the body or whatever, but that seems like madness.

leobm20:03:09

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

flyboarder18:03:07

maybe that would help?

candera18:03:55

That appears to require a selector. I assume that means you know where you’re going to add the element.

candera18:03:13

I don’t really want to have to bake global knowledge of the document. I just want a darn event to fire. 🙂

candera18:03:33

I guess maybe the selector could be by ID?

flyboarder18:03:39

Fair enough, but a selector could be anything right?

flyboarder18:03:00

you could use gensym and a custom attribute to find it

candera18:03:16

Yes, that actually might work. I dig it!

candera18:03:34

I feel like I tried this at one point but I’m not sure I got quite that far.

candera18:03:22

Yeah, this looks legit.

flyboarder18:03:41

np, just thinking out loud 😛

candera18:03:55

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.

candera18:03:12

Ha. Still probably better than spinning in a loop forever like when-dom

candera18:03:55

Yes, it would run at every mutation.

candera18:03:43

So I guess it depends on how efficient querySelctorAll is. If that’s super fast then you’re probably okay.

candera18:03:11

I would imagine it’

candera18:03:15

s pretty darn fast.