Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- console.clear();
- let body = document.getElementsByTagName('body')[0];
- function findCustomTags(node) {
- if (node instanceof HTMLUnknownElement || (''+node.tagName).indexOf('-') !== -1) {
- return (''+node.tagName).toLowerCase();
- }
- let custom_tags = [];
- // recurse into children
- for (let i = 0; i < node.childNodes.length; i++) {
- let new_tags = findCustomTags(node.childNodes[i]);
- custom_tags = custom_tags.concat(new_tags);
- };
- return custom_tags;
- }
- console.log(findCustomTags(body));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement