From b80728bb5770e705fa8e06882857dfa29b20de8a Mon Sep 17 00:00:00 2001 From: surikat Date: Tue, 26 Jan 2016 16:44:19 +0100 Subject: [PATCH] css effective on snippet --- MarkupX/Css.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MarkupX/Css.php b/MarkupX/Css.php index 2c9e985..fc20f8d 100644 --- a/MarkupX/Css.php +++ b/MarkupX/Css.php @@ -8,12 +8,9 @@ class Css extends \RedCat\Templix\CallerMarkup{ var $selector = false; function load(){ $this->remapAttr('href'); - if($this->closest('extend')){ - $o = $this; - $this->closest()->onLoaded(function()use($o){ - $o->addCssLink(); - }); - } + $this->closest()->onLoaded(function(){ + $this->addCssLink(); + }); } function loaded(){ $this->addCssLink(); @@ -25,6 +22,8 @@ function addCssLink($css=null,$path='css/'){ if(!$css) $css = $this; $dom = $this->closest()->children('head',0); + if(!$dom) + $dom = $this->getAncestor(); if(!$dom) return; $href = trim($css->href?$css->href:($css->src?$css->src:key($css->attributes)));