Register preference and interaction media features#221
Open
jhaygood86 wants to merge 1 commit into
Open
Conversation
Add typed media-feature registrations for the Media Queries 4/5 preference and interaction features so they model as concrete media features instead of degrading to an UnknownMediaFeature (which drops the whole query to "not all"): prefers-color-scheme, prefers-reduced-motion, prefers-contrast, prefers-reduced-transparency, update, any-hover, any-pointer Each feature accepts and preserves its value via Converters.Any; this is registration/parsing only, with no query evaluation. Adds the feature name constants, one MediaFeature subclass per feature, and the factory registrations. Spec: https://www.w3.org/TR/mediaqueries-5/
jhaygood86
marked this pull request as ready for review
July 24, 2026 20:01
jhaygood86
marked this pull request as draft
July 24, 2026 20:35
jhaygood86
marked this pull request as ready for review
July 24, 2026 20:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Registers seven preference/interaction media features so they parse as typed media features instead of degrading to
not all(an unregistered feature makes the whole@mediaquery fail):prefers-color-scheme,prefers-reduced-motion,prefers-contrast,prefers-reduced-transparency,update,any-hover,any-pointer(Media Queries 5).Each is a trivial modeling addition — a
MediaFeaturesubclass whose converter isConverters.Any(accept-and-preserve), the same shape ExCSS's other discrete features use — plus aFeatureNamesconstant and aMediaFeatureFactoryregistration. Registration only; no evaluation/matching is added (ExCSS does no media evaluation).Tests
PreferenceMediaFeaturesTests— asserts each of the 7 now parses and round-trips inside@media (…)rather than degrading tonot all, plus a guard that a genuinely unknown feature (prefers-nonsense) still degrades (proving the assertions are meaningful). Full suite green across all target frameworks.Ported from PeachPDF, which vendors ExCSS.