/** * Apply the plugin to Css object * * @param Stylecow\Css $css The css object * @param int $rem The default value for rem. This value can be overwritten for the font-face property in :root, html or body */ public static function apply(Css $css, array $browser = null) { if (!$browser) { return; } foreach ($css->getArrayCopy() as $child) { if ($child->selector->type !== '@media') { continue; } if (self::checkMediaQueries($child->selector->get(), $browser)) { foreach ($child->getChildren() as $k => $grandChild) { $child->parent->addChild($grandChild, $child->getPositionInParent() + $k); } } $child->removeFromParent(); } }