Mindblown: a blog about philosophy.

  • Triggering event handlers

    Event handlers are designed to be invoked when browser or user activity triggers the propagation of their associated events through the DOM hierarchy. But there may be times when you want to trigger the execution of a handler under script control. You could define such event handlers as top-level functions so that you can invoke…

  • Removing event handlers

    Typically, once an event handler is established using on(), it remains in effect for the remainder of the life of the page. But particular interactions may dictate that handlers be removed based on certain criteria. Consider, for example, a page where multiple steps are presented and once a step has been completed, its controls revert to…

  • The jQuery Event Model

    Although it’s true that the creation of highly interactive applications requires a hefty reliance on event handling, the thought of writing event-handling code on a large scale while dealing with the browser differences would be enough to daunt even the most intrepid of page authors. You could hide the differences behind an API that abstracts…

  • Event propagation

    You saw earlier that with the DOM Level 0 Event Model, once an event was triggered on an element, the event propagated from the target element upward in the DOM tree to all the target’s ancestors. The advanced Level 2 Event Model also provides this bubbling phase but ups the ante with an additional capture…

  • Affecting event propagation and semantic actions

    There may be occasions when you want to prevent an event from bubbling any further up the DOM tree. This might be because you’re fastidious and you know that you’ve already accomplished any processing necessary to handle the event, or you may want to forestall unwanted handling that might occur higher up in the chain.…

  • Event bubbling

    When an event is triggered on an element in the DOM tree, the event-handling mechanism of the browser checks if a handler has been established for that particular event on that element and, if so, invokes it. But that’s hardly the end of the story. After the target element has had its chance to handle…

  • The Event instance

    When an event handler is fired, an instance of an object named Event is passed to the handler as its first parameter in all standards-compliant browsers. Once again, the latter are Internet Explorer 9 and above, Firefox, Chrome, Safari, and Opera. Internet Explorer 8 and below do things in their own proprietary way by tacking the Event instance onto…

  • Understanding the browser event models

    Long before anyone considered standardizing how browsers would handle events, Netscape Communications Corporation introduced an event-handling model in its Netscape Navigator browser. This model is known by a few names. You may have heard it termed the Netscape Event Model, the Basic Event Model, or even the rather vague Browser Event Model, but most people…

  • Events are where it happens!

    This lesson covers Like many other GUI management systems, the interfaces presented by HTML web pages are asynchronous and event-driven, even if the protocol used to deliver them to the browser, HTTP, is wholly synchronous in nature. Whether a GUI is implemented as a desktop program using Java Swing, X11, or the .NET Framework, or as a page…

  • Conclusion

    With the techniques learned in this lesson, you’re able to copy elements, move them, replace them, or even remove them. You can also append, prepend, or wrap any element or set of elements on the page. In addition, we discussed how to manage the values of form elements, all leading to powerful yet succinct logic.…

Got any book recommendations?