on.js Wiki
Integrated Performance Environment Library (client-side JavaScript)
Brought to you by:
clayendisk
browser event object
Events
Attaching event handlers to elements should be simple and universal, on.js makes everything possible in one easy step [including time-travel.]
on.event.preventDefault.call(e); //cancels default browser behavior on the event object
:::javascript
on.event.stopPropagation.call(e); //cancels upward propagation in the browser on the event object
('mouseup')[on](document)
( function(e) //the function with the event object
{
this; //target element
}
);
Current
var theElement = document.getElementById('the-id');
('mouseup')[on](theElement)
( function(e) //the function with the event object
{
this; //the element
}
);
Live
('mouseup')[on](document)
( function(e) //the function with the event object
{
if(this.id==='the-id')
{
this; //each element
}
}
);
Current
var theElements = on.document.getElementsByAttribute('the-attribute');
('mouseup')[on](theElements)
( function(e) //the function with the event object
{
this; //each element
}
);
Live
('mouseup')[on](document)
( function(e) //the function with the event object
{
if(this.getAttribute('the-attribute'))
{
this; //each element
}
}
);
return true;
A JavaScript Library