Skip to content

Instantly share code, notes, and snippets.

@jackrugile
Last active May 28, 2025 16:06
Show Gist options
  • Save jackrugile/0e674d7cf2fb2efa11bb4258098bd67c to your computer and use it in GitHub Desktop.
Save jackrugile/0e674d7cf2fb2efa11bb4258098bd67c to your computer and use it in GitHub Desktop.
(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);
})();
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