3
lorentz
4y

Can JS events bubble in trees of objects other than DOM nodes? If so, what properties do I need?
I tried to read this: https://dom.spec.whatwg.org//... but it's stupid long, references a bunch of other functions and I got lost in between the variables.
I'm kinda confused because it often uses type checks (i.e. if target is a Node or a Window object), which goes against the very point of duck typing.
I could technically make my nodes into DOM nodes, but I'd rather have them inherit from Worker.

Comments
  • 1
    And if this was a strictly typed language, they would test for interfaces rather than actual prototypes, which would mean that I could simply implement the interface and get a list of properties to define from my IDE. I find this entertaining because the typical argument for duck typing is that you can easily fake objects, and in this case I'm struggling with exactly that, precisely because there isn't a bubbleable interface, because duck typing doesn't require anyone to define it.
Add Comment