Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow universal CSS values for all properties #410

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

zerocrates
Copy link
Contributor

Support for the universal or "CSS-wide" property values (initial, inherit, and unset, see https://www.w3.org/TR/css-values/#common-keywords) is mixed at the moment.

Several properties manually are defined to allow initial and inherit, currently:

  • background-size
  • width
  • height
  • max-width
  • max-height
  • min-width
  • min-height
  • text-decoration-line
  • text-decoration-style
  • text-decoration-thickness

Separately, inherit is allowed for every property, but only in the style attribute, not in an extracted style block (the code that does this is only in the CSS AttrDef).

This PR removes the special case in AttrDef_CSS and the explicit enum definitions in the CSSDefinition, and replaces both with checks in AttrDef_CSS and Filter_ExtractStyleBlocks against an enum of initial, inherit, and unset, making all three values allowed for all defined properties in both the attribute and block contexts.

unset, which hasn't previously been allowed here, is comparable to initial and inherit: for properties that inherit by default, it acts as inherit, for those that don't, it acts as initial.

@zerocrates zerocrates changed the title Allow universal CSS values for all properties feat: Allow universal CSS values for all properties Jun 28, 2024
@ezyang ezyang merged commit 9723267 into ezyang:master Jun 28, 2024
12 of 13 checks passed
@zerocrates zerocrates deleted the css-universal-values branch June 28, 2024 19:01
github-actions bot pushed a commit that referenced this pull request Nov 1, 2024
# [4.18.0](v4.17.0...v4.18.0) (2024-11-01)

### Bug Fixes

* Adjust Core.AllowHostnameUnderscore to consider that "_" is defined as Unreserved Characters in RFC 3986 ([#406](#406)) ([d9fbef8](d9fbef8))
* Avoid a deprecated error when the attribute name is numeric and DirectLex is used ([#412](#412)) ([f0fbf51](f0fbf51))
* checking that node has property name ([#399](#399)) ([9ca5a36](9ca5a36))
* Ignore conditional comments ([#401](#401)) ([4828fdf](4828fdf))
* Support PHP 8.4 ([#396](#396)) ([92da247](92da247))
* undefined array key warning ([#419](#419)) ([01be377](01be377))

### Features

* Add allowfullscreen attr for iframe ([#411](#411)) ([70754a2](70754a2))
* add directive for removing blank nodes ([#404](#404)) ([c9d60c9](c9d60c9))
* Add support for CSS aspect-ratio ([#408](#408)) ([93bee73](93bee73))
* Allow universal CSS values for all properties ([#410](#410)) ([9723267](9723267))
Copy link

github-actions bot commented Nov 1, 2024

🎉 This PR is included in version 4.18.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants