question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attaching DOM events not working

See original GitHub issue

I am trying to attach DOM events to the rendered nodes but it is not working.

I have used the following syntax:

function render()  {
    return h('div', {
      style: {
        height: "100px",
        width: "100px",
        background: "#CCC"
      },
      "ev-click": function () {alert('hi');},
    }, "Hello World!");
}

What am I missing here?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pm-debjit-biswascommented, Nov 29, 2014

Thanks! I had not found the on* syntax in the documentation or may have missed it.

0reactions
Raynoscommented, Jan 12, 2015

@staltz “building a custom bubbling/catching system” is exactly dom-delegator.

The bit that needs decoupling is how to dispatch to the ev-foo handlers without coupling to dom-delegator

What we have done is coupled to ev-store ( https://github.com/Raynos/ev-store ) which can then be read from my any bubbling / delegation system.

Matt-Esch might use that to do bubbling / delegation at the “component” boundary instead of at the “global” boundary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >
Attaching click event to a JQuery object not yet added to the ...
By the way, I'm working with OpenLayers, and the DOM object that I'm appending the button to is an OpenLayers.FramedCloud (Which is not...
Read more >
Handling Events :: Eloquent JavaScript
This works for most types of events—you can attach a handler through the attribute whose ... Like the focus-related events, loading events do...
Read more >
Do not attach listeners for DOMContentLoaded after it already ...
Look at document.readyState . If it says "interactive" then the DOMContentLoaded event has already fired. It could be either loading or interactive or...
Read more >
.bind() | jQuery API Documentation
A string containing one or more DOM event types, such as "click" or "submit ... One handy use of this parameter is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found