Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Thinking Like AngularJS. For Fun and Learning.
- /*
- isht.directive('name',function(){
- return function(node) {
- //Performing Function.
- }
- })
- */
- var isht = {};
- isht.store = [];
- isht.count = 0;
- isht.directive = function(name,func) {
- // Adding Directive to the Store Array
- name = name.toUpperCase();
- this.store[name] = func();
- this.count++;
- }
- // DOM Loop for Traversing
- isht.walkTheDom = function(node,func) {
- func(node);
- node = node.firstChild;
- while(node) {
- func(node);
- this.walkTheDom(node,func);
- node = node.nextSibling;
- }
- }
- // Processing Directives
- isht.bootstrap = function() {
- // Processing Each Node
- this.walkTheDom(document.body, function(node) {
- if(isht.store[node.tagName]) {
- var directive = isht.store[node.nodeName];
- directive(node);
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement