1999-04-16 12:39:29 +04:00
|
|
|
<?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.
|
|
|
|
|
|
|
|
-->
|
1999-07-10 00:42:55 +04:00
|
|
|
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
|
1999-04-16 12:39:29 +04:00
|
|
|
|
|
|
|
<window
|
2000-06-15 13:54:41 +04:00
|
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
1999-04-21 04:11:39 +04:00
|
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
1999-04-16 12:39:29 +04:00
|
|
|
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');
|
1999-04-21 04:11:39 +04:00
|
|
|
newItem.setAttribute('rdf:property', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_5');
|
1999-04-16 12:39:29 +04:00
|
|
|
|
|
|
|
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);">
|
2000-06-24 01:44:48 +04:00
|
|
|
<treecolgroup>
|
2000-09-20 14:16:53 +04:00
|
|
|
<treecol resource="http://home.netscape.com/NC-rdf#Name" flex="1"/>
|
|
|
|
<treecol resource="http://home.netscape.com/NC-rdf#URL" flex="1"/>
|
2000-06-24 01:44:48 +04:00
|
|
|
</treecolgroup>
|
1999-04-16 12:39:29 +04:00
|
|
|
<treehead>
|
|
|
|
<treeitem>
|
|
|
|
<treecell>Name</treecell>
|
|
|
|
<treecell>URL</treecell>
|
|
|
|
</treeitem>
|
|
|
|
</treehead>
|
|
|
|
|
|
|
|
<treebody id="NC:BookmarksRoot">
|
|
|
|
</treebody>
|
|
|
|
</tree>
|
|
|
|
|
|
|
|
</window>
|