diff --git a/domkit/CssStyle.hx b/domkit/CssStyle.hx index 556fc51..01f2d47 100644 --- a/domkit/CssStyle.hx +++ b/domkit/CssStyle.hx @@ -438,6 +438,8 @@ class CssStyle { for( r in rules ) { if( !ruleMatch(r.cl,e) ) continue; + if(r.cl.pseudoClasses.has(NeedChildren) && e.parent != null) + e.parent.hasNeedChildren = true; var i = r.style.length - 1; while( i >= 0 ) { var p = r.style[i--]; @@ -591,6 +593,8 @@ class CssStyle { // parent style has changed, we need to sync children force = true; } + if (force) + e.hasNeedChildren = false; var obj : Model = e.obj; for( c in @:privateAccess obj.getChildren() ) { var c : Model = c; diff --git a/domkit/Properties.hx b/domkit/Properties.hx index ba3661b..3e6af1c 100644 --- a/domkit/Properties.hx +++ b/domkit/Properties.hx @@ -95,6 +95,7 @@ class Properties> { var dirtyPrev : Properties; var dirtyNext : Properties; var depth : Int = 0; + var hasNeedChildren = false; static var KEEP_VALUES = false; @@ -138,7 +139,7 @@ class Properties> { if( p == null ) { dirty = new DirtyList(); depth = 0; - if( prev != null ) + if( prev != null && prev.hasNeedChildren) prev.needRefresh(); // can change :first-child etc. } else { dirty = p.dirty;