зеркало из https://github.com/mozilla/pjs.git
55 строки
1.2 KiB
XML
55 строки
1.2 KiB
XML
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil c-basic-offset: 2 -*- -->
|
|
<!--
|
|
|
|
This test exercises creation of DOM elements from the XUL document,
|
|
specifically, using the zombie pool.
|
|
|
|
-->
|
|
|
|
<?xml-stylesheet type="text/css" href="resource:/res/samples/xul.css"?>
|
|
|
|
<foo:foo xmlns:html="http://www.w3.org/TR/REC-html40"
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
<html:script>
|
|
var elem = document.createElement('html:div');
|
|
var text = document.createTextNode('Node!!!');
|
|
elem.appendChild(text);
|
|
|
|
var added = false;
|
|
|
|
dump('elem.id = ' + elem.getAttribute('id') + '\n');
|
|
|
|
function addElement()
|
|
{
|
|
if (! added) {
|
|
document.lastChild.appendChild(elem);
|
|
added = true;
|
|
|
|
// should be the same as elem.id...
|
|
dump('document.lastChild.lastChild.id = ' + document.lastChild.lastChild.getAttribute('id') + '\n');
|
|
}
|
|
}
|
|
|
|
function removeElement()
|
|
{
|
|
if (added) {
|
|
elem.parentNode.removeChild(elem);
|
|
added = false;
|
|
}
|
|
}
|
|
|
|
</html:script>
|
|
|
|
<html:input name="b1"
|
|
type="button"
|
|
value="Add"
|
|
onclick="addElement();"/>
|
|
|
|
<html:input name="n2"
|
|
type="button"
|
|
value="Remove"
|
|
onclick="removeElement();"/>
|
|
|
|
</foo:foo>
|