hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2018-03-05T02:19:12.000197Z

@candera true

leobm 2018-03-05T10:45:12.000187Z

is there any example how to use the mutation! method?

flyboarder 2018-03-05T18:14:20.000433Z

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

flyboarder 2018-03-05T18:15:04.000516Z

Requires hoplon 7.2?

candera 2018-03-05T18:15:23.000514Z

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

flyboarder 2018-03-05T18:15:31.000111Z

yep

flyboarder 2018-03-05T18:15:53.000159Z

oh ancestors no children yes

candera 2018-03-05T18:16:12.000391Z

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

flyboarder 2018-03-05T18:17:03.000130Z

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

candera 2018-03-05T18:17:10.000294Z

But that doesn’t help, does it?

candera 2018-03-05T18:17:47.000372Z

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.

candera 2018-03-05T18:18:06.000365Z

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

flyboarder 2018-03-05T18:20:07.000670Z

maybe that would help?

candera 2018-03-05T18:20:55.000293Z

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

candera 2018-03-05T18:21:13.000630Z

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

candera 2018-03-05T18:21:33.000503Z

I guess maybe the selector could be by ID?

flyboarder 2018-03-05T18:21:39.000145Z

Fair enough, but a selector could be anything right?

flyboarder 2018-03-05T18:22:00.000729Z

you could use gensym and a custom attribute to find it

candera 2018-03-05T18:22:16.000577Z

Yes, that actually might work. I dig it!

candera 2018-03-05T18:22:34.000026Z

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

candera 2018-03-05T18:24:22.000419Z

Yeah, this looks legit.

flyboarder 2018-03-05T18:24:28.000262Z

:thumbsup:

candera 2018-03-05T18:24:30.000552Z

Thanks!

flyboarder 2018-03-05T18:24:41.000454Z

np, just thinking out loud 😛

candera 2018-03-05T18:25:55.000013Z

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.

candera 2018-03-05T18:26:12.000059Z

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

candera 2018-03-05T18:26:55.000438Z

Yes, it would run at every mutation.

candera 2018-03-05T18:27:43.000435Z

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

candera 2018-03-05T18:28:11.000743Z

I would imagine it’

candera 2018-03-05T18:28:15.000698Z

s pretty darn fast.

flyboarder 2018-03-05T19:06:13.000785Z

@leobm not currently

leobm 2018-03-05T20:48:09.000526Z

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