Add dom-test-6 and dom-test-7.

This commit is contained in:
waterson%netscape.com 1999-06-20 00:23:11 +00:00
Родитель 930d505f3a
Коммит 00ab79805c
5 изменённых файлов: 119 добавлений и 0 удалений

Просмотреть файл

@ -42,6 +42,8 @@ FILES = \
dom-test-4.css \ dom-test-4.css \
dom-test-4.xul \ dom-test-4.xul \
dom-test-5.xul \ dom-test-5.xul \
dom-test-6.xul \
dom-test-7.xul \
flash-registry.rdf \ flash-registry.rdf \
flash.css \ flash.css \
flash.js \ flash.js \

Просмотреть файл

@ -1,3 +1,4 @@
<?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. This test exercises creation of DOM elements from the XUL document.
@ -19,6 +20,14 @@ function newElement()
elem.appendChild(text); elem.appendChild(text);
document.lastChild.appendChild(elem); document.lastChild.appendChild(elem);
} }
function deleteElement()
{
if (document.lastChild.lastChild) {
document.lastChild.removeChild(document.lastChild.lastChild);
}
}
</html:script> </html:script>
<html:input name="b1" <html:input name="b1"
@ -26,4 +35,9 @@ function newElement()
value="New" value="New"
onclick="newElement();"/> onclick="newElement();"/>
<html:input name="n2"
type="button"
value="Delete"
onclick="deleteElement();"/>
</foo:foo> </foo:foo>

Просмотреть файл

@ -0,0 +1,54 @@
<?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>

Просмотреть файл

@ -0,0 +1,47 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil c-basic-offset: 2 -*- -->
<!--
The test exercises creation and removal of HTML elements.
-->
<?xml-stylesheet type="text/css" href="resource:/res/samples/xul.css"?>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script>
var open = false;
function toggleOpenClose()
{
var container = document.getElementById('container');
if (open) {
// close
dump("\n\n\n\nCLOSING\n\n");
container.removeChild(container.firstChild);
}
else {
// open
dump("\n\n\n\nOPENING\n\n");
var frame = document.createElement('box');
frame.setAttribute('align', 'vertical');
frame.setAttribute('style', 'width: 50px; height: 50px; background: red;');
container.insertBefore(frame, container.firstChild);
}
open = !open;
}
</html:script>
<html:button onclick="toggleOpenClose();" flex="100%">Add/Remove Red Element At 0</html:button>
The order should stay 'blue, green, yellow'.
<box id="container" align="horizontal" style="height: 100%; width: 100%;" flex="100%">
<box align="vertical" style="width: 50px; height: 50px; background: blue;" />
<box align="vertical" style="width: 50px; height: 50px; background: green;" />
<box align="vertical" style="width: 50px; height: 50px; background: yellow;" />
</box>
</window>

Просмотреть файл

@ -36,6 +36,8 @@ FILES=\
dom-test-4.css \ dom-test-4.css \
dom-test-4.xul \ dom-test-4.xul \
dom-test-5.xul \ dom-test-5.xul \
dom-test-6.xul \
dom-test-7.xul \
flash-registry.rdf \ flash-registry.rdf \
flash.css \ flash.css \
flash.js \ flash.js \