Skip to content

Instantly share code, notes, and snippets.

@bomatson
Created August 10, 2014 17:53
Show Gist options
  • Save bomatson/869f4be303c0122681f0 to your computer and use it in GitHub Desktop.
Save bomatson/869f4be303c0122681f0 to your computer and use it in GitHub Desktop.

Chapter 11 Thoughts

Feature simulation - why rebuild the feature as a fallback, wouldn’t that take up a lot of dev time and be a little error prone?

Object detection seems like the best way to handle browser inconsistencies - if the object has this property, use it

function bindEvent(elem, type, handle) {
  if (elem.addEventListener) {
    elem.addEventListener(type, handle, false);
  } else if (elem.attachEvent) {
    elem.attachEvent(‘on’ + type, handle);
  }
}

For event handler bindings - is it still not possible to know if a bound event has been fired? Mouseover is hard to use in reusable code, for example, since we need to bind the listener and then wait for a user interaction

@gilesbowkett
Copy link

btw I literally had a dream about the topics in chapter 12, where I realized that, when it comes to events, you can model the DOM as a somewhat deranged equivalent to the method lookup chain in Ruby (or indeed JavaScript), because of the way they bubble up the DOM, looking for an appropriate handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment