diff --git a/rdf/resources/dom-test-3.xul b/rdf/resources/dom-test-3.xul new file mode 100644 index 00000000000..1ec97fb3573 --- /dev/null +++ b/rdf/resources/dom-test-3.xul @@ -0,0 +1,67 @@ + + + + + + + +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); +} + + +Add Bookmark + + + + + + + Name + URL + + + + + + + + diff --git a/rdf/resources/dom-test-4.css b/rdf/resources/dom-test-4.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/rdf/resources/dom-test-4.xul b/rdf/resources/dom-test-4.xul new file mode 100644 index 00000000000..c2bafde6bf6 --- /dev/null +++ b/rdf/resources/dom-test-4.xul @@ -0,0 +1,58 @@ + + + + + + + + +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"); + } +} + + + + + + + This + is + really + great + diff --git a/rdf/resources/dom-test-5.xul b/rdf/resources/dom-test-5.xul new file mode 100644 index 00000000000..28d2323660d --- /dev/null +++ b/rdf/resources/dom-test-5.xul @@ -0,0 +1,29 @@ + + + + + + + +var count = 0; + +function newElement() +{ + var elem = document.createElement('foo:bar'); + var text = document.createTextNode('Node ' + ++count); + elem.appendChild(text); + document.lastChild.appendChild(elem); +} + + + + +