Skip to content

Commit b03ab00

Browse files
committed
Exempt some more units from being sizes.
1 parent 4e2a510 commit b03ab00

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/CSSValue.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ public function isColorComponent() {
4141

4242
/**
4343
* Returns whether the number stored in this CSSSize really represents a size (as in a length of something on screen).
44-
* @return false if the unit is degrees, seconds or if the number is a component in a CSSColor object.
44+
* @return false if the unit an angle, a duration, a frequency or the number is a component in a CSSColor object.
4545
*/
4646
public function isSize() {
47-
return $this->sUnit !== 'deg' && $this->sUnit !== 's' && !$this->isColorComponent();
47+
$aNonSizeUnits = array('deg', 'grad', 'rad', 'turns', 's', 'ms', 'Hz', 'kHz');
48+
if(in_array($this->sUnit), $aNonSizeUnits) {
49+
return false;
50+
}
51+
return !$this->isColorComponent();
4852
}
4953

5054
public function isRelative() {

0 commit comments

Comments
 (0)