File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 5757_semi_re = re .compile (r';+}' )
5858
5959_zero_fmt_spec_re = re .compile (r'''(\s|:|\(|,)(?:0?\.)?0
60- (?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s| k?hz)''' ,
60+ (?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|k?hz)''' ,
6161 re .I | re .X )
6262
63+ _zero_req_unit_re = re .compile (r'''(\s|:|\(|,)(?:0?\.)?0
64+ (m?s)''' , re .I | re .X )
65+
6366_bg_pos_re = re .compile (r'''(background-position|webkit-mask-position|transform-origin|
6467 webkit-transform-origin|moz-transform-origin|o-transform-origin|
6568 ms-transform-origin):0(;|})''' , re .I | re .X )
@@ -383,6 +386,9 @@ def _replace(match):
383386 # Replace 0(px,em,%) with 0.
384387 css = _zero_fmt_spec_re .sub (lambda match : match .group (1 ) + '0' , css )
385388
389+ # Replace 0.0(m,ms) or .0(m,ms) with 0(m,ms)
390+ css = _zero_req_unit_re .sub (lambda match : match .group (1 ) + '0' + match .group (2 ), css )
391+
386392 # Replace 0 0 0 0; with 0.
387393 css = _quad_0_re .sub (r':0\1' , css )
388394 css = _trip_0_re .sub (r':0\1' , css )
Original file line number Diff line number Diff line change @@ -1505,7 +1505,7 @@ def test_yui_zeros(self):
15051505
15061506 """
15071507
1508- output = """a{margin:0;_padding-top:0;background-position:0 0;padding:0;transition:opacity 0 ;transition-delay:0 ;transform:rotate3d(0,0,0);pitch:0;pitch:0}"""
1508+ output = """a{margin:0;_padding-top:0;background-position:0 0;padding:0;transition:opacity 0s ;transition-delay:0ms ;transform:rotate3d(0,0,0);pitch:0;pitch:0}"""
15091509
15101510 self._test(input, output)
15111511
You can’t perform that action at this time.
0 commit comments