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?


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):

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:

Raymond Uphoff

Thanks for replying. I've also made a little example;

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

Read the entire post on Facebook