pmla
pmla

Reputation: 15

Backbone delegated events

Im trying to understand how backbone dom events are working in different browsers.

According to the documentation there is some issues with undelegate-able events.

// This only works for delegate-able events: not focus, blur, and // not change, submit, and reset in Internet Explorer.

But im unsure of what this exactly means?

Upvotes: 0

Views: 129

Answers (1)

Stephen Thomas
Stephen Thomas

Reputation: 14063

Here's an approximate explanation that might make sense:

Imagine that you have a button within a containing <div>. If the user clicks on the button, because the button exists with the <div> you could also say that the user clicked on the <div>. That's kind of what it means to say that the click event can be delegated.

In contrast, consider an <input> within a containing <div>. If the user "leaves" the <input> that element will receive a blur event. But the user doesn't necessarily leave the <div>. That's sort of what it means to say that the blur event cannot be delegated.

More technically, it's up to the browsers to decide which events they delegate and which they don't, so in some sense the difference is arbitrary. Most browsers follow reasoning that's at least similar to the explanation above.

Upvotes: 2

Related Questions