XMLterm changes only.
Added test HTML documents to exercise xpcom/css/dom features used by xmlterm.
This commit is contained in:
svn%xmlterm.org 2000-10-10 04:46:00 +00:00
Родитель a23c56e3af
Коммит b3d0324265
3 изменённых файлов: 67 добавлений и 0 удалений

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

@ -0,0 +1,39 @@
<!-- insertest.html: Tests insertion HTML fragments -->
<html><head>
<script language="JavaScript">
function runTest(aEvent) {
dump("runTest:\n");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var domselection = window._content.getSelection();
if (domselection && !domselection.isCollapsed &&
domselection.containsNode(aEvent.target,false))
{
var privateSelection = domselection.QueryInterface(Components.interfaces.nsISelectionPrivate);
dump("privatesel"+privateSelection+"\n");
var sel = privateSelection.QueryInterface(Components.interfaces.nsISelection);
dump("sel="+sel+"\n");
var range = sel.getRangeAt(0);
dump("range="+range+"\n");
var htmlFrag = '<SPAN onclick="' + "dump('ONCLICKED!');" + '"> <B>HTML fragment</B> </SPAN>';
var htmlFrag2 = '<DIV class="entry" name="entry" id="entry3"> <DIV class="output" name="output" id="output3"> <TABLE frame="none" border="0"> <COLGROUP colspan="5" width="1*"></COLGROUP> <TBODY> <TR> <TD> <SPAN class="directory" onclick="dump(event);"> chrome </SPAN> </TD> <TD> <SPAN class="plainfile" onclick="dump(event);"> install.js </SPAN> </TD> </TR> </TBODY> </TABLE> </DIV> </DIV>'
dump(htmlFrag2+"\n");
var docFrag = range.createContextualFragment(htmlFrag2);
dump("docFrag = "+docFrag+"\n");
dump("docFrag.firstChild = "+docFrag.firstChild+"\n");
var bodyElement = document.getElementById("bodyEl");
dump("bodyElement = "+bodyElement+"\n");
bodyElement.appendChild(docFrag.firstChild);
}
}
</script>
</head><body id="bodyEl">
<SPAN class="test" onclick="return runTest(event);">INSERT FRAGMENT TEST<SPAN>
</body></html>

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

@ -0,0 +1,21 @@
<!-- xpctest.html: Tests DOM access to style sheets -->
<html><head>
<style type="text/css">
SPAN.test { color: green }
</style>
<script language="JavaScript">
function onLoad()
{
var sheet = window.document.styleSheets[0];
dump("sheet = "+sheet+"\n");
var rule = sheet.cssRules[0];
dump("rule = "+rule+"\n");
var selectorText = rule.selectorText;
dump("selectorText = '"+selectorText+"' (correct value is 'SPAN.test')\n");
}
</script>
</head><body onload="return onLoad();">
<SPAN class="test">STYLE TEST<SPAN>
</body></html>

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

@ -0,0 +1,7 @@
<!-- xpctest.html: Tests XPCONNECT access -->
<html><head>
<script language="JavaScript">
//netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
dump("compMgr="+Components.manager+"\n");
</script>
</head><body>XPCTEST</body></html>