зеркало из https://github.com/mozilla/gecko-dev.git
70 строки
2.1 KiB
XML
70 строки
2.1 KiB
XML
<?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="resource:/res/samples/xul.css" type="text/css"?>
|
|
|
|
<window
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
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/1999/02/22-rdf-syntax-ns#_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);">
|
|
<treecolgroup>
|
|
<treecol resource="http://home.netscape.com/NC-rdf#Name" flex="1"/>
|
|
<treecol resource="http://home.netscape.com/NC-rdf#URL" flex="1"/>
|
|
</treecolgroup>
|
|
<treehead>
|
|
<treeitem>
|
|
<treecell>Name</treecell>
|
|
<treecell>URL</treecell>
|
|
</treeitem>
|
|
</treehead>
|
|
|
|
<treebody id="NC:BookmarksRoot">
|
|
</treebody>
|
|
</tree>
|
|
|
|
</window>
|