Test files for DOM manipulators.

This commit is contained in:
waterson%netscape.com 1999-03-18 20:54:14 +00:00
Родитель 1c77095e4c
Коммит de2a1b6fcf
2 изменённых файлов: 150 добавлений и 0 удалений

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

@ -0,0 +1,68 @@
window {
display: block;
}
tree {
display: table;
table-layout: fixed;
background-color: #FFFFFF;
border: none;
border-spacing: 0px;
// border-collapse: collapse;
// width: 100%;
}
treecol {
display: table-column;
width: 200px;
}
treeitem {
display: table-row;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
font-family: Verdana, Sans-Serif;
font-size: 8pt;
}
treehead treeitem treecell {
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
padding-left: 4px;
}
treeitem[selected="true"] > treecell {
background-color: yellow;
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/bookmark-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/personal-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/personal-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/bookmark-item.gif");
}

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

@ -0,0 +1,82 @@
<?xml version="1.0"?>
<?xml-stylesheet href="dom-test-1.css" type="text/css"?>
<xul:window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script>
function RemovePersonalToolbar()
{
var personalToolbarFolder = document.getElementById("NC:PersonalToolbarFolder");
dump("personalToolbarFolder = " + personalToolbarFolder + "\n");
if (personalToolbarFolder == null)
return;
var bookmarksRoot = document.getElementById("NC:BookmarksRoot");
dump("bookmarksRoot = " + bookmarksRoot + "\n");
if (bookmarksRoot == null)
return;
bookmarksRoot.removeChild(personalToolbarFolder);
}
function AddPersonalToolbar()
{
var bookmarksRoot = document.getElementById("NC:BookmarksRoot");
dump("bookmarksRoot = " + bookmarksRoot + "\n");
if (bookmarksRoot == null)
return;
var personalToolbarFolder = document.getElementById("NC:PersonalToolbarFolder");
dump("personalToolbarFolder = " + personalToolbarFolder + "\n");
if (personalToolbarFolder != null) // already there
return;
personalToolbarFolder = document.createElement("xul:treeitem");
personalToolbarFolder.setAttribute("id", "NC:PersonalToolbarFolder");
bookmarksRoot.appendChild(personalToolbarFolder);
}
function MutateBody()
{
// This test changes the "id" attribute on the treebody
var tree = document.getElementById("tree");
dump("tree = " + tree + "\n");
var body = tree.childNodes[3]; // two treecols, a treehead, and a treebody
dump("body = " + body + "\n");
var currentId = body.getAttribute("id");
dump("currentId = " + currentId + "\n");
if (currentId == "NC:BookmarksRoot") {
body.setAttribute("id", "NC:PersonalToolbarFolder");
}
else {
body.setAttribute("id", "NC:BookmarksRoot");
}
}
</html:script>
<html:button onclick="RemovePersonalToolbar();">Remove Personal Toolbar</html:button>
<html:button onclick="AddPersonalToolbar();">Add Personal Toolbar</html:button>
<html:button onclick="MutateBody();">MutateBody</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>