Skip to content

support event delegation (events on child nodes) #1

@max-mapper

Description

@max-mapper

e.g. if you have a ul full of li elements and you do

dom('ul').on('click', function(el) {
  console.log(el.target)
})

then it should fire for ul and any element that is a descendant of ul

jquery works this way using the same .on syntax by default, e.g. http://jsfiddle.net/YFF2k/2/ (open console and click on some stuff)

there are a number of modules that do this on npm already:

we should probably use dom-delegator cause raynos wrote it :)

the only tricky part is that it would change the default behavior for .on to not only match the element but the element plus all children elements

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions