fix(issue:3766) add support for container queries #1
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.
What:
This pull request resolves issue 3766 by adding support for CSS Container Queries (https://www.w3.org/TR/css-contain-3/).
Why:
Users of Less.js may wish to use newer features of CSS supported by newer versions of most browsers.
Checklist:
Performance:
I have found performance is roughly the same, fluctuating slightly between runs of the benchmark based on whatever the host is doing.
There are a couple of quick checks added for at rules, and if the checks pass a small amount of additional code is run relative to the default branch of execution. In all, performance should be level or only slightly slower when evaluating many at rules.
Pull request branch:
master branch:
Tests:
I evaluated the CSS Container Query specification add added appropriate tests, which are passing and have been manually reviewed. All the original tests pass.
Bundle size:
Less.js 4.1.3 Official minified: 146,335 bytes
Less.js 4.1.3 Pull Request minified: 149,014 bytes
Delta: 2,679 bytes
Lines of code delta: 521 added (including tests)
Behavior of media at-rule with invalid query in parens:
Query in parens syntax comes from CSS Container Query specification, but I do not believe media at rules support them. I searched online and did some tests in a CodePen.
Both master and the pull request branch result in the following when media at rule tries to use query in parens:
Extensibility:
The pull request lays the groundwork for adding scope at rules with minimal additional effort.