This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Raymond Uphoff
Posted Dec 20 - Read on Facebook

Hi guys, I was wondering why event delegation doesn't work? it seems like Eventlistener on some parent doesn't get triggered. Using event.tartget saves use lines of code (and memory). Will it going to be implemented in the future?

2 Comments

Eelco Lempsink

I think it works, but it’s a bit hacky. Here’s an example (note that layerB needs an event handler, else it will never be a target): http://share.framerjs.com/1g1rvwsgc11w/

It’s much nicer to simply have a handler on each layer and stop propagation if you use them in hierarchies. Compare the previous example to this one: http://share.framerjs.com/tem2jkoctxi5/

Raymond Uphoff

Thanks for replying. I've also made a little example; http://share.framerjs.com/c04cqprf8r5w/

As you can see it will show nodeAttributes of parent instead of childnodes.

Read the entire post on Facebook