Created
April 21, 2021 15:45
-
-
Save tomalec/a106a88b87fd71d99058444b894f82c1 to your computer and use it in GitHub Desktop.
Snippets to list all custom elements on the page.
This file contains hidden or 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
customElsMap = Array.from( document.querySelectorAll( '*' ) ).filter( (e) => e.tagName.includes('-')) | |
.reduce((accu, el)=>{ | |
let set = accu.get( el.tagName ); | |
if( ! set ) { | |
set = new Set(); | |
accu.set( el.tagName, set ); | |
} | |
set.add( el ); | |
return accu; | |
}, new Map()); | |
customElsMap = Array.from( document.querySelectorAll( '*' ) ).filter( (e) => e.tagName.includes('-')) | |
.reduce((accu, el)=>{ | |
let set = accu[ el.tagName ]; | |
if( ! set ) { | |
set = []; | |
accu[ el.tagName ] = set ; | |
} | |
set.push( el ); | |
return accu; | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment