If you inspect the root node of the dataset, you should get something like:
«LzDataElement#0| <root/>» {
_events: null
attributes: {}
childNodes: []
nodeName: 'root'
nodeType: 1
ownerDocument: <theData><root/></theData>
parentNode: <theData><root/></theData>
sel: false
}
After adding an element, you should see something like:
«LzDataElement#0| <root><theNewTag id="id1"/></root>» {
_events: null
attributes: {}
childNodes: [<theNewTag id="id1"/>]
nodeName: 'root'
nodeType: 1
ownerDocument: <theData><root><theNewTag id="id1"/></root></theData>
parentNode: <theData><root><theNewTag id="id1"/></root></theData>
sel: false
}
Here's the code I've used for testing with 5.0:
<canvas height="800">
<attribute name="counter" type="number" value="1" />
<dataset name='theData'>
<root />
</dataset>
<button text="Inspect root"
onclick="Debug.inspect(theData.getFirstChild())" />
<button y="30" text="Add element">
<handler name="onclick">
var rootEl = theData.getFirstChild(),
newEl = new lz.DataElement('theNewTag',
{id: 'id' + (canvas.counter++)});
rootEl.appendChild(newEl);
Debug.inspect(rootEl);
</handler>
</button>
</canvas>
- Raju