Skip to content
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

[BUGFIX] Dynamic and static pseudo-class combined #746

Merged
merged 1 commit into from Sep 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -73,6 +73,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
([#690](https://github.com/MyIntervals/emogrifier/pull/690))

### Fixed
- Dynamic pseudo-class combined with static one (rules copied to `<style>`
element, [#746](https://github.com/MyIntervals/emogrifier/pull/746))
- Descendant attribute selectors (such as `html input[disabled]`)
([#375](https://github.com/MyIntervals/emogrifier/pull/375),
[#709](https://github.com/MyIntervals/emogrifier/pull/709))
Expand Down
2 changes: 1 addition & 1 deletion src/Emogrifier.php
Expand Up @@ -77,7 +77,7 @@ class Emogrifier
*
* @var string
*/
const PSEUDO_CLASS_MATCHER = '\\S+\\-(?:child|type\\()|not\\([[:ascii:]]*\\)';
const PSEUDO_CLASS_MATCHER = '[\\w\\-]+\\-(?:child|type\\()|not\\([[:ascii:]]*\\)';

/**
* @var string
Expand Down
2 changes: 1 addition & 1 deletion src/Emogrifier/CssInliner.php
Expand Up @@ -51,7 +51,7 @@ class CssInliner extends AbstractHtmlProcessor
*
* @var string
*/
const PSEUDO_CLASS_MATCHER = '\\S+\\-(?:child|type\\()|not\\([[:ascii:]]*\\)';
const PSEUDO_CLASS_MATCHER = '[\\w\\-]+\\-(?:child|type\\()|not\\([[:ascii:]]*\\)';

/**
* @var bool[]
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/CssInlinerTest.php
Expand Up @@ -1894,6 +1894,8 @@ public function matchingSelectorWithPseudoComponentCssRuleDataProvider()
'pseudo-class & pseudo-element' => ['a:hover::after { content: "bar"; }'],
'pseudo-element & pseudo-class' => ['a::after:hover { content: "bar"; }'],
'two pseudo-classes' => ['a:focus:hover { color: green; }'],
'dynamic and static pseudo-classes' => ['a:hover:first-child { color: green; }'],
'static and dynamic pseudo-classes' => ['a:first-child:hover { color: green; }'],
];

return \array_merge($datasetsWithSelectorPseudoComponents, $datasetsWithCombinedPseudoSelectors);
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/EmogrifierTest.php
Expand Up @@ -2042,6 +2042,8 @@ public function matchingSelectorWithPseudoComponentCssRuleDataProvider()
'pseudo-class & pseudo-element' => ['a:hover::after { content: "bar"; }'],
'pseudo-element & pseudo-class' => ['a::after:hover { content: "bar"; }'],
'two pseudo-classes' => ['a:focus:hover { color: green; }'],
'dynamic and static pseudo-classes' => ['a:hover:first-child { color: green; }'],
'static and dynamic pseudo-classes' => ['a:first-child:hover { color: green; }'],
];

return \array_merge($datasetsWithSelectorPseudoComponents, $datasetsWithCombinedPseudoSelectors);
Expand Down