1

Inline rendering with document​.currentScript

simonwillison.net

Lean Rada demonstrated a technique using the document.currentScript property to enable inline rendering in JavaScript, allowing a small inline script element to replace itself on page load with dynamic content such as the current year. A shortcut function can be defined to create a minimal template language for inserting values directly within HTML.

Sign in to suggest

Key sources

  1. SOURCEsimonwillison.net
Markdown