XUL: insertBefore() a non-existent tag results in DOMs out of sync.
To continue from issue 92 (which appears to have been blocked from being reopened.)...
toolbarspacer is currently unimplemented. So instead of throwing an error when referencing the non-existent tag, ample currently results in an off-by-one error between the ample DOM and the html DOM:
e.g. After insertion of a toolbarbutton before the unimplemented "toolbarspacer" element, the ample DOM looks like this: <xul:toolbar id="toolbar1"> <xul:toolbarbutton id="buttonstart" label="Start" command="cmd_button_start"/> <xul:toolbarbutton xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="button1" label="Button 1" command="cmd_button1"/> <xul:toolbarspacer id="buttonspacer"/> <xul:toolbarbutton id="buttonend" label="End" command="cmd_button_end"/> </xul:toolbar>
whereas the HTML DOM looks like this: <div id="toolbar1" class="xul-toolbar"> <table cellpadding="0" cellspacing="0" border="0" height="100%" class="xul-box---box-container"> <tbody> <tr class="xul-toolbar--gateway"> <td style="height:100%" valign="top" align="left" class="xul-box---box-child"> <table id="buttonstart" cellpadding="0" cellspacing="0" border="0" class="xul-toolbarbutton">…</table> </td> <td style="height:100%" valign="top" align="left" class="xul-box---box-child"></td> <td xmlns="http://www.w3.org/1999/xhtml" style="height:100%" valign="top" align="left" class="xul-box---box-child"> <table id="button1" cellpadding="0" cellspacing="0" border="0" class="xul-toolbarbutton">…</table> </td> <td style="height:100%" valign="top" align="left" class="xul-box---box-child"> <table id="buttonend" cellpadding="0" cellspacing="0" border="0" class="xul-toolbarbutton">…</table> </td> </tr> </tbody> </table> </div>
Currently, the tag is being inserted into the ample DOM, but not the HTML DOM, so the id exists in one DOM but not the other, resulting in unpredictable behaviour.
IMHO, attempting to insert before a tag that has not made it into the HTML DOM should throw an error, because the tag won't actually exist. Therefore, attempting to reference an id that doesn't exist should fail and throw an error.
The first sentence in my response to issue 92 should be read as ''In Ample SDK there is NO toolbarspacer element implemented". Please re-read my reply and change the title of this issue to request for addition for toolbarspacer element.
ok, I've opened up issue #94 for the feature request. This, however, I believe is still incorrect behaviour as it's unpredictable because the DOMs should stay in sync where they're clearly not. If this can happen then an error should result, IMHO.
Why close this? There's still a problem, it's just a different problem.