public function getComputedStyle($name) { // return either explicit declarations ... $style = parent::getComputedStyle($name); if (isset($style) || !isset(self::$initialStyles[$name])) { return $style; } // ... or the default one. return self::$initialStyles[$name]; }
/** * Obtains the computed style with the given name. The 'computed style' is * the one in effect; taking inheritance and default styles into account. * * @param string $name The name of the style to compute. * * @return string|null The style value if specified anywhere, else null. */ public function getComputedStyle($name) { $style = null; if (isset($this->styles[$name])) { $style = $this->styles[$name]; } if (($style === null || $style === 'inherit') && isset($this->parent)) { return $this->parent->getComputedStyle($name); } // 'inherit' is not what we want. Either get the real style, or // nothing at all. return $style !== 'inherit' ? $style : null; }