Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Walking the DOM</title>
- <script src="isht.js"></script>
- <script>
- isht.directive('inder',function(){
- var attrs = ['first'];
- return function(node) {
- for(var i=0;i<attrs.length;i++) {
- var child = document.createElement("P");
- var textNode = document.createTextNode("Value of " + attrs[i] + " is : " + node.getAttribute(attrs[i]));
- child.appendChild(textNode);
- node.appendChild(child);
- }
- }
- });
- isht.directive('shunny',function(){
- var attrs = ['first'];
- return function(node) {
- for(var i=0;i<attrs.length;i++) {
- var child = document.createElement("P");
- var textNode = document.createTextNode("Cool : " + attrs[i] + " is : " + node.getAttribute(attrs[i]));
- child.appendChild(textNode);
- node.appendChild(child);
- }
- }
- });
- </script>
- </head>
- <body>
- <inder first="10">
- </inder>
- <shunny first="20">
- </shunny>
- <script>
- isht.bootstrap();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement