Skip to content

Commit bf82011

Browse files
committed
cope with vendor prefixed pseudo classes
1 parent 78f5f36 commit bf82011

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

mincss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.11.1'
1+
__version__ = '0.11.2'

mincss/processor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
BEFOREAFTER_PSEUDO_CLASSES = re.compile(
4040
':(before|after)$', re.M | re.I
4141
)
42-
42+
VENDOR_PREFIXED_PSEUDO_CLASSES = re.compile(
43+
':-(webkit|moz)-'
44+
)
4345

4446
EXCEPTIONAL_SELECTORS = (
4547
'html',
@@ -488,9 +490,10 @@ def _selector_query_found(self, bodies, selector):
488490
if (
489491
MOUSE_PSEUDO_CLASSES.findall(selector) or
490492
'::' in selector or
491-
BEFOREAFTER_PSEUDO_CLASSES.findall(selector)
493+
BEFOREAFTER_PSEUDO_CLASSES.findall(selector) or
494+
VENDOR_PREFIXED_PSEUDO_CLASSES.findall(selector)
492495
):
493-
selector = selector.split(':')[0]
496+
selector = selector.split(':')[0].strip()
494497

495498
if '}' in selector:
496499
# XXX does this ever happen any more?

tests/test_mincss.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ def test_pseudo_selectors_hell(self):
153153

154154
ok_('input[type="search"]::-webkit-search-decoration' in after)
155155
ok_('input[type="reset"]::-webkit-search-decoration' not in after)
156+
ok_('input[type="search"]::-webkit-search-decoration' in after)
157+
158+
ok_('textarea:-moz-autofill' not in after)
159+
ok_(':-moz-autofill' not in after)
156160

157161
ok_('@media (max-width: 900px)' in after)
158162
ok_('.container .two' in after)

tests/three.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ input[type="button"]
1414
color: #999999;
1515
}
1616

17+
input[type="search"]:-webkit-autofill,
18+
input[type="reset"]:-webkit-autofill,
1719
input[type="search"]::-webkit-search-decoration,
1820
input[type="reset"]::-webkit-search-decoration,
1921
{
2022
-webkit-appearance: none;
2123
}
24+
textarea:-moz-autofill { foo: bar; }
2225

2326
/* A comment */
2427
@media (max-width: 900px) {

0 commit comments

Comments
 (0)