Hacker News new | ask | show | jobs
by dfabulich 46 days ago
You can also style XML documents with CSS, like this:

    <link rel="stylesheet"
       href="style.css"
       xmlns="http://www.w3.org/1999/xhtml" />
1 comments

Yeah. I want to note quickly that the currentScript method can do a bit more than that. For example, the page head can include script.js with the code for rendering the site shared header and footer. Then in the page body you can have inline scripts using the currentScript trick to add the header and footer in place, kinda like including shared templates. And it runs during page load, before even onLoad, so the page renders with header and footer straight away.
Agreed! And you aren't even restricted to currentScript; you can run arbitrary JS in an XML document, reformatting it however you like.