Coder Social home page Coder Social logo

Comments (9)

heatherdouglass avatar heatherdouglass commented on September 24, 2024

Hello, do you have a specific example? I have not been able to reproduce this yet. Thanks!

from montage.

joseeight avatar joseeight commented on September 24, 2024

It happens whether in any way to handle the event:

this.addEventListener('firstDraw', this, false);

or

this.addEventListener('firstDraw', function (e) {//handle});

from montage.

francoisfrisch avatar francoisfrisch commented on September 24, 2024

This was changed for gh-17, maybe the firstDraw event should have bubbles set to false

from montage.

heatherdouglass avatar heatherdouglass commented on September 24, 2024

I can reproduce it now. I must have been testing against the wrong branch previously. Thanks.

from montage.

francoisfrisch avatar francoisfrisch commented on September 24, 2024

or a better solution would be to removeEventListener once the firstDraw event has been handled.

from montage.

joseeight avatar joseeight commented on September 24, 2024

So, is this an expected new feature? Just want to make sure we know how 'firstDraw' is expected to work.

from montage.

francoisfrisch avatar francoisfrisch commented on September 24, 2024

it's not specific to firstDraw, all events dispatched on a component now bubble up the component tree by default

from montage.

mczepiel avatar mczepiel commented on September 24, 2024

Just to be extremely specific:

As mentioned, events that canBubble should bubble up the component hierarchy, hopefully events that cannot bubble are not bubbling. If you are seeing the latter behavior anywhere, that would be considered a bug.

I think it's reasonable to expect firstDraw to bubble in case a parent does care to react to some particular children meeting some criteria drawing the first time. This does mean that you will need to check the event.target in your handler and that once you have handled the firstDraw for yourself, if that's all you cared about, then you probably should remove yourself as a listener.

from montage.

joseeight avatar joseeight commented on September 24, 2024

Thanks Mike, Francios also clarified that, I tested it, and it works, the first element to dispatch the event is the parent as expected, so this does not cause any problems.

from montage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.