-
Notifications
You must be signed in to change notification settings - Fork 143
[TASK] Use delegation for DeclarationBlock
-> RuleSet
#1194
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
base: main
Are you sure you want to change the base?
Conversation
7800603
to
73956e9
Compare
c1c27a9
to
3a278e0
Compare
c935f2c
to
1f908cf
Compare
Would be good to resolve #1247 before moving on with this. |
1f908cf
to
1ce18b7
Compare
This is almost ready for review, but some tests need to be added. Before doing so, I'd appreciate a pre-review from you: @sabberworm, @oliverklee. I'm not keen on the having the various chaining methods in For This is the only realistic way forward I see for now, in an 'Agile' sense, which can deliver what is required now, without wholescale refactoring or breaking changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach!
Maybe as another spin-off PR (or prepatch), we can introduce the interface and have one class implement it. |
This covers the maniplation of `Rule`s within the container, and may be implemented by other classes in future (e.g. #1194). Note that the naming is consistent with the current codebase, rather than what the CSS entities are now called: - `Rule` represents what is now called a "declaration"; - `RuleSet` represents what is now called a "declaration block"; - `DeclarationBlock` represents what is now called a "style rule"; - `CSSListItem` represents what is now generically called a "rule". Renaming things is part of a longer-term plan touched on in #1189.
This covers the maniplation of `Rule`s within the container, and may be implemented by other classes in future (e.g. #1194). Note that the naming is consistent with the current codebase, rather than what the CSS entities are now called: - `Rule` represents what is now called a "declaration"; - `RuleSet` represents what is now called a "declaration block"; - `DeclarationBlock` represents what is now called a "style rule"; - `CSSListItem` (closely) represents what is now generically called a "rule". Renaming things is part of a longer-term plan touched on in #1189.
|
This covers the maniplation of `Rule`s within the container, and may be implemented by other classes in future (e.g. #1194). Note that the naming is consistent with the current codebase, rather than what the CSS entities are now called: - `Rule` represents what is now called a "declaration"; - `RuleSet` represents what is now called a "declaration block"; - `DeclarationBlock` represents what is now called a "style rule"; - `CSSListItem` (closely) represents what is now generically called a "rule". Renaming things is part of a longer-term plan touched on in #1189.
This covers the maniplation of `Rule`s within the container, and may be implemented by other classes in future (e.g. #1194). Note that the naming is consistent with the current codebase, rather than what the CSS entities are now called: - `Rule` represents what is now called a "declaration"; - `RuleSet` represents what is now called a "declaration block"; - `DeclarationBlock` represents what is now called a "style rule"; - `CSSListItem` (closely) represents what is now generically called a "rule". Renaming things is part of a longer-term plan touched on in #1189.
4b3466d
to
9db9e2f
Compare
a9790f1
to
e123988
Compare
The trait provides tests for classes implementing `RuleContainer`. The test methods and data providers have been moved verbatim to the trait from `RuleSetTest`. Will be needed for #1194.
The trait provides tests for classes implementing `RuleContainer`. The test methods and data providers have been moved verbatim to the trait from `RuleSetTest`. Will be needed for #1194.
The trait provides tests for classes implementing `RuleContainer`. The test methods and data providers have been moved verbatim to the trait from `RuleSetTest`. Will be needed for #1194
61d3317
to
17885d0
Compare
I think all pre-PRs that can be separated have been completed now. |
*/ | ||
abstract class RuleSet implements CSSElement, CSSListItem, Positionable, RuleContainer | ||
class RuleSet implements CSSElement, CSSListItem, Positionable, RuleContainer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move the changes to RuleSet
(plus test coverage) to a pre-patch, too.
... rather than inheritance. This will allow `DeclarationBlock` to instead extend `CSSBlockList` in order to support [CSS nesting](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting). This is a slightly-breaking change, since now `CSSBlockList::getAllRuleSets()` will include the `RuleSet` property of the `DeclarationBlock` instead of the `DeclarationBlock` itself. Part of #1170.
Use it in the `TestCase`s for `RuleSet` and `DeclarationBlock`.
bcf5cbe
to
6974745
Compare
... rather than inheritance.
This will allow
DeclarationBlock
to instead extendCSSBlockList
in order to supportCSS nesting.
This is a slightly-breaking change, since now
CSSBlockList::getAllRuleSets()
will include theRuleSet
property of theDeclarationBlock
instead of theDeclarationBlock
itself.Part of #1170.