-
Notifications
You must be signed in to change notification settings - Fork 0
Add get all css functions method #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,26 @@ public function getSelectorsBySpecificity($sSpecificitySearch = null) | |
return $aResult; | ||
} | ||
|
||
/** | ||
* Returns all `CSSFunction` objects recursively found in the tree, no matter how deeply nested the rule sets are. | ||
* | ||
* @param CSSList|RuleSet|string $mElement | ||
* the `CSSList` or `RuleSet` to start the search from (defaults to the whole document). | ||
* If a string is given, it is used as rule name filter. | ||
* | ||
* @return array<int, CSSFunction> | ||
*/ | ||
public function getAllFunctions($mElement = null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: Could we think of a better name for this? Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm following the naming scheme of the file eg. getAllValues, getAllRulesets, etc. |
||
{ | ||
if ($mElement === null) { | ||
$mElement = $this; | ||
} | ||
/** @var array<int, Value> $aResult */ | ||
$aResult = []; | ||
$this->allFunctions($mElement, $aResult); | ||
return $aResult; | ||
} | ||
|
||
/** | ||
* Expands all shorthand properties to their long value. | ||
* | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Should we consider using generators to reduce memory usage? Would it be worthy 🤔
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.
Nice. Yet I don't think this would go well with upstream if this change makes it there :) (very conservative. Maybe with good reason)