diff --git a/domkit/CssParser.hx b/domkit/CssParser.hx index 1413405..4235d15 100644 --- a/domkit/CssParser.hx +++ b/domkit/CssParser.hx @@ -313,9 +313,10 @@ class CssParser { } function readValueUnit( f : Float, ?i : Int ) { + var curPos = pos; var t = readToken(); return switch( t ) { - case TIdent(u): + case TIdent(u) if( pos == curPos + u.length ): if( u == "px" ) (i == null ? VFloat(f) : VInt(i)); // ignore "px" unit suffit else diff --git a/domkit/Document.hx b/domkit/Document.hx index bb513eb..588164b 100644 --- a/domkit/Document.hx +++ b/domkit/Document.hx @@ -27,4 +27,13 @@ class Document { root.remove(); } + public function add;} & T>( v : T2 ) { + var elt = v.document.root; + if( elt.parent != null ) throw "Already added"; + var parent = Element.getParent(v); + var parentElt = get(parent); + parentElt.children.push(v.document.root); + elt.parent = parentElt; + } + } \ No newline at end of file diff --git a/domkit/Element.hx b/domkit/Element.hx index 1f5e211..f153235 100644 --- a/domkit/Element.hx +++ b/domkit/Element.hx @@ -149,6 +149,10 @@ class Element { return Ok; } + public static dynamic function getParent( e : T ) : T { + return null; + } + public static dynamic function addElement( e : Element, to : Element ) { }