You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a problem in how Haxe treats ArrayAccess in Node. This leads to that line 124 in HtmlSerializer.hx doesn't work - the variable a isn't set to the expected array item, instead it's null. ('unfinished' at runtime.)
Here's a workaround: instead of accessing the with square brackets (attributes[i]), they are accessed with the attributes.item(i) method already present in the dom4.Attr class.
With this quick fix, hxdom seems to work as expected for me in nodejs. (This far :-)
/ Jonas
// hxdom.HtmlSerializer, line 118
//Add in attributes
var attributes:NamedNodeMap = e.node.attributes;
for (i in 0 ... attributes.length) {
#if (js && !use_vdom)
var a:Dynamic = attributes[i];
#else
var a:dom4.Attr = cast attributes.item(i); // <--- Here's the fix!
#end
buf.add(" " + a.name + "='" + a.value.htmlEscape(true) + "'");
}
The text was updated successfully, but these errors were encountered:
cambiata
changed the title
NodeJs: Workaround for cast to ArrayAccess problem affecting HtmlSerializer
NodeJs: Workaround for ArrayAccess problem affecting HtmlSerializer
Nov 7, 2015
There seems to be a problem in how Haxe treats ArrayAccess in Node. This leads to that line 124 in HtmlSerializer.hx doesn't work - the variable a isn't set to the expected array item, instead it's null. ('unfinished' at runtime.)
Here's a workaround: instead of accessing the with square brackets (attributes[i]), they are accessed with the attributes.item(i) method already present in the dom4.Attr class.
With this quick fix, hxdom seems to work as expected for me in nodejs. (This far :-)
/ Jonas
The text was updated successfully, but these errors were encountered: