Events Class
Normalises DOM event handling across browsers
Item Index
Methods
add
(
-
obj
-
type
-
fn
Add an event handler.
Parameters:
-
obj
HTMLElementElement to add event handler to
-
type
StringType of event handler (eg. "click")
-
fn
FunctionFunction that will handle the event
Example:
var el = document.getElementById('blah');
Events.add(el, 'click', function() { alert('I was clicked!'); });
initPage
(
-
[id=document.body.id]
Onload handler for Daniel15 framework. Calls onload functions depending on the current page. Splits the body ID by hyphen (-), uses first piece as the main object, and other pieces as sub-objects. Non-existant init methods are ignored (no error is thrown).
Example: An ID of "site-projects" would call Page.Site.init() and Page.Site.Projects.init(). site-projects-foo would call Page.Site.init(), Page.Site.Projects.init() and Page.Site.Foo.init(). "blog" would call Page.Blog.init().
Parameters:
-
[id=document.body.id]
Object optionalPage ID
normalizeEvent
Normalize the event - Convert IE-specific properties into W3C properties. Only used
if the browser is IE
(
Event
private
-
e
Parameters:
-
e
EventThe event
Returns:
Event:
A modified version of the event
stop
(
-
e
Stop this event from propagating or running the default action
Parameters:
-
e
EventThe event