Bugs found while merging
Most of @johnhenry/domable’s six source modules had no tests at all before
they were consolidated into this package. Testing them together for the
first time surfaced real bugs — fixed here, not silently ported:
react-to-dom: referenced a barereact.type/react.propsthat was never in scope (the function’s own parameter was destructured directly) — every call to the non-fragment path threw aReferenceError.react-to-dom: a Fragment’sprops.childrenwas assumed to already be an array, but real React (anddomToReact) can hand back a single, non-array child — crashed on.map().dom-to-React: aDocumentFragment’s children were pushed into achildrenarray declared after that code ran — guaranteedReferenceErrorthe moment a fragment was converted.dom-to-React: attributes were read viaObject.entries(dom.attributes)—dom.attributesis aNamedNodeMap, not a plain object, so this never actually produced[name, value]pairs; no attribute ever made it intoprops.text-to-DOM-nodes: parsed viaDOMParser(...).body.childNodes. Per the HTML parsing spec,<style>/<script>/<link>/<meta>/<title>/<base>are parsed using “in head” rules even inside a<body>context — they silently end up in the parsed document’s<head>and never appear in.body.childNodes.simple-element’s own README used a<style>-in-shadowOpenexample as its lead “Styling Elements” demo — meaning that exact documented pattern silently produced no styling at all, in every browser, the whole time. Fixed by parsing into anHTMLTemplateElement’s.contentinstead (the standard technique for parsing an HTML fragment without element-specific top-of-document reinterpretation) — also simpler, since.contentis already a realDocumentFragment.create-element:createElement(oneNode)(a single bareNodeargument, nothing else) silently gained a second, bogus child from theprops = {}default value being swept into the children array alongside the real one. Surfaced byreactToDom’s Fragment-with-one-child path.simple-element’s own (previously unexported, untested)useShadow: falsebranch appended light-DOM children directly inside the constructor — which the Custom Elements spec forbids (only shadow-DOM content is allowed synchronously during construction; real browsers enforce this too). Fixed by deferring light-DOM content toconnectedCallback()(guarded against duplicating on reconnect).
None of these were reachable from any single module’s own test suite (most had none) — each surfaced only once another converted module fed it the exact input shape it had never actually been exercised against.