Last active
June 13, 2022 21:35
-
-
Save ebidel/4bdbe9db55d8a775d0a4 to your computer and use it in GitHub Desktop.
Revisions
-
ebidel revised this gist
Jul 31, 2016 . 2 changed files with 22 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,30 @@ // Highlights all custom elements on the page. // 7/31/2016: updated to work with both shadow dom v0 and v1. // To create a bookmarklet, use http://ted.mielczarek.org/code/mozilla/bookmarklet.html var allCustomElements = []; function isCustomElement(el) { const isAttr = el.getAttribute('is'); // Check for <super-button> and <button is="super-button">. return el.localName.includes('-') || isAttr && isAttr.includes('-'); } function findAllCustomElements(nodes) { for (let i = 0, el; el = nodes[i]; ++i) { if (isCustomElement(el)) { allCustomElements.push(el); } // If the element has shadow DOM, dig deeper. if (el.shadowRoot) { findAllCustomElements(el.shadowRoot.querySelectorAll('*')); } } } findAllCustomElements(document.querySelectorAll('*')); allCustomElements.forEach(function(el, i) { el.style.outline = '1px dashed red'; el.style.backgroundColor = 'rgba(255,0,0,0.1)'; }); 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ javascript:(function(){var allCustomElements=[];function isCustomElement(el){const isAttr=el.getAttribute('is');return el.localName.includes('-')||isAttr&&isAttr.includes('-');}function findAllCustomElements(nodes){for(let i=0,el;el=nodes[i];++i){if(isCustomElement(el)){allCustomElements.push(el);}if(el.shadowRoot){findAllCustomElements(el.shadowRoot.querySelectorAll('*'));}}}findAllCustomElements(document.querySelectorAll('*'));allCustomElements.forEach(function(el,i){el.style.outline='1px dashed red';el.style.backgroundColor='rgba(255,0,0,0.1)';});})(); -
ebidel revised this gist
May 8, 2014 . 2 changed files with 2 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,6 @@ if (!!HTMLElement.prototype.createShadowRoot) { allElements = Array.prototype.slice.call(allElements).filter(function(el) { return el.localName.indexOf('-') != -1 || el.getAttribute('is'); }).forEach(function(el, i) { el.style.outline = '1px dashed red'; el.style.backgroundColor = 'rgba(255,0,0,0.1)'; }); 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ javascript:(function(){var allElements=document.all;if(!!HTMLElement.prototype.createShadowRoot){try{allElements=document.querySelectorAll('html /deep/ *');}catch(e){}}allElements=Array.prototype.slice.call(allElements).filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).forEach(function(el,i){el.style.outline='1px dashed red';el.style.backgroundColor='rgba(255,0,0,0.1)';});})(); -
ebidel renamed this gist
May 8, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ebidel revised this gist
May 8, 2014 . 3 changed files with 20 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,19 @@ // Highlights all custom elements on the page. // To create a bookmarklet, use http://ted.mielczarek.org/code/mozilla/bookmarklet.html var allElements = document.all; if (!!HTMLElement.prototype.createShadowRoot) { try { // FF barfs on /deep/ in qSA(). allElements = document.querySelectorAll('html /deep/ *'); } catch(e) { // noop } } allElements = Array.prototype.slice.call(allElements).filter(function(el) { return el.localName.indexOf('-') != -1 || el.getAttribute('is'); }).forEach(function(el, i) { el.style.border = '1px dashed red'; //el.style.margin = '3px'; el.style.backgroundColor = 'rgba(255,0,0,0.1)'; }); 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ javascript:(function(){var allElements=document.all;if(!!HTMLElement.prototype.createShadowRoot){try{allElements=document.querySelectorAll('html /deep/ *');}catch(e){}}allElements=Array.prototype.slice.call(allElements).filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).forEach(function(el,i){el.style.border='1px dashed red';el.style.backgroundColor='rgba(255,0,0,0.1)';});})(); 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +0,0 @@ -
ebidel renamed this gist
May 7, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ebidel renamed this gist
May 7, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ebidel created this gist
May 7, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ javascript:(function(){var allElements=Array.prototype.slice.call(document.querySelectorAll('html /deep/ *'));allElements=allElements.filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).forEach(function(el,i){el.style.border='3px solid red';});})(); 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ // Highlights all custom elements on the page. // To create a bookmarklet, use http://ted.mielczarek.org/code/mozilla/bookmarklet.html var allElements = Array.prototype.slice.call(document.querySelectorAll('html /deep/ *')); allElements = allElements.filter(function(el) { return el.localName.indexOf('-') != -1 || el.getAttribute('is'); }).forEach(function(el, i) { el.style.border = '3px solid red'; });