Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. 'use strict';
  2.  
  3. console.clear();
  4.  
  5. let body = document.getElementsByTagName('body')[0];
  6.  
  7. function findCustomTags(node) {
  8.  
  9. if (node instanceof HTMLUnknownElement || (''+node.tagName).indexOf('-') !== -1) {
  10. return (''+node.tagName).toLowerCase();
  11. }
  12.  
  13. let custom_tags = [];
  14.  
  15. // recurse into children
  16. for (let i = 0; i < node.childNodes.length; i++) {
  17. let new_tags = findCustomTags(node.childNodes[i]);
  18. custom_tags = custom_tags.concat(new_tags);
  19. };
  20.  
  21. return custom_tags;
  22. }
  23.  
  24.  
  25. console.log(findCustomTags(body));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement