Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeJs: Workaround for ArrayAccess problem affecting HtmlSerializer #32

Open
cambiata opened this issue Nov 7, 2015 · 0 comments
Open

Comments

@cambiata
Copy link

cambiata commented 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

// 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) + "'");
        }
@cambiata cambiata changed the title NodeJs: Workaround for cast to ArrayAccess problem affecting HtmlSerializer NodeJs: Workaround for ArrayAccess problem affecting HtmlSerializer Nov 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant