HTML — Advanced
Web Components — native, framework-free reusable elements
Web Components let you define a genuinely new HTML element with its own encapsulated markup, styles, and behavior — usable in plain HTML with no framework, and interoperable across React/Vue/anything else since it's a real browser API, not a library convention.
The Shadow DOM (attachShadow) is the mechanism that makes this genuinely safe to drop into any page — styles defined inside it don't leak out to the rest of the page, and the page's own global CSS doesn't leak in and accidentally override the component's internals. This is real style encapsulation, not a naming convention like BEM that relies on developer discipline to avoid collisions.
The `dialog` element — native modals, real accessibility for free
Any point where untrusted data is inserted into the DOM as markup (not text) is a cross-site scripting (XSS) risk — this is fundamentally an HTML-structure problem, not just a JavaScript problem. The underlying principle: HTML has no inherent concept of "trusted" vs. "untrusted" content — the parser treats This is exactly why a Content inside showModal() gets you, entirely free from the browser: focus trapped inside the dialog (Tab can't escape to the rest of the page), Escape-to-close, a native ::backdrop pseudo-element, and the rest of the page correctly marked inert to assistive technology. A hand-built dialog eliminates by construction.HTML injection and the real XSS surface
the same whether it came from your own template or a form field an attacker filled in. Every framework's built-in escaping (React's JSX auto-escaping, Vue's {{ }} interpolation) exists specifically to prevent this class of bug by default — and every framework also has an explicit escape hatch (dangerouslySetInnerHTML, v-html) that reintroduces exactly this risk the moment untrusted data flows into it unsanitized.Browser rendering pipeline — how your HTML actually becomes pixels
tag placed in without defer/async blocks rendering — the HTML parser hits it, must stop and hand control to the JavaScript engine (since the script could use document.write to inject more HTML), fetch and execute it fully, and only then resume parsing the rest of the document. A stylesheet in similarly blocks painting (not parsing) until it's loaded, specifically to prevent a flash of unstyled content — the render tree can't be built without both the DOM and the CSSOM being ready.Document structure at scale — `template` and lazy content
is inert — never rendered, its imgs never fetched, its scripts never run — until explicitly cloned and inserted via JavaScript. This is the real, native building block that component frameworks' "template" concepts are ultimately modeled on, and it's a genuinely useful pattern on its own for repeated markup (table rows, list items) generated from data without a full framework.loading="lazy" is a real, browser-native performance optimization — for a long page with many images, only the ones near the current viewport are fetched initially, meaningfully reducing initial page weight and load time without any custom scroll-listener code.

