зеркало из https://github.com/mozilla/pjs.git
Initial revision.
This commit is contained in:
Родитель
a5c1a36321
Коммит
0ebc9d0256
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
|
||||
This test exercises creation of DOM elements from the XUL document. It
|
||||
creates a bookmark element and tries to insert it.
|
||||
|
||||
-->
|
||||
<?xml-stylesheet href="dom-test-1.css" type="text/css"?>
|
||||
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<html:script>
|
||||
function AddBookmark()
|
||||
{
|
||||
// get the personal toolbar folder, which'll be constructed
|
||||
// automagically by RDF
|
||||
var folder = document.getElementById("NC:PersonalToolbarFolder");
|
||||
dump("folder = " + folder + "\n");
|
||||
if (folder == null)
|
||||
return;
|
||||
|
||||
var treechildren = null;
|
||||
for (var i = folder.childNodes.length - 1; i >= 0; --i) {
|
||||
dump('folder.childNodes[' + i + '].nodeName = ' + folder.childNodes[i].nodeName + '\n');
|
||||
if (folder.childNodes[i].nodeName == 'treechildren') {
|
||||
treechildren = folder.childNodes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dump("treechildren = " + treechildren + "\n");
|
||||
if (treechildren == null) {
|
||||
treechildren = document.createElement('treechildren');
|
||||
folder.appendChild(treechildren);
|
||||
}
|
||||
|
||||
var newItem = document.createElement('treeitem');
|
||||
newItem.setAttribute('id', 'http://home.netscape.com/people/waterson');
|
||||
newItem.setAttribute('type', 'http://home.netscape.com/NC-rdf#Bookmark');
|
||||
newItem.setAttribute('nc:Name', 'My Home Page');
|
||||
newItem.setAttribute('rdf:property', 'http://www.w3.org/TR/WD-rdf-syntax#_5');
|
||||
|
||||
treechildren.appendChild(newItem);
|
||||
}
|
||||
</html:script>
|
||||
|
||||
<html:button onclick="AddBookmark();">Add Bookmark</html:button>
|
||||
|
||||
<tree id="tree" datasources="rdf:bookmarks" onclick="return OpenURL(event,event.target.parentNode);">
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treehead>
|
||||
<treeitem>
|
||||
<treecell>Name</treecell>
|
||||
<treecell>URL</treecell>
|
||||
</treeitem>
|
||||
</treehead>
|
||||
|
||||
<treebody id="NC:BookmarksRoot">
|
||||
</treebody>
|
||||
</tree>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,58 @@
|
|||
<!--
|
||||
|
||||
This test exercises some of the Level 1 Core DOM APIs.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<?xml-stylesheet type="text/css" href="dom-test-4.css"?>
|
||||
|
||||
<foo:foo xmlns:foo="http://foo.bar.com/xml#" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<html:script>
|
||||
function swap()
|
||||
{
|
||||
var barElements = document.getElementsByTagName("bar");
|
||||
var child1 = barElements[1];
|
||||
dump("child1 = " + child1 + "\n");
|
||||
|
||||
var child2 = barElements[2];
|
||||
dump("child2 = " + child2 + "\n");
|
||||
|
||||
var parent = child1.parentNode;
|
||||
dump("parent = " + parent + "\n");
|
||||
|
||||
parent.insertBefore(child2, child1);
|
||||
}
|
||||
|
||||
|
||||
function toggleColor()
|
||||
{
|
||||
var barElements = document.getElementsByTagName("bar");
|
||||
var child1 = barElements[1];
|
||||
|
||||
if (child1.getAttribute("enabled")) {
|
||||
child1.removeAttribute("enabled");
|
||||
}
|
||||
else {
|
||||
child1.setAttribute("enabled", "true");
|
||||
}
|
||||
}
|
||||
</html:script>
|
||||
|
||||
<html:input name="b1"
|
||||
type="button"
|
||||
value="Swap"
|
||||
onclick="swap();"/>
|
||||
|
||||
<html:input name="b2"
|
||||
type="button"
|
||||
value="Toggle #2's Color"
|
||||
onclick="toggleColor();"/>
|
||||
|
||||
<foo:bar>This</foo:bar>
|
||||
<foo:bar id="one">is</foo:bar>
|
||||
<foo:bar id="two">really</foo:bar>
|
||||
<foo:bar>great</foo:bar>
|
||||
</foo:foo>
|
|
@ -0,0 +1,29 @@
|
|||
<!--
|
||||
|
||||
This test exercises creation of DOM elements from the XUL document.
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet type="text/css" href="dom-test-4.css"?>
|
||||
|
||||
<foo:foo xmlns:foo="http://foo.bar.com/xml#" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<html:script>
|
||||
var count = 0;
|
||||
|
||||
function newElement()
|
||||
{
|
||||
var elem = document.createElement('foo:bar');
|
||||
var text = document.createTextNode('Node ' + ++count);
|
||||
elem.appendChild(text);
|
||||
document.lastChild.appendChild(elem);
|
||||
}
|
||||
</html:script>
|
||||
|
||||
<html:input name="b1"
|
||||
type="button"
|
||||
value="New"
|
||||
onclick="newElement();"/>
|
||||
|
||||
</foo:foo>
|
Загрузка…
Ссылка в новой задаче