Skip to content

fix: reject attribute operators without a value - #352

Open
SAY-5 wants to merge 1 commit into
postcss:mainfrom
SAY-5:fix-missing-attribute-value-20261019
Open

SAY-5 wants to merge 1 commit into
postcss:mainfrom
SAY-5:fix-missing-attribute-value-20261019

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 19, 2026

Copy link
Copy Markdown

Fixes #199.

Attribute selectors such as [href=] currently parse without an error and stringify as [href], silently dropping the operator. Require a value whenever an attribute operator is present, using the parser's existing error path. Quoted empty values such as [href=""] remain valid.

The regression tests cover all six attribute operators, whitespace, comments, namespaces, synchronous and asynchronous APIs, and PostCSS error locations. On the original code, 16 expected-error tests fail while 13 valid-input controls pass; all 29 pass with the fix.

Validation: npm test passes all 926 tests, including lint, type checking, the build and coverage thresholds. Changed files pass formatting. The full formatting command reports the same two unchanged upstream files (exceptions.mjs and pseudos.mjs) on both the original and patched trees.

AI assistance was used to develop and review this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doesn't throw error on invalid attribute

1 participant