Skip to content

Ignore inherited object members in variable lookups - #132

Merged
ai merged 1 commit into
postcss:mainfrom
feritcemkahraman:fix-own-variable-lookups
Oct 10, 2026
Merged

ai merged 1 commit into
postcss:mainfrom
feritcemkahraman:fix-own-variable-lookups

Conversation

@feritcemkahraman

Copy link
Copy Markdown
Contributor

An undefined $constructor currently expands to function Object() { [native code] } instead of triggering the undefined-variable error. $toString similarly produces invalid CSS even in silent mode. The only option also reads inherited object members as variable values.

Check own properties before resolving values in both lookup paths. Existing undefined-value handling and explicitly defined names such as $constructor remain supported; the check also works on the supported Node 14 runtime.

Validation:

  • Three new regressions fail against the original source (39 passed, 3 failed).
  • All 42 tests pass after the change, including explicit object-member variable names.
  • c8: 100% statements, branches, functions and lines.
  • Full ESLint and git diff --check pass.

No dependencies or public API were changed.

@ai
ai merged commit 6976ffc into postcss:main Oct 10, 2026
7 checks passed
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.

2 participants