It seem to me that the DomTools addClass() and removeClass() methods only works as expected when used in js dom. When I try using them in a neko context, they do nothing.
Is this a bug, or am I doing something wrong?
In the example below, in js I get
<div class="testclass1 testclass2">Text ind childDiv.</div>
but in neko I get
<div class="testclass1">Text ind childDiv.</div>
Here's my example:
class Main {
static function main()
{
// --------------------- Setting up things...
var doc: Document = null;
var parentDiv:Element = null;
#if js
doc = Browser.document;
#else // neko
var indexHtml = '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><title>hxdom-test</title><meta name="description" content="" /></head><body><div id="parentDiv">Text in parentDiv</div></body></html>';
doc = new Parser(new BasicContentSink()).parse(indexHtml);
#end
parentDiv = doc.getElementById('parentDiv');
var childDiv:EDiv = new EDiv();
childDiv.addText('Text ind childDiv.');
// --------------------- Here's the problem!
childDiv.setAttr('class', 'testclass1'); // <- This works in neko and js
childDiv.addClass('testclass2'); // <- This works only in js, not in neko
parentDiv.appendChild(childDiv.node);
#if neko
var html = new Serializer().serializeToString(doc).htmlUnescape();
trace(html);
//sys.io.File.saveContent('test-index.html', html);
#end
}
}
Hi Sam!
It seem to me that the DomTools addClass() and removeClass() methods only works as expected when used in js dom. When I try using them in a neko context, they do nothing. Is this a bug, or am I doing something wrong?
In the example below, in js I get
but in neko I get
Here's my example: