Last active
May 28, 2025 16:06
-
-
Save jackrugile/0e674d7cf2fb2efa11bb4258098bd67c to your computer and use it in GitHub Desktop.
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
(function(){ | |
const inlineTags = new Set(['span','a','em','strong','b','i','small','sub','sup','mark','q','time','button']); | |
const blockTags = new Set(['div','p','ul','ol','li','section','article','header','footer','nav','figure','table']); | |
function walk(node){ | |
for(let child of node.children){ | |
const p = node.tagName.toLowerCase(); | |
const c = child.tagName.toLowerCase(); | |
if(inlineTags.has(p) && blockTags.has(c)) { | |
console.warn(`Invalid nesting: <${p}> → <${c}>`, node, child); | |
} | |
walk(child); | |
} | |
} | |
walk(document.body); | |
})(); |
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
javascript:(function(){const inline=new Set(['span','a','em','strong','b','i','small','sub','sup','mark','q','time','button']),block=new Set(['div','p','ul','ol','li','section','article','header','footer','nav','figure','table']);(function w(n){for(let c of n.children){if(inline.has(n.tagName.toLowerCase())&&block.has(c.tagName.toLowerCase()))console.warn('Invalid ⟨'+n.tagName.toLowerCase()+'⟩→⟨'+c.tagName.toLowerCase()+'⟩',n,c);w(c);} })(document.body);})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment