Limitations and traps
Forms you didn’t write
Section titled “Forms you didn’t write”obfo never evaluates, renders or fetches anything: it reads value, checked, files and text, and builds plain
objects and arrays. It doesn’t validate anything either. A form whose markup comes from someone else can still:
- choose every key, including
constructor,toStringand__proto__. A field named__proto__becomes an ordinary own property (obfo defines keys rather than assigning them), so it can’t replace the result’s prototype; other surprising keys are yours to reject. - choose every value, regardless of
required,pattern,min,maxormaxlength. Check the result, or callform.reportValidity()before reading. - throw. A missing key, a
bigintcast on non-integer text or afilecast on a text input throws; withobserve, passonError. Containers are read recursively, so thousands of nested containers throw aRangeError.
What isn’t read
Section titled “What isn’t read”- Custom form-associated elements (
ElementInternals) andcontenteditableregions withoutdata-obfo-value. Onlyinput,textarea,selectanddata-obfo-valueelements carry values. - Inputs outside the element, even ones associated with the form through their
formattribute. - Nothing is skipped for being disabled (unlike
FormData): a disabled input is read like any other.
What fill and observe can’t do
Section titled “What fill and observe can’t do”fillskips file inputs and checkboxes or radios read without a boolean cast, and never adds or removes elements. See Writing a form.observehears events, not property writes, and reads structure changes only on the next event. See Live values.
Testing without a browser
Section titled “Testing without a browser”obfo uses no DOM globals (element kinds come from localName; Event and timers from the element’s own window), so it
runs under Node against happy-dom without installing anything on
globalThis. Its own suite does exactly that, and three differences from a browser matter when you test code built on
it:
- Events are synchronous. happy-dom runs no microtasks between an
inputand achangedispatched from a test, so a test can’t show the double call a microtask-based coalescer made in a real browser. obfo’s Playwright suite (Chromium, Firefox, WebKit) is where that was found. innerTextkeeps whitespace a browser collapses, sodata-obfo-valuetext differs.- No file picker. Set files with
new window.DataTransfer()andinput.files = transfer.files.