Created
October 18, 2012 09:21
-
-
Save phamann/3910643 to your computer and use it in GitHub Desktop.
Example DOM ready execution as per: http://viget.com/inspire/extending-paul-irishs-comprehensive-dom-ready-execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UTIL = { | |
exec: function( controller, action ) { | |
var ns = SITENAME, | |
action = ( action === undefined ) ? "init" : action; | |
if ( controller !== "" && ns[controller] && typeof ns[controller][action] == "function" ) { | |
ns[controller][action](); | |
} | |
}, | |
init: function() { | |
var body = document.body, | |
controller = body.getAttribute( "data-controller" ), | |
action = body.getAttribute( "data-action" ); | |
UTIL.exec( "common" ); | |
UTIL.exec( controller ); | |
UTIL.exec( controller, action ); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment