From 2bb0ce532d237305ebca096a85d4ed404b58c815 Mon Sep 17 00:00:00 2001 From: trethaller Date: Tue, 19 Feb 2019 10:58:47 +0100 Subject: [PATCH 1/2] don't parse value units when separated by a space --- domkit/CssParser.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From 928e4d738692137f1376bdabe5346096058d5c8b Mon Sep 17 00:00:00 2001 From: trethaller Date: Tue, 19 Feb 2019 10:58:57 +0100 Subject: [PATCH 2/2] document.add() --- domkit/Document.hx | 9 +++++++++ domkit/Element.hx | 4 ++++ 2 files changed, 13 insertions(+) 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 ) { }