diff --git a/src/Document/Base.php b/src/Document/Base.php index 6589386..bcdb547 100644 --- a/src/Document/Base.php +++ b/src/Document/Base.php @@ -103,7 +103,7 @@ protected static function isSupportedUnit($value) { 'cw', 'pt', ); - $re = '/^[1-9][0-9]*(' . implode('|', $units) . ')?$/'; + $re = '/^(0|[1-9][0-9]*)(' . implode('|', $units) . ')?$/'; return preg_match($re, $value); } diff --git a/tests/Document/BaseTest.php b/tests/Document/BaseTest.php index 131fe11..a887907 100644 --- a/tests/Document/BaseTest.php +++ b/tests/Document/BaseTest.php @@ -110,7 +110,7 @@ public function testSetters() { } foreach (array( // Integers. - 1, 10, 515, + 0, 1, 10, 515, // With unit. '1vh', '10vw', '515vmin', '1vmax', '1gut', '1cw', '1pt', ) as $value