Skip to content

Commit

Permalink
Merge pull request #14 from cjwillcock/cjw-bugfix-2
Browse files Browse the repository at this point in the history
Preserve combinators that are not surrounded by white space
  • Loading branch information
ThomasWeinert authored Jun 27, 2018
2 parents 05de8df + e2bcea9 commit f30cce2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/PhpCss/Scanner/Patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ abstract class Patterns {

const COMBINATOR = '(\s*[>+~]\s*)S';

const CLASS_SELECTOR = '(\.[^\r\n\t .,#:()[\\]\\\'"]+)S';
const ID_SELECTOR = '(#[^\r\n\t .,#:()[\\]\\\'"]+)S';
const PSEUDO_CLASS = '(:[^\r\n\t .,#:()[\\]\\\'"]+)S';
const CLASS_SELECTOR = '(\.[^\r\n\t >+~.,#:()[\\]\\\'"]+)S';
const ID_SELECTOR = '(#[^\r\n\t >+~.,#:()[\\]\\\'"]+)S';
const PSEUDO_CLASS = '(:[^\r\n\t >+~.,#:()[\\]\\\'"]+)S';
const PSEUDO_ELEMENT = '(::[^\r\n\t .,#:()[\\]\\\'"]+)S';

const ATTRIBUTE_OPERATOR = '([~^$*|]?=)S';
Expand Down
4 changes: 4 additions & 0 deletions tests/PhpCssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ public static function provideReformattedCss() {
array('element > child', 'element > child'),
array('element child', 'element child'),
array('html|*:not(:link):not(:visited)', 'html|*:not(:link):not(:visited)'),
array('li + li', 'li+li'),
array('li.class > li', 'li.class>li'),
array('li#id ~ li', 'li#id~li'),
array('li:hover + li', 'li:hover+li'),

// pseudo class positions
array('tr:nth-child(odd)', 'tr:nth-child(2n+1)'),
Expand Down

0 comments on commit f30cce2

Please sign in to comment.