Skip to content

v0.11.8

Latest

Choose a tag to compare

@bennypowers bennypowers released this 02 Nov 12:22

Bug Fixes

Quoted TypeScript Source Rejected as Attribute Values (#477)

manifest.Attribute.IsValidValue compared a candidate value against both the decoded literal and the raw union member. The raw member is TypeScript source text, so an attribute declared as type: "'primary' | 'secondary'" accepted the HTML value variant="'primary'", quotes included. That value is not primary, and the element would not match it.

Validation now compares against the decoded literal only. String literals accept their decoded value regardless of the quote style used in the type, so 'primary' | "secondary" accepts primary and secondary. Numeric and boolean literals are unchanged: 1 | '2' accepts both 1 and 2 and rejects the quoted strings '1' and '2'.

validate/markup inherited the bug through IsValidValue. Markup diagnosed with a value that includes source quote delimiters now reports an invalid-value diagnostic and lists the decoded values that are accepted, so tone="'calm'" against 'calm' | 'loud' is flagged instead of passing.

This changes behavior in an API introduced in v0.11.7. Its only in-tree consumer is the markup validator. If you call IsValidValue directly or embed the markup validator, pass decoded values (primary, not 'primary'); templates that already emit the unquoted value need no changes.

What's Changed

  • fix(manifest): reject TypeScript source quoting as attribute values by @bennypowers in #477

Full Changelog: v0.11.7...v0.11.8