Changelog
[1.2.5] 2026-08-17 Security (1)
Security
htmlToTextnow parses in an inert document (src/htmlToText.ts). It built the text by assigning the input toinnerHTMLon an element owned by the livedocument. Detaching that element is not protection: the assignment still starts resource fetches and can fire their handlers, sohtmlToText('<img src=x onerror=alert(1)>')executed script. The function’s entire purpose is stripping markup out of untrusted HTML — API descriptions, CMS bodies, user content — so every call site was passing exactly the input that triggers it. Parsing now happens insidedocument.implementation.createHTMLDocument(""), which has no browsing context and is therefore never “fully active”, soonerror/onloadhandlers are never dispatched. Return value for ordinary input is unchanged.
[1.2.4] 2026-05-26 Fixed (3) · Removed (1) · Added (5)
Fixed
setFavIconnow writes tocurrentMetaData.favIcon(previously wrote tocurrentMetaData.color).getMetaData("favIcon")now reflects the last value passed tosetFavIcon(metadata.ts:249).setCanonicalUrlnow writes tocurrentMetaData.url(previously wrote tocurrentMetaData.color).getMetaData("url")now reflects the last value passed tosetCanonicalUrl(metadata.ts:275).setPageColornow emits<meta name="theme-color">per the HTML spec (previously emitted<meta property="theme-color">, which user agents ignore). Fixed by adding"theme-color"to thename=special-case list inmeta()(metadata.ts:107).
Removed
- Deleted the orphan
src/elments.tsfile (misspelled name intentional). It declared a privateattributesList(domElement)helper that was never exported fromsrc/index.ts. Equivalent behaviour is already available viagetElementAttributesinsrc/metadata.ts.
Added
- Test suite. 81 vitest unit tests under happy-dom across
metadata,css-variable,dimensions,htmlToText,loadScript,prefers-dark-mode,pressed,scrollTo,fonts, and the package-levelindex. Total: 81 passing, 0 skipped. - AI kit.
llms.txt,llms-full.txt, and askills/folder (README,overview,metadata,head-elements,assets,interactions,recipes) for tool-assisted development. - CI. GitHub Actions workflow: Node 18/20/22 on Ubuntu, plus Node 20 on Windows.
vitest.config.tsbased on the @mongez/react-atom pattern. happy-dom environment, self-detecting sibling-alias helper (currently no aliases — kept for future use), anddisableJavaScriptFileLoading/disableCSSFileLoading/disableIframePageLoadinghappy-dom settings so absolute-URL<link>and<script>tags don’t trigger real network calls during the test run.package.jsonfields.description(was generic),keywords(expanded),repository,sideEffects: false,scripts.test,scripts.test:watch, and devDependencies forhappy-dom,typescript,vitest.
Tests
81 passing, 0 skipped