Extending Host Objects: Evil; Extending Native Objects: Not Evil But Risky

Kangax has a good article on extending JavaScript native objects and host objects. He begins by clarifying that extending host objects (e.g. Element) is truly evil. Host objects do not have strong specs and have no rules and extending them risks collisions. Kangax has an older post talking about extending objects. There he says that Prototype JS's biggest mistake was extending Element.

Read ›

Element Wrappers in JavaScript

Element wrappers are coming. We are going to see more frameworks using wrappers for JavaScript DOM Elements.

Read ›

Compiled JavaScript Templating

I've got my old version of CompiledTemplate online in a Pastie. It's got the source and a simple example. I need to finish my new version and do some benchmarking.

Read ›

Compiled JavaScript Templating

Using a find-and-replace template system is often very useful. In Prototype JS, there is a built in class called Template. But for larger html blocks that need basic template logic and formatting functions, compiling the template is fast and robust.

Read ›

Easing Equations

Robert Penner created a suite of mathematically genius actionscript functions to simulate real-life movements in Flash. The results are compelling.

We see swinging, bouncing, and elastic movements in real life, and even a lot on Flash and even TV due to the work of Rober Penner.

Read ›

MouseEnter and MouseLeave

Mouseover and mouseout events are not intuitive. I've made a mockup and demo of a very short snippet that addresses the problem.

On a mouseover, the relatedTarget property references the node from which the pointer came. On a mouseout, the relatedTarget property references the node to which the pointer went.On any event, the scope is the node to which the event is attached.When the relatedTarget is a not child of the currentTarget, a mouseover event is equivalent to a mouseenter event and a mouseout event is equivalent to a mouseleave event.

Read ›