fix(parser): preserve prototype-named attributes
Parsing <div __proto__="value"> emits the attribute callback but silently loses the attribute from onopentag and the resulting DOM. Assignment to the inherited __proto__ setter on the attributes object does not create a string-valued own property. This also loses the attribute when the DOM is serialized.
Define that attribute as an enumerable data property. Ordinary attributes keep their existing assignment path, the dictionary retains Object.prototype, and the first duplicate attribute still wins.
Validation: three regression cases fail before the fix. npm test passes all 203 tests, including character-by-character HTML/XML input and DOM serialization, plus ESLint, TypeScript and Biome. npm run build and git diff --check pass.
Prepared and tested with OpenAI Codex assistance.
Summary by CodeRabbit
- Bug Fixes
- HTML and XML parsing now correctly preserves
__proto__attributes, including when duplicates are present, while retaining other attributes. - Serialized output now includes preserved
__proto__attributes.
- HTML and XML parsing now correctly preserves