Skip to content

Conversation

@ju1ius
Copy link

@ju1ius ju1ius commented Sep 22, 2011

I had to change the implementation of CSSRuleSet.
The rules list is now a numerically indexed array instead of an associative array.
This allows us to have things like this:

p {
  border-style: solid !important;
  foobar: baz;
  border-style: none;
}

And then do this:

foreach($oRuleSet->getRules('border-style') as $position => $rule) {
  printf("%d => %s", $position, $rule);
}
/*
0 =>  border-style: solid !important;
2 => border-style: none;
*/
echo $oRuleSet->getAppliedRule('border-style');
/*
border-style: solid !important;
*/

This allows expand/createShorthands to get around some edge cases.

@sabberworm
Copy link
Collaborator

I don’t know what I was thinking when I implemented CSSRuleSet as an associative array; I should have thought of vendor-specific values and the !important flag. I would still, however, like to stick with the existing API as closely as possible, e.g. passing ('font-') instead of ('font', true) to removeRule and getRule (and revert the name change from removeRule to remove).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also return textism: none when asked for ('text', true) where the old code would not when asked for ('text-').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants