Bug 368994 - move mochitest tests near the code they test in the tree; Removing moved files.

r=sayrer.
This commit is contained in:
Ms2ger 2010-02-10 02:15:36 +01:00
parent 3fb4dd722a
commit 6c085e2d14
65 changed files with 0 additions and 4231 deletions

View file

@ -1,44 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=100533
-->
<head>
<title>Test for Bug 100533</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=100533">Mozilla Bug 100533</a>
<p id="display"></p>
<div id="content" >
<button id="thebutton">Test</button>
<iframe style='display: none;' src='/static/bug100533_iframe.html' id='a'></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
/** Test for Bug 100533 **/
var submitIframeForm = function() {
$('a').contentDocument.getElementById('b').submit();
}
submitted = function() {
ok(true, "Finished. Form submits when located in iframe set to display:none;");
SimpleTest.finish();
};
addLoadEvent(function() {
connect("thebutton", "click", submitIframeForm);
signal("thebutton", "click");
});
</script>
</pre>
</body>
</html>

View file

@ -1,47 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1297
-->
<head>
<title>Test for Bug 1297</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1297">Mozilla Bug 1297</a>
<p id="display"></p>
<div id="content" style="display: none">
<table border=1>
<tr>
<td id="td1" onmousedown="alert(this.cellIndex)">cellIndex=0</td>
<td id="td2" onmousedown="alert(this.cellIndex)">cellIndex=1</td>
<td id="td3" onmousedown="alert(this.cellIndex)">cellIndex=2</td>
<tr id="tr1"
onmousedown="alert(this.rowIndex)"><td>rowIndex=1<td>rowIndex=1<td>rowIndex=1</t
r>
<tr id="tr2"
onmousedown="alert(this.rowIndex)"><td>rowIndex=2<td>rowIndex=2<td>rowIndex=2</t
r>
</tr>
</table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1297 **/
is($('td1').cellIndex, 0, "cellIndex / rowIndex working td1");
is($('td2').cellIndex, 1, "cellIndex / rowIndex working td2");
is($('td3').cellIndex, 2, "cellIndex / rowIndex working td3");
is($('tr1').rowIndex, 1, "cellIndex / rowIndex working tr1");
is($('tr2').rowIndex, 2, "cellIndex / rowIndex working tr2");
</script>
</pre>
</body>
</html>

View file

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1366
-->
<head>
<title>Test for Bug 1366</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1366">Mozilla Bug 1366</a>
<p id="display"></p>
<div id="content" style="display: none">
<table id="testtable" width=150 border>
<tbody id="testbody">
<tr>
<td>cell content</td>
</tr>
</tbody>
</table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1366 **/
$('testtable').removeChild($('testbody'));
$('display').innerHTML = "SCRIPT: deleted first ROWGROUP\n";
is($('testbody'), null, "deleting tbody works");
</script>
</pre>
</body>
</html>

View file

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1400
-->
<head>
<title>Test for Bug 1400</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1400">Mozilla Bug 1400</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1400 **/
table = document.createElement("TABLE");
thead = table.createTHead();
thead2 = table.createTHead();
table.appendChild(thead);
table.appendChild(thead);
table.appendChild(thead);
table.appendChild(thead2);
table.appendChild(thead2);
table.appendChild(thead2);
table.appendChild(thead);
table.appendChild(thead2);
is(table.childNodes.length, 1,
"adding multiple theads results in one thead child");
</script>
</pre>
</body>
</html>

View file

@ -1,38 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1682
-->
<head>
<title>Test for Bug 1682</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1682">Mozilla Bug 1682</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1682 **/
var count = 1;
SimpleTest.waitForExplicitFinish();
addLoadEvent(function () {
is(count, 1, "onload executes once");
++count;
});
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

View file

@ -1,68 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=172261
-->
<head>
<title>Test for Bug 172261</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=172261">Mozilla Bug 172261</a>
<p id="display">
<iframe id="test"></iframe>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 172261 **/
SimpleTest.waitForExplicitFinish();
var callable = false;
function toggleCallable() { callable = true; }
var doTestInIframe = false;
// Shouldn't do history stuff from inside onload
addLoadEvent(function() { setTimeout(startTest, 10) });
function startTest() {
// First, create a dummy document. Use onunload handlers to make sure
// bfcache doesn't screw us up.
var doc = $("test").contentDocument;
doc.write("<html><body onunload=''>First</body></html>");
doc.close();
// Now write our test document
doc.write("<html><script>window.onerror = parent.onerror; if (parent.doTestInIframe) { parent.is(document.domain, parent.document.domain, 'Domains should match'); parent.toggleCallable(); } <" + "/script><body>Second</body></html>");
doc.close();
$("test").onload = goForward;
history.back();
}
function goForward() {
$("test").onload = doTest;
doTestInIframe = true;
history.forward();
}
function doTest() {
is($("test").contentDocument.domain, document.domain,
"Domains should match 2");
// Make that into an is() once bug 269270 is fixed.
todo($("test").contentDocument.location.href == location.href,
"Locations should match");
is(callable, true, "Subframe should be able to call us");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1823
-->
<head>
<title>Test for Bug 1823</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1823">Mozilla Bug 1823</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1823 **/
ok((document.location + "").indexOf("[") == -1, "location object has a toString()");
</script>
</pre>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=2082
-->
<head>
<title>Test for Bug 2082</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2082">Mozilla Bug 2082</a>
<p id="display"></p>
<div id="content" style="display: none">
<FORM name="gui" id="gui">
<INPUT TYPE="text" NAME="field" VALUE="some value">
</FORM>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 2082 **/
var guiform = document.getElementById("gui");
ok(document.getElementById("gui").hasChildNodes(), "form elements should be treated as form's children");
</script>
</pre>
</body>
</html>

View file

@ -1,135 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=218236
-->
<head>
<title>Test for Bug 218236</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=218236">Mozilla Bug 218236</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 218236 **/
SimpleTest.waitForExplicitFinish();
/* Test data */
var url_200 = window.location.href;
var url_404 = url_200.replace(/[^/]+$/, "this_file_is_not_going_to_be_there.dummy");
var url_connection_error = url_200.replace(/^(\w+:\/\/[^/]+?)(:\d+)?\//, "$1:9546/");
// List of tests: name of the test, URL to be requested, expected sequence
// of events and optionally a function to be called from readystatechange handler.
// Numbers in the list of events are values of XMLHttpRequest.readyState
// when readystatechange event is triggered.
var tests = [
["200 OK", url_200, [1, 2, 3, 4, "load"], null],
["404 Not Found", url_404, [1, 2, 3, 4, "load"], null],
["connection error", url_connection_error, [1, 2, 4, "error"], null],
["abort() call on readyState = 1", url_200, [1, 4], doAbort1],
["abort() call on readyState = 2", url_200, [1, 2, 4], doAbort2],
];
var testName = null;
var currentState = 0;
var currentSequence = null;
var expectedSequence = null;
var currentCallback = null;
var request = null;
runNextTest();
function doAbort1() {
if (request.readyState == 1)
request.abort();
}
function doAbort2() {
if (request.readyState == 2)
request.abort();
}
/* Utility functions */
function runNextTest() {
if (tests.length > 0) {
var test = tests.shift();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// Prepare request object
request = new XMLHttpRequest();
request.open("GET", test[1]);
request.onreadystatechange = onReadyStateChange;
request.onload = onLoad;
request.onerror = onError;
// Initialize state variables
testName = test[0]
currentState = 0;
currentSequence = [];
expectedSequence = test[2];
currentCallback = test[3];
// Start request
request.send(null);
}
else
SimpleTest.finish();
}
function finalizeTest() {
ok(compareArrays(expectedSequence, currentSequence), "event sequence for '" + testName + "' should be " + expectedSequence.join(", "));
runNextTest();
}
function onReadyStateChange() {
// Ignore duplicated calls for the same ready state
if (request.readyState != currentState) {
currentState = request.readyState;
currentSequence.push(currentState);
}
if (currentState == 4) {
// Allow remaining event to fire but then we are finished with this test
setTimeout(finalizeTest, 0);
}
if (currentCallback)
currentCallback();
}
function onLoad() {
currentSequence.push("load");
}
function onError() {
currentSequence.push("error");
}
function compareArrays(array1, array2) {
if (array1.length != array2.length)
return false;
for (var i = 0; i < array1.length; i++)
if (array1[i] != array2[i])
return false;
return true;
}
</script>
</pre>
</body>
</html>

View file

@ -1,29 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=218277
-->
<head>
<title>Test for Bug 218277</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=218277">Mozilla Bug 218277</a>
<p id="display"></p>
<div id="content" style="display: block">
<input id="ctrl" name="ctrl" size="20" value="keep&nbsp;together" readonly />
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 218277 **/
is(escape($('ctrl').value), "keep%A0together", "nbsp preserved in form submissions");
</script>
</pre>
</body>
</html>

View file

@ -1,29 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=237071
-->
<head>
<title>Test for Bug 237071</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=237071">Mozilla Bug 237071</a>
<p id="display"></p>
<div id="content" >
<ol id="theOL" start="22">
<li id="foo" >should be 22</li>
<li id="foo23">should be 23</li>
</ol>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 237071 **/
is($('theOL').start, 22, "OL start attribute mapped to .start, not just text attribute");
</script>
</pre>
</body>
</html>

View file

@ -1,46 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=238409
-->
<head>
<title>Test for Bug 238409</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=238409">Mozilla Bug 238409</a>
<p id="display"></p>
<div id="content" style="display: none">
<table id="table_spacing0" cellspacing="0">
<tr><td>cellspacing="0"</td></tr>
</table>
<table id="table_spacing2" cellspacing="2">
<tr><td>cellspacing="2"</td></tr>
</table>
<table id="table_spacingNone">
<tr><td>no cellspacing</td></tr>
</table>
<table id="table_spacingMalformed" cellspacing>
<tr><td>malformed cellspacing</td></tr>
</table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 238409 **/
ok(document.getElementById("table_spacing0").cellSpacing == "0", "parsing table with cellspacing='0'");
ok(document.getElementById("table_spacing2").cellSpacing == "2", "parsing table with cellspacing='2'");
ok(document.getElementById("table_spacingNone").cellSpacing == "", "parsing table without cellspacing");
ok(document.getElementById("table_spacingMalformed").cellSpacing == "", "parsing table with malformed cellspacing");
</script>
</pre>
</body>
</html>

View file

@ -1,32 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=24958
-->
<head>
<title>Test for Bug 24958</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<SCRIPT id="foo" TYPE="text/javascript">/*This space intentionally left blank*/</SCRIPT>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=24958">Mozilla Bug 24958</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 24958 **/
ok($("foo").text, "\/*This space intentionally left blank*\/", "HTMLScriptElement.text should return text")
</script>
</pre>
</body>
</html>

View file

@ -1,138 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=277724
-->
<head>
<title>Test for Bug 277724</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=277724">Mozilla Bug 277724</a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 277724 **/
var childUnloaded = false;
var nodes = [
[ "select", HTMLSelectElement ],
[ "textarea", HTMLTextAreaElement ],
[ "text", HTMLInputElement ],
[ "password", HTMLInputElement ],
[ "checkbox", HTMLInputElement ],
[ "radio", HTMLInputElement ],
[ "image", HTMLInputElement ],
[ "submit", HTMLInputElement ],
[ "reset", HTMLInputElement ],
[ "button input", HTMLInputElement ],
[ "hidden", HTMLInputElement ],
[ "file", HTMLInputElement ],
[ "submit button", HTMLButtonElement ],
[ "reset button", HTMLButtonElement ],
[ "button", HTMLButtonElement ]
];
function startTest(frameid) {
is(childUnloaded, false, "Child not unloaded yet");
var doc = $(frameid).contentDocument;
ok(doc instanceof Document, "Check for doc", "doc should be a document");
for (var i = 0; i < nodes.length; ++i) {
var id = nodes[i][0];
var node = doc.getElementById(id);
ok(node instanceof nodes[i][1],
"Check for " + id, id + " should be a " + nodes[i][1]);
is(node.disabled, false, "check for " + id + " state");
node.disabled = true;
is(node.disabled, true, "check for " + id + " state change");
}
$(frameid).onload = function () { continueTest(frameid) };
// Do this off a timeout so it's not treated like a replace load.
function loadBlank() {
$(frameid).contentWindow.location = "about:blank";
}
setTimeout(loadBlank, 0);
}
function continueTest(frameid) {
is(childUnloaded, true, "Unload handler should have fired");
var doc = $(frameid).contentDocument;
ok(doc instanceof Document, "Check for doc", "doc should be a document");
for (var i = 0; i < nodes.length; ++i) {
var id = nodes[i][0];
var node = doc.getElementById(id);
ok(node === null,
"Check for " + id, id + " should be null");
}
$(frameid).onload = function() { finishTest(frameid) };
// Do this off a timeout too. Why, I'm not sure. Something in session
// history creates another history state if we don't. :(
function goBack() {
$(frameid).contentWindow.history.back();
}
setTimeout(goBack, 0);
}
// XXXbz this is a nasty hack to work around the XML content sink not being
// incremental, so that the _first_ control we test is ok but others are not.
var testIs = is;
var once = false;
function flipper(a, b, c) {
if (once) {
todo(a == b, c);
} else {
once = true;
is(a, b, c);
}
}
function finishTest(frameid) {
var doc = $(frameid).contentDocument;
ok(doc instanceof Document, "Check for doc", "doc should be a document");
for (var i = 0; i < nodes.length; ++i) {
var id = nodes[i][0];
var node = doc.getElementById(id);
ok(node instanceof nodes[i][1],
"Check for " + id, id + " should be a " + nodes[i][1]);
testIs(node.disabled, true, "check for " + id + " state restore");
}
if (frameid == "frame2") {
SimpleTest.finish();
} else {
childUnloaded = false;
// XXXbz this is a nasty hack to deal with the content sink. See above.
testIs = flipper;
$("frame2").onload = function () { startTest("frame2") };
$("frame2").src = "/static/bug277724_iframe2.xhtml";
}
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<!-- Don't use display:none, since we don't support framestate restoration
without a frame tree -->
<div id="content" style="visibility: hidden">
<iframe src="/static/bug277724_iframe1.html" id="frame1"
onload="startTest('frame1')"></iframe>
<iframe src="" id="frame2"></iframe>
</div>
</body>
</html>

View file

@ -1,121 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=300691
-->
<head>
<title>Test for Bug 300691</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300691">Mozilla Bug 300691</a>
<p id="display">
<textarea id="target"></textarea>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
var t = $("target");
/** Test for Bug 300691 **/
function valueIs(arg, reason) {
is(t.value, arg, reason);
}
function defValueIs(arg, reason) {
is(t.defaultValue, arg, reason);
}
valueIs("", "Nothing in the textarea");
defValueIs("", "Nothing in the textarea 2");
t.appendChild(document.createTextNode("ab"));
valueIs("ab", "Appended textnode");
defValueIs("ab", "Appended textnode 2");
t.firstChild.data = "abcd";
valueIs("abcd", "Modified textnode text");
defValueIs("abcd", "Modified textnode text 2");
t.appendChild(document.createTextNode("efgh"));
valueIs("abcdefgh", "Appended another textnode");
defValueIs("abcdefgh", "Appended another textnode 2");
t.removeChild(t.lastChild);
valueIs("abcd", "Removed textnode");
defValueIs("abcd", "Removed textnode 2");
t.appendChild(document.createTextNode("efgh"));
valueIs("abcdefgh", "Appended yet another textnode");
defValueIs("abcdefgh", "Appended yet another textnode 2");
t.normalize();
valueIs("abcdefgh", "Normalization changes nothing for the value");
defValueIs("abcdefgh", "Normalization changes nothing for the value 2");
t.defaultValue = "abc";
valueIs("abc", "Just set the default value on non-edited textarea");
defValueIs("abc", "Just set the default value on non-edited textarea 2");
t.appendChild(document.createTextNode("defgh"));
valueIs("abcdefgh", "Appended another textnode again");
defValueIs("abcdefgh", "Appended another textnode again 2");
t.focus(); // This puts the caret at the end of the textarea, and doing
// something like "home" in a cross-platform way is kinda hard.
sendKey("left");
sendKey("left");
sendKey("left");
sendString("Test");
valueIs("abcdeTestfgh", "Typed 'Test' after three left-arrows starting from end");
defValueIs("abcdefgh", "Typing 'Test' shouldn't affect default value");
sendKey("right");
sendKey("right");
sendKey("back_space");
sendKey("back_space");
valueIs("abcdeTesth",
"Backspaced twice after two right-arrows starting from end of typing");
defValueIs("abcdefgh", "Deleting shouldn't affect default value");
t.appendChild(document.createTextNode("ijk"));
valueIs("abcdeTesth",
"Appending textnode shouldn't affect value in edited textarea");
defValueIs("abcdefghijk", "Appended textnode 3");
t.lastChild.data = "lmno";
valueIs("abcdeTesth",
"Modifying textnode text shouldn't affect value in edited textarea");
defValueIs("abcdefghlmno", "Modified textnode text 3");
t.removeChild(t.firstChild);
valueIs("abcdeTesth",
"Removing child textnode shouldn't affect value in edited textarea");
defValueIs("defghlmno", "Removed textnode 3");
t.insertBefore(document.createTextNode("abc"), t.firstChild);
valueIs("abcdeTesth",
"Inserting child textnode shouldn't affect value in edited textarea");
defValueIs("abcdefghlmno", "Inserted a text node");
t.normalize();
valueIs("abcdeTesth", "Normalization changes nothing for the value 3");
defValueIs("abcdefghlmno", "Normalization changes nothing for the value 4");
t.defaultValue = "abc";
valueIs("abcdeTesth", "Setting default value shouldn't affect edited textarea");
defValueIs("abc", "Just set the default value textarea");
</script>
</pre>
</body>
</html>

View file

@ -1,143 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=300691
-->
<head>
<title>Test for Bug 300691</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300691">Mozilla Bug 300691</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="text/javascript">
// First, setup. We'll be toggling these variables as we go.
// Note that scripts don't execute immediately when you put text in them --
// they wait for the currently-running script to finish.
var test1Ran = false;
var test2Ran = false;
var test3Ran = false;
var test4Ran = false;
var test5Ran = false;
var test6Ran = false;
var test7Ran = false;
var test8Ran = false;
var test9Ran = false;
var test10Ran = false;
var test11Ran = false;
var test12Ran = false;
var test13Ran = false;
var test14aRan = false;
var test14bRan = false;
var test15aRan = false;
var test15bRan = false;
</script>
<script id="test1" type="text/javascript">test1Ran = true;</script>
<script id="test2" type="text/javascript"></script>
<script id="test3" type="text/javascript">;</script>
<script id="test4" type="text/javascript"> </script>
<script id="test5" type="text/javascript"></script>
<script id="test6" type="text/javascript"></script>
<script id="test7" type="text/javascript"></script>
<script id="test8" type="text/javascript"></script>
<script id="test9" type="text/javascript"></script>
<script id="test10" type="text/javascript" src="data:text/javascript,">
test10Ran = true;
</script>
<script id="test11" type="text/javascript"
src="data:text/javascript,test11Ran = true">
test11Ran = false;
</script>
<script id="test12" type="text/javascript"></script>
<script id="test13" type="text/javascript"></script>
<script id="test14" type="text/javascript"></script>
<script id="test15" type="text/javascript"></script>
<script class="testbody" type="text/javascript">
/** Test for Bug 300691 **/
$("test2").appendChild(document.createTextNode("test2Ran = true"));
is(test2Ran, false, "Not yet 2!");
$("test3").appendChild(document.createTextNode("test3Ran = true"));
is(test3Ran, false, "Not yet 3!");
$("test4").appendChild(document.createTextNode("test4Ran = true"));
is(test4Ran, false, "Not yet 4!");
$("test5").appendChild(document.createTextNode(" "));
$("test5").appendChild(document.createTextNode("test5Ran = true"));
is(test5Ran, false, "Not yet 5!");
$("test6").appendChild(document.createTextNode(" "));
$("test7").appendChild(document.createTextNode(""));
$("test8").appendChild(document.createTextNode(""));
$("test9").appendChild(document.createTextNode(""));
$("test12").src = "data:text/javascript,test12Ran = true;";
is(test12Ran, false, "Not yet 12!");
$("test13").setAttribute("src", "data:text/javascript,test13Ran = true;");
is(test13Ran, false, "Not yet 13!");
$("test14").src = "data:text/javascript,test14aRan = true;";
$("test14").appendChild(document.createTextNode("test14bRan = true"));
is(test14aRan, false, "Not yet 14a!");
is(test14bRan, false, "Not yet 14b!");
$("test15").src = "data:text/javascript,test15aRan = true;";
$("test15").appendChild(document.createTextNode("test15bRan = true"));
$("test15").removeAttribute("src");
is(test15aRan, false, "Not yet 15a!");
is(test15bRan, false, "Not yet 15b!");
</script>
<script type="text/javascript">
// Follow up on some of those
$("test6").appendChild(document.createTextNode("test6Ran = true"));
is(test6Ran, false, "Not yet 6!");
$("test7").appendChild(document.createTextNode("test7Ran = true"));
is(test7Ran, false, "Not yet 7!");
$("test8").insertBefore(document.createTextNode("test8Ran = true"),
$("test8").firstChild);
is(test8Ran, false, "Not yet 8!");
$("test9").firstChild.data = "test9Ran = true";
is(test9Ran, false, "Not yet 9!");
</script>
<script type="text/javascript">
is(test1Ran, true, "Should have run!");
is(test2Ran, true, "Should execute empty script on child append");
is(test3Ran, false, "Already executed test3 script once");
is(test4Ran, false,
"Shouldn't execute whitespace-only script on child append; should have executed it before");
is(test5Ran, true,
"By the time it tries to execute, it's got both textnodes");
is(test6Ran, false,
"Shouldn't execute whitespace-only script on child append 2; should have executed it when it became nonempty");
is(test7Ran, true, "Should execute empty script on child append 2");
is(test8Ran, true, "Should execute empty script on child insert");
is(test9Ran, true, "Should execute empty script if child gets some text");
is(test10Ran, false, "Has an src; inline part shouldn't run");
is(test11Ran, true, "Script with src should have run");
is(test12Ran, true, "Setting src should execute script");
is(test13Ran, true, "Setting src attribute should execute script");
is(test14aRan, true, "src attribute takes precedence over inline content");
is(test14bRan, false, "src attribute takes precedence over inline content 2");
is(test15aRan, true,
"src attribute load should have started before the attribute got removed");
is(test15bRan, false,
"src attribute still got executed, so this shouldn't have been");
</script>
</pre>
</body>
</html>

View file

@ -1,51 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=300691
-->
<head>
<title>Test for Bug 300691</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300691">Mozilla Bug 300691</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="text/javascript">
// First, setup. We'll be toggling these variables as we go.
// Note that scripts don't execute immediately when you put text in them --
// they wait for the currently-running script to finish.
var test1Ran = false;
var test2Ran = false;
var test3Ran = false;
</script>
<script id="test1" type="text/javascript">test1Ran = true;</script>
<script id="test2" type="text/javascript"></script>
<script id="test3" type="text/javascript"></script>
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for Bug 300691 **/
$("test2").appendChild(document.createCDATASection("test2Ran = true"));
is(test2Ran, false, "Not yet 2!");
$("test3").appendChild(document.createCDATASection(""));
]]>
</script>
<script type="text/javascript">
// Follow up on some of those
$("test3").firstChild.data = "test3Ran = true";
is(test3Ran, false, "Not yet 3!");
</script>
<script type="text/javascript">
is(test1Ran, true, "Should have run!");
is(test2Ran, true, "Should execute empty script on child append");
is(test3Ran, true, "Should execute empty script if child gets some text");
</script>
</pre>
</body>
</html>

View file

@ -1,423 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=302186
-->
<head>
<title>Test for Bug 302186</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style>
span { color: red }
:default + span { color: green }
/* static default 5 */
span.reverse5 { color: green }
:default + span.reverse5 { color: red }
/* dynamic default 6 */
span.reverse6 { color: green }
:default + span.reverse6 { color: red }
/* dynamic default 7 */
span.reverse7 { color: green }
:default + span.reverse7 { color: red }
/* dynamic default 8 */
span.reverse8 { color: green }
:default + span.reverse8 { color: red }
/* dynamic default 9 */
span.reverse9 { color: green }
:default + span.reverse9 { color: red }
/* dynamic default 10 */
span.reverse10 { color: green }
:default + span.reverse10 { color: red }
/* dynamic default 11 */
span.reverse11 { color: green }
:default + span.reverse11 { color: red }
/* dynamic default 12 */
span.reverse12 { color: green }
:default + span.reverse12 { color: red }
/* dynamic default 13 */
span.reverse13 { color: green }
:default + span.reverse13 { color: red }
/* dynamic default 14 */
span.reverse14 { color: green }
:default + span.reverse14 { color: red }
/* dynamic default 15 */
span.reverse15 { color: green }
:default + span.reverse15 { color: red }
/* dynamic default 16 */
span.reverse16 { color: green }
:default + span.reverse16 { color: red }
/* dynamic default 17 */
span.reverse17 { color: green }
:default + span.reverse17 { color: red }
/* dynamic default 18 */
span.reverse18 { color: green }
:default + span.reverse18 { color: red }
/* dynamic default 19 */
span.reverse19 { color: green }
:default + span.reverse19 { color: red }
/* dynamic default 20 */
span.reverse20 { color: green }
:default + span.reverse20 { color: red }
button { display: none }
input { display: none }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=302186">Mozilla Bug 302186</a>
<p id="display"></p>
<div id="content" style="display: block">
<!-- static default 5 -->
<form>
<div>
<input type="image"><span id="5a">There should be no red.</span>
</div>
<div>
<input type="image"><span id="5b" class="reverse5">There should be no red.</span>
</div>
</form>
<!-- dynamic default 6 -->
<form>
<div id="div6">
<span id="6a">There should be no red.</span>
</div>
<div>
<input type="submit"><span id="6b" class="reverse6">There should be no red.</span>
</div>
</form>
<!-- dynamic default 7 -->
<form>
<div>
<input type="submit"><span id="7a">There should be no red.</span>
</div>
<div id="div7">
<span class="reverse7" id="7b">There should be no red.</span>
</div>
</form>
<!-- dynamic default 8 -->
<form>
<div id="div8"><span id="8a">There should be no red.</span>
</div>
<div>
<input type="image" id="foo"><span class="reverse8" id="8b">There should be no red.</span>
</div>
</form>
<!-- dynamic default 9 -->
<form>
<div>
<input type="image"><span id="9a">There should be no red.</span>
</div>
<div id="div9">
<span class="reverse9" id="9b">There should be no red.</span>
</div>
</form>
<!-- dynamic default 10 -->
<form>
<div id="div10">
<input type="submit"><span id="10a" class="reverse10">There should be no red.</span>
</div>
<div>
<input type="submit"><span id="10b" >There should be no red.</span>
</div>
</form>
<!-- dynamic default 11 -->
<form>
<div id="div11a">
<input type="submit"><span id="11a">There should be no red.</span>
</div>
<div id="div11">
<input type="submit"><span id="11b" class="reverse11">There should be no red.</span>
</div>
</form>
<!-- dynamic default 12 -->
<form>
<div id="div12">
<input type="image"><span id="12a" class="reverse12">There should be no red.</span>
</div>
<div>
<input type="image"><span id="12b">There should be no red.</span>
</div>
</form>
<!-- dynamic default 13 -->
<form>
<div id="div13a">
<input type="image"><span id="13a">There should be no red.</span>
</div>
<div id="div13">
<input type="image"><span id="13b" class="reverse13">There should be no red.</span>
</div>
</form>
<!-- dynamic default 14 -->
<form>
<div id="div14a">
<input type="submit" id="foo14"><span id="14a">There should be no red.</span>
</div>
<div id="div14b">
<input type="submit" id="foo14b"><span id="14b" class="reverse14">There should be no red.</span>
</div>
</form>
<!-- dynamic default 15 -->
<form>
<div id="div15a">
<input type="image" id="foo15a"><span id="15a">There should be no red.</span>
</div>
<div id="div15b">
<input type="image" id="foo15b"><span id="15b" class="reverse15">There should be no red.</span>
</div>
</form>
<!-- dynamic default 16 -->
<form>
<div>
<input type="image" checked="checked" id="foo16"></button>
<span class="reverse16" id="16a">There should be no red.</span>
</div>
<div>
<input type="image"></button><span id="16b">There should be no red.</span>
</div>
</form>
<!-- dynamic default 17 -->
<form>
<div>
<button type="button" id="foo17"></button>
<span id="17a">There should be no red.</span>
</div>
<div>
<button type="submit"></button><span class="reverse17" id="17b">There should be no red.</span>
</div>
</form>
<!-- dynamic default 18 -->
<form>
<div>
<input type="button" id="foo18"></button>
<span id="18a">There should be no red.</span>
</div>
<div>
<input type="submit"></button><span id="18b" class="reverse18">There should be no red.</span>
</div>
</form>
<!-- dynamic default 19 -->
<form>
<div id="div19">
<span id="19a">There should be no red.</span>
</div>
</form>
<!-- dynamic default 20 -->
<form>
<div id="div20">
<span id="20a">There should be no red.</span>
</div>
</form>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 302186 **/
SimpleTest.waitForExplicitFinish();
function idColor(anId) {
var color = Color.fromComputedStyle(anId, "color");
return color.toRGBString();
}
is(idColor("5a"),"rgb(0,128,0)", "CSS static-default 5a");
is(idColor("5b"),"rgb(0,128,0)", "CSS static-default 5b");
function dynamicDefault6() {
var but = document.createElement("input");
but.setAttribute("type", "submit");
$('div6').insertBefore(but, $('div6').firstChild);
is(idColor("6a"),"rgb(0,128,0)", "CSS dynamic-default 6a");
is(idColor("6b"),"rgb(0,128,0)", "CSS dynamic-default 6b");
}
function dynamicDefault7() {
var but = document.createElement("input");
but.setAttribute("type", "submit");
$('div7').insertBefore(but, $('div7').firstChild);
is(idColor("7a"),"rgb(0,128,0)", "CSS dynamic-default 7a");
is(idColor("7b"),"rgb(0,128,0)", "CSS dynamic-default 7b");
}
function dynamicDefault8() {
var but = document.createElement("input");
but.setAttribute("type", "image");
$('div8').insertBefore(but, $('div8').firstChild);
is(idColor("8a"),"rgb(0,128,0)", "CSS dynamic-default 8a");
is(idColor("8b"),"rgb(0,128,0)", "CSS dynamic-default 8b");
}
function dynamicDefault9() {
var but = document.createElement("input");
but.setAttribute("type", "image");
$('div9').insertBefore(but, $('div9').firstChild);
is(idColor("9a"),"rgb(0,128,0)", "CSS dynamic-default 9a");
is(idColor("9b"),"rgb(0,128,0)", "CSS dynamic-default 9b");
}
function dynamicDefault10() {
var inputs = $('div10').getElementsByTagName("input");
$('div10').removeChild(inputs[0]);
todo(idColor("10a") == "rgb(0,128,0)", "CSS dynamic-default 10a");
is(idColor("10b"),"rgb(0,128,0)", "CSS dynamic-default 10b");
}
function dynamicDefault11() {
var inputs = $('div11').getElementsByTagName("input");
$('div11').removeChild(inputs[0]);
is(idColor("11a"),"rgb(0,128,0)", "CSS dynamic-default 11a");
is(idColor("11b"),"rgb(0,128,0)", "CSS dynamic-default 11b");
}
function dynamicDefault12() {
var inputs = $('div12').getElementsByTagName("input");
$('div12').removeChild(inputs[0]);
todo(idColor("12a") == "rgb(0,128,0)", "CSS dynamic-default 12a");
is(idColor("12b"),"rgb(0,128,0)", "CSS dynamic-default 12b");
}
function dynamicDefault13() {
var inputs = $('div13').getElementsByTagName("input");
$('div13').removeChild(inputs[0]);
is(idColor("13a"),"rgb(0,128,0)", "CSS dynamic-default 13a");
is(idColor("13b"),"rgb(0,128,0)", "CSS dynamic-default 13b");
}
function dynamicDefault14() {
var div1 = document.getElementById("div14a");
var inputs = div1.getElementsByTagName("input");
var firstElement = div1.removeChild(inputs[0]);
var div2 = document.getElementById("div14b");
inputs = div2.getElementsByTagName("input");
var secondElement = div2.removeChild(inputs[0]);
div1.insertBefore(secondElement, div1.firstChild);
div2.insertBefore(firstElement, div2.firstChild);
is(idColor("14a"),"rgb(0,128,0)", "CSS dynamic-default 14a");
is(idColor("14b"),"rgb(0,128,0)", "CSS dynamic-default 14b");
}
function dynamicDefault15() {
var div1 = document.getElementById("div15a");
var inputs = div1.getElementsByTagName("input");
var firstElement = div1.removeChild(inputs[0]);
var div2 = document.getElementById("div15b");
inputs = div2.getElementsByTagName("input");
var secondElement = div2.removeChild(inputs[0]);
div1.insertBefore(secondElement, div1.firstChild);
div2.insertBefore(firstElement, div2.firstChild);
is(idColor("15a"),"rgb(0,128,0)", "CSS dynamic-default 15a");
is(idColor("15b"),"rgb(0,128,0)", "CSS dynamic-default 15b");
}
function dynamicDefault16() {
$("foo16").setAttribute("type", "button");
is(idColor("16a"),"rgb(0,128,0)", "CSS dynamic-default 16a");
is(idColor("16b"),"rgb(0,128,0)", "CSS dynamic-default 16b");
}
function dynamicDefault17() {
$("foo17").setAttribute("type", "submit");
is(idColor("17a"),"rgb(0,128,0)", "CSS dynamic-default 17a");
is(idColor("17b"),"rgb(0,128,0)", "CSS dynamic-default 17b");
}
function dynamicDefault18() {
$("foo18").setAttribute("type", "submit");
is(idColor("18a"),"rgb(0,128,0)", "CSS dynamic-default 18a");
is(idColor("18b"),"rgb(0,128,0)", "CSS dynamic-default 18b");
}
function dynamicDefault19() {
var newSubmit = document.createElement("input");
newSubmit.setAttribute("type", "submit");
var div1 = document.getElementById("div19");
div1.insertBefore(newSubmit, div1.firstChild);
is(idColor("19a"),"rgb(0,128,0)", "CSS dynamic-default 19a");
}
function dynamicDefault20() {
var newSubmit = document.createElement("input");
newSubmit.setAttribute("type", "image");
var div1 = document.getElementById("div20");
div1.insertBefore(newSubmit, div1.firstChild);
is(idColor("20a"),"rgb(0,128,0)", "CSS dynamic-default 20a");
}
addLoadEvent(dynamicDefault6);
addLoadEvent(dynamicDefault7);
addLoadEvent(dynamicDefault8);
addLoadEvent(dynamicDefault9);
addLoadEvent(dynamicDefault10);
addLoadEvent(dynamicDefault11);
addLoadEvent(dynamicDefault12);
addLoadEvent(dynamicDefault13);
addLoadEvent(dynamicDefault14);
addLoadEvent(dynamicDefault15);
addLoadEvent(dynamicDefault16);
addLoadEvent(dynamicDefault17);
addLoadEvent(dynamicDefault18);
addLoadEvent(dynamicDefault19);
addLoadEvent(dynamicDefault20);
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

View file

@ -1,61 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=308484
-->
<head>
<title>Test for Bug 308484</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=308484">Mozilla Bug 308484</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 308484 **/
var headers = ["Host", "Content-Length", "Transfer-Encoding", "Via", "Upgrade"];
var i, request;
// Try setting headers in unprivileged context
request = new XMLHttpRequest();
request.open("GET", window.location.href);
for (i = 0; i < headers.length; i++)
request.setRequestHeader(headers[i], "test" + i);
// Read out headers
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
var channel = request.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
for (i = 0; i < headers.length; i++) {
// Retrieving Content-Length will throw an exception
var value = null;
try {
value = channel.getRequestHeader(headers[i]);
}
catch(e) {}
isnot(value, "test" + i, "Setting " + headers[i] + " header in unprivileged context");
}
// Try setting headers in privileged context
request = new XMLHttpRequest();
request.open("GET", window.location.href);
for (i = 0; i < headers.length; i++)
request.setRequestHeader(headers[i], "test" + i);
// Read out headers
var channel = request.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
for (i = 0; i < headers.length; i++) {
var value = channel.getRequestHeader(headers[i]);
is(value, "test" + i, "Setting " + headers[i] + " header in privileged context");
}
</script>
</pre>
</body>
</html>

View file

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=308856
-->
<head>
<title>Test for Bug 308856</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=308856">Mozilla Bug 308856</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 308856 **/
var monkey = 12;
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
is(12,window.monkey,"Window global is correct value");
var found = false;
for (var p in window) {
if (p == "monkey") {
found = true;
}
}
ok(found, "Global js variables show up when enumerating [Window]");
});
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

View file

@ -1,100 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=311681
-->
<head>
<title>Test for Bug 311681</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=311681">Mozilla Bug 311681</a>
<script class="testbody" type="text/javascript">
// Setup script
SimpleTest.waitForExplicitFinish();
// Make sure to trigger the hashtable case by asking for enough elements
// by ID.
for (var i = 0; i < 256; ++i) {
var x = document.getElementById(i);
}
// save off the document.getElementById function, since getting it as a
// property off the document it causes a content flush.
var fun = document.getElementById;
// Slot for our initial element with id "content"
var testNode;
function getCont() {
return fun.call(document, "content");
}
function testClone() {
// Test to make sure that if we have multiple nodes with the same ID in
// a document we don't forget about one of them when the other is
// removed.
var newParent = $("display");
var node = testNode.cloneNode(true);
isnot(node, testNode, "Clone should be a different node");
newParent.appendChild(node);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 1");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 1");
clear(newParent);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 2");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 2");
node = testNode.cloneNode(true);
newParent.appendChild(node);
testNode.parentNode.removeChild(testNode);
// Check what getElementById returns, no flushing
is(getCont(), node, "Should be getting clone pre-flush");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), node, "Should be getting clone post-flush");
}
function clear(node) {
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
}
addLoadEvent(testClone);
addLoadEvent(SimpleTest.finish);
</script>
<p id="display"></p>
<div id="content" style="display: none">
<script class="testbody" type="text/javascript">
testNode = fun.call(document, "content");
isnot(testNode, null, "Should have node here");
</script>
</div>
<pre id="test">
</pre>
</body>
</html>

View file

@ -1,105 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=311681
-->
<head>
<title>Test for Bug 311681</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=311681">Mozilla Bug 311681</a>
<script class="testbody" type="text/javascript">
<![CDATA[
// Setup script
SimpleTest.waitForExplicitFinish();
// Make sure to trigger the hashtable case by asking for enough elements
// by ID.
for (var i = 0; i < 256; ++i) {
var x = document.getElementById(i);
}
// save off the document.getElementById function, since getting it as a
// property off the document it causes a content flush.
var fun = document.getElementById;
// Slot for our initial element with id "content"
var testNode;
function getCont() {
return fun.call(document, "content");
}
function testClone() {
// Test to make sure that if we have multiple nodes with the same ID in
// a document we don't forget about one of them when the other is
// removed.
var newParent = $("display");
var node = testNode.cloneNode(true);
isnot(node, testNode, "Clone should be a different node");
newParent.appendChild(node);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 1");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 1");
clear(newParent);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 2");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 2");
node = testNode.cloneNode(true);
newParent.appendChild(node);
testNode.parentNode.removeChild(testNode);
// Check what getElementById returns, no flushing
is(getCont(), node, "Should be getting clone pre-flush");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), node, "Should be getting clone post-flush");
}
function clear(node) {
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
}
// Actually run the test once the XML parser works incrementally
// addLoadEvent(testClone);
addLoadEvent(SimpleTest.finish);
]]>
</script>
<p id="display"></p>
<div id="content" style="display: none">
<script class="testbody" type="text/javascript">
<![CDATA[
testNode = fun.call(document, "content");
// Needs incremental XML parser
todo(testNode != null, "Should have node here");
]]>
</script>
</div>
<pre id="test">
</pre>
</body>
</html>

View file

@ -1,106 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=311681
-->
<head>
<title>Test for Bug 311681</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=311681">Mozilla Bug 311681</a>
<script class="testbody" type="text/javascript">
<![CDATA[
// Setup script
SimpleTest.waitForExplicitFinish();
// Make sure to trigger the hashtable case by asking for enough elements
// by ID.
for (var i = 0; i < 256; ++i) {
var x = document.getElementById(i);
}
// save off the document.getElementById function, since getting it as a
// property off the document it causes a content flush.
var fun = document.getElementById;
// Slot for our initial element with id "content"
var testNode;
function getCont() {
return fun.call(document, "content");
}
function testClone() {
// Test to make sure that if we have multiple nodes with the same ID in
// a document we don't forget about one of them when the other is
// removed.
var newParent = $("display");
var node = testNode.cloneNode(true);
isnot(node, testNode, "Clone should be a different node");
newParent.appendChild(node);
// Check what getElementById returns, no flushing
todo(getCont() == testNode, "Should be getting orig node pre-flush 1");
is(getCont(), node, "XML does it differently, for now");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
todo(getCont() == testNode, "Should be getting orig node post-flush 1");
is(getCont(), node, "XML does it differently, for now");
clear(newParent);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 2");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 2");
node = testNode.cloneNode(true);
newParent.appendChild(node);
testNode.parentNode.removeChild(testNode);
// Check what getElementById returns, no flushing
is(getCont(), node, "Should be getting clone pre-flush");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), node, "Should be getting clone post-flush");
}
function clear(node) {
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
}
addLoadEvent(testClone);
addLoadEvent(SimpleTest.finish);
]]>
</script>
<p id="display"></p>
<div id="content" style="display: none">
<script class="testbody" type="text/javascript">
<![CDATA[
testNode = fun.call(document, "content");
// Needs incremental XML parser
isnot(testNode, null, "Should have node here");
]]>
</script>
</div>
<pre id="test">
</pre>
</body>
</html>

View file

@ -1,108 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=311681
-->
<window title="Mozilla Bug 311681"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 311681</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=311681">Mozilla Bug 311681</a>
<script class="testbody" type="text/javascript">
<![CDATA[
// Setup script
SimpleTest.waitForExplicitFinish();
// Make sure to trigger the hashtable case by asking for enough elements
// by ID.
for (var i = 0; i < 256; ++i) {
var x = document.getElementById(i);
}
// save off the document.getElementById function, since getting it as a
// property off the document it causes a content flush.
var fun = document.getElementById;
// Slot for our initial element with id "content"
var testNode;
function getCont() {
return fun.call(document, "content");
}
function testClone() {
// Test to make sure that if we have multiple nodes with the same ID in
// a document we don't forget about one of them when the other is
// removed.
var newParent = $("display");
var node = testNode.cloneNode(true);
isnot(node, testNode, "Clone should be a different node");
newParent.appendChild(node);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 1");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 1");
clear(newParent);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 2");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 2");
node = testNode.cloneNode(true);
newParent.appendChild(node);
testNode.parentNode.removeChild(testNode);
// Check what getElementById returns, no flushing
is(getCont(), node, "Should be getting clone pre-flush");
// Trigger a layout flush, just in case.
var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), node, "Should be getting clone post-flush");
}
function clear(node) {
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
}
addLoadEvent(testClone);
addLoadEvent(SimpleTest.finish);
]]>
</script>
<p id="display"></p>
<div id="content" style="display: none">
<script class="testbody" type="text/javascript">
<![CDATA[
testNode = fun.call(document, "content");
// Needs incremental XML parser
isnot(testNode, null, "Should have node here");
]]>
</script>
</div>
<pre id="test">
</pre>
</body>
</window>

View file

@ -1,90 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=319381
-->
<head>
<title>Test for Bug 319381</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=319381">Mozilla Bug 319381</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="t"></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 319381 **/
function c() {
return document.defaultView.getComputedStyle($('t'), "").
getPropertyValue("overflow");
}
function cval() {
return document.defaultView.getComputedStyle($('t'), "").
getPropertyCSSValue("overflow");
}
var vals = ["visible", "hidden", "auto", "scroll"];
var mozVals = ["-moz-scrollbars-vertical", "-moz-scrollbars-horizontal"];
var i, j;
for (i = 0; i < vals.length; ++i) {
$('t').style.overflow = vals[i];
is($('t').style.overflow, vals[i], "Roundtrip");
is(c(), vals[i], "Simple property set");
isnot(cval(), null, "Simple property as CSSValue");
}
$('t').style.overflow = mozVals[0];
is($('t').style.getPropertyValue("overflow-y"), "scroll", "Roundtrip");
is($('t').style.getPropertyValue("overflow-x"), "hidden", "Roundtrip");
is($('t').style.overflow, "", "Shorthand read directly");
is(c(), "", "Shorthand computed");
is(cval(), null, "Shorthand as CSSValue");
$('t').style.overflow = mozVals[1];
is($('t').style.getPropertyValue("overflow-x"), "scroll", "Roundtrip");
is($('t').style.getPropertyValue("overflow-y"), "hidden", "Roundtrip");
is($('t').style.overflow, "", "Shorthand read directly");
is(c(), "", "Shorthand computed");
is(cval(), null, "Shorthand as CSSValue");
for (i = 0; i < vals.length; ++i) {
for (j = 0; j < vals.length; ++j) {
$('t').setAttribute("style",
"overflow-x: " + vals[i] + "; overflow-y: " + vals[j]);
is($('t').style.getPropertyValue("overflow-x"), vals[i], "Roundtrip");
is($('t').style.getPropertyValue("overflow-y"), vals[j], "Roundtrip");
if (i == j) {
is($('t').style.overflow, vals[i], "Shorthand serialization");
} else {
is($('t').style.overflow, "", "Shorthand serialization");
}
// "visible" overflow-x and overflow-y become "auto" in computed style if
// the other direction is not also "visible".
if (i == j || (vals[i] == "visible" && vals[j] == "auto")) {
is(c(), vals[j], "Shorthand computation");
isnot(cval(), null, "Shorthand computation as CSSValue");
} else if (vals[j] == "visible" && vals[i] == "auto") {
is(c(), vals[i], "Shorthand computation");
isnot(cval(), null, "Shorthand computation as CSSValue");
} else {
is(c(), "", "Shorthand computation");
is(cval(), null, "Shorthand computation as CSSValue");
}
}
}
</script>
</pre>
</body>
</html>

View file

@ -1,71 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=332848
-->
<head>
<title>Test for Bug 332848</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332848">Mozilla Bug 332848</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for Bug 332848 **/
// parseChecker will become true if we keep parsing after calling close().
var parseChecker = false;
function test() {
try {
document.open();
is(0, 1, "document.open succeeded");
} catch (e) {
is (e.code, DOMException.NOT_SUPPORTED_ERR,
"Wrong exception from document.open");
}
try {
document.write("aaa");
is(0, 1, "document.write succeeded");
} catch (e) {
is (e.code, DOMException.NOT_SUPPORTED_ERR,
"Wrong exception from document.write");
}
try {
document.close();
is(0, 1, "document.close succeeded");
} catch (e) {
is (e.code, DOMException.NOT_SUPPORTED_ERR,
"Wrong exception from document.close");
}
}
function loadTest() {
is(parseChecker, true, "Parsing stopped");
test();
SimpleTest.finish();
}
window.onload = loadTest;
SimpleTest.waitForExplicitFinish();
test();
]]>
</script>
<script>
parseChecker = true;
</script>
</pre>
</body>
</html>

View file

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=333983
-->
<head>
<title>Test for Bug 333983</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333983">Mozilla Bug 333983</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 333983 **/
HTMLElement.prototype.foopy = function () { return "foopy"; }
var foopy = "";
try {
foopy = document.body.foopy()
} catch (ex) {
foopy = ex + "";
}
is(foopy, "foopy", "HTMLElement.prototype functions work");
</script>
</pre>
</body>
</html>

View file

@ -1,34 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=3348
-->
<head>
<title>Test for Bug 3348</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=3348">Mozilla Bug 3348</a>
<p id="display"></p>
<div id="content" style="display: none">
<form id="form1">
<input type="button" value="click here" onclick="buttonClick();">
</form>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 3348 **/
var oForm = document.getElementById("form1");
is(oForm.tagName, "FORM", "tagName of HTML element gives tag in upper case");
</script>
</pre>
</body>
</html>

View file

@ -1,33 +0,0 @@
<html><head>
<title>Test for Bug 337124</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=337124">Mozilla Bug 337124</a>
<span style="display: table-row-group;">
<input type="text">
</span>
<div style="display: table-column-group;">
<script>document.body.offsetHeight;</script>
</div><span style="display: table-row-group;">
<input id="i1" type="text">
</span><fieldset id="f1" style="display: table-column-group;">
</fieldset>
</fieldset>
<pre id="test">
<script class="testbody" type="text/javascript">
var passed = false;
if ( document.getElementById("f1").offsetTop > document.getElementById("i1").offsetTop) {
passed = true;
}
ok(passed, "right layout order");
</script>
</pre>
</body>
</html>

View file

@ -1,100 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=337631
-->
<head>
<title>Test for Bug 337631</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=337631">Mozilla Bug 337631</a>
<p id="display"></p>
<div id="content">
<a href="foo" id="test4">foo</a>
<input id="test1" value="test">
<p id="test2">adsf<a href="#" id="test3">asdf</a><input id="test5"></p>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 337631 **/
function getActiveElement()
{
var rv;
var el = document.activeElement;
if (!el) {
rv = "none";
return rv;
}
if (el && el != document.documentElement) {
var nt;
try {
nt = el.nodeType;
} catch (e) {
rv = "[no permission]";
return rv;
}
if (!nt) {
rv = "[unknown]";
} else if (nt == 1) {
rv = el.tagName;
} else if (nt == 3) {
rv = "textnode"
} else {
rv = nt;
}
el = el.parentNode;
while (el && el != document.documentElement) {
rv += " in ";
try {
nt = el.nodeType;
} catch (e) {
rv += "[no permission]";
return rv;
}
if (!nt) {
rv += "[unknown]";
} else if (nt == 1) {
rv += el.tagName;
} else if (nt == 3) {
rv += "textnode"
} else {
rv += nt;
}
el = el.parentNode;
}
}
return rv;
}
$('test1').focus();
is(getActiveElement(), "INPUT in DIV in BODY", "getActiveElement tests");
$('test2').focus();
is(getActiveElement(), "INPUT in DIV in BODY", "getActiveElement tests");
$('test3').focus();
is(getActiveElement(), "A in P in DIV in BODY", "getActiveElement tests");
$('test4').focus();
is(getActiveElement(), "A in DIV in BODY", "getActiveElement tests");
$('test5').focus();
is(getActiveElement(), "INPUT in P in DIV in BODY", "getActiveElement tests");
</script>
</pre>
</body>
</html>

View file

@ -1,50 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=338541
-->
<head>
<title>Test for Bug 338541</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338541">Mozilla Bug 338541</a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 338541 **/
function getName(aNode, f)
{
return (aNode ? aNode.nodeName : "(null)");
}
function walkDOM()
{
var walker = document.createTreeWalker($('content'), Components.interfaces.nsIDOMNodeFilter.SHOW_ELEMENT, null, true);
var output = "";
while (walker.nextNode())
{
output += getName(walker.currentNode) + "\n";
}
output += "Final currentNode: " + getName(walker.currentNode);
is(output, "foo\nbar\nhtml:b\nqux\nbaz\nFinal currentNode: baz","treewalker returns correct nodeName");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(walkDOM, ok);
</script>
</pre>
<div id="content" style="display: none">
<foo xmlns="http://example.com">
<bar><html:b xmlns:html="http://www.w3.org/1999/xhtml"><qux/></html:b>
<baz/>
</bar>
</foo>
</div>
</body>
</html>

View file

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=338679
-->
<head>
<title>Testcase bug 338679</title>
<script type="text/javascript" src="../MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338679">Mozilla Bug 338679</a>
<div >
<dl>
<dt>Actual result:</dt>
<dd>
<pre id="out" style="width: 20em">
</pre>
</dd>
<dt>Expected result:</dt>
<dd>
<pre>
Previous: width: 20em;
New: width: auto;
</pre>
</dd>
</dl>
</div>
<pre id="test">
<script>
/* This is our event handler function */
function attr_modified(ev) {
$("out").textContent = "Previous:\t" + ev.prevValue + "\nNew:\t\t" + ev.newValue;
is(ev.newValue, "width: auto;", "DOMAttrModified event reports correct newValue");
todo(ev.prevValue == "width: 20em;", "DOMAttrModified event reports correct prevValue");
SimpleTest.finish(); // trigger the end of our test sequence
}
/* Call this to tell SimpleTest to wait for SimpleTest.finish() */
SimpleTest.waitForExplicitFinish();
$("out").addEventListener("DOMAttrModified", attr_modified, false);
$("out").style.width = "auto";
/* End of script, but SimpleTest will keep listening because
we called waitForExplicitFinish() */
</script>
</pre>
</body>
</html>

View file

@ -1,61 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Tests by Sam Ruby - WTFPL License (http://sam.zoy.org/wtfpl/)
http://www.intertwingly.net/blog/2006/10/03/Firefox-XHTML-innerHTML-quirk#comments
https://bugzilla.mozilla.org/show_bug.cgi?id=339350
-->
<head>
<!-- XHTML needs the packed version -->
<script type="text/javascript" src="../MochiKit/packed.js"/>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"/>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339350">Mozilla Bug 339350</a>
<div style="display: none">
<table border="1" cellspacing="0">
<thead>
<th></th>
<th>plain</th>
<th>brackets</th>
<th>braces</th>
</thead>
<tr>
<th>innerHTML</th>
<td><div id="i1"/></td>
<td style="background:yellow"><div id="i2"/></td>
<td><div id="i3"/></td>
</tr>
<tr>
<th>textNode</th>
<td><div id="t1"/></td>
<td><div id="t2"/></td>
<td><div id="t3"/></td>
</tr>
</table>
</div>
<pre id="test">
<script type="text/javascript">
var text1 = 'foo bar';
var text2 = 'foo [bar]';
var text3 = 'foo {bar}';
<!-- This is the long way to write this stuff,
you can use MochiKit functions too -->
document.getElementById('i1').innerHTML = text1;
document.getElementById('i2').innerHTML = text2;
document.getElementById('i3').innerHTML = text3;
document.getElementById('t1').appendChild(document.createTextNode(text1));
document.getElementById('t2').appendChild(document.createTextNode(text2));
document.getElementById('t3').appendChild(document.createTextNode(text3));
<!-- The is() function is one way to add a test -->
is(document.getElementById('i2').innerHTML, text2, "XHTML innerHTML with trailing brackets ']]'");
</script>
</pre>
</body>
</html>

View file

@ -1,62 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=339494
-->
<head>
<title>Test for Bug 339494</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="d"></div>
<div id="s"></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 339494 **/
var d = document.getElementById("d");
d.setAttribute("hhh", "testvalue");
document.addEventListener("DOMAttrModified", removeItAgain, false);
d.removeAttribute("hhh");
document.removeEventListener("DOMAttrModified", removeItAgain, false);
function removeItAgain()
{
ok(!d.hasAttribute("hhh"), "Value check 1",
"There should be no value");
isnot(d.getAttribute("hhh"), "testvalue", "Value check 2");
document.removeEventListener("DOMAttrModified", removeItAgain, false);
d.removeAttribute("hhh");
ok(true, "Reachability", "We shouldn't have crashed");
}
var s = document.getElementById("s");
s.setAttribute("ggg", "testvalue");
document.addEventListener("DOMAttrModified", compareVal, false);
s.setAttribute("ggg", "othervalue");
document.removeEventListener("DOMAttrModified", compareVal, false);
function compareVal()
{
ok(s.hasAttribute("ggg"), "Value check 3",
"There should be a value");
isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
is(s.getAttribute("ggg"), "othervalue", "Value check 5");
}
</script>
</pre>
</body>
</html>

View file

@ -1,61 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=339494
-->
<head>
<title>Test for Bug 339494</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="d" />
<div id="s" />
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 339494 **/
var d = document.getElementById("d");
d.setAttribute("hhh", "testvalue");
document.addEventListener("DOMAttrModified", removeItAgain, false);
d.removeAttribute("hhh");
document.removeEventListener("DOMAttrModified", removeItAgain, false);
function removeItAgain()
{
ok(!d.hasAttribute("hhh"), "Value check 1",
"There should be no value");
isnot(d.getAttribute("hhh"), "testvalue", "Value check 2");
document.removeEventListener("DOMAttrModified", removeItAgain, false);
d.removeAttribute("hhh");
ok(true, "Reachability", "We shouldn't have crashed");
}
var s = document.getElementById("s");
s.setAttribute("ggg", "testvalue");
document.addEventListener("DOMAttrModified", compareVal, false);
s.setAttribute("ggg", "othervalue");
document.removeEventListener("DOMAttrModified", compareVal, false);
function compareVal()
{
ok(s.hasAttribute("ggg"), "Value check 3",
"There should be a value");
isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
is(s.getAttribute("ggg"), "othervalue", "Value check 5");
}
</script>
</pre>
</body>
</html>

View file

@ -1,67 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=339494
-->
<window title="Mozilla Bug 339494"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 339494</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
<p id="display"></p>
<div id="content" style="display: none">
<xul:hbox id="d"/>
<xul:hbox id="s"/>
</div>
<pre id="test">
</pre>
</body>
<script class="testbody" type="application/javascript">
/** Test for Bug 339494 **/
var d = document.getElementById("d");
d.setAttribute("hhh", "testvalue");
document.addEventListener("DOMAttrModified", removeItAgain, false);
d.removeAttribute("hhh");
document.removeEventListener("DOMAttrModified", removeItAgain, false);
function removeItAgain()
{
ok(!d.hasAttribute("hhh"), "Value check 1",
"There should be no value");
isnot(d.getAttribute("hhh"), "testvalue", "Value check 2");
document.removeEventListener("DOMAttrModified", removeItAgain, false);
d.removeAttribute("hhh");
ok(true, "Reachability", "We shouldn't have crashed");
}
var s = document.getElementById("s");
s.setAttribute("ggg", "testvalue");
document.addEventListener("DOMAttrModified", compareVal, false);
s.setAttribute("ggg", "othervalue");
document.removeEventListener("DOMAttrModified", compareVal, false);
function compareVal()
{
ok(s.hasAttribute("ggg"), "Value check 3",
"There should be a value");
isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
is(s.getAttribute("ggg"), "othervalue", "Value check 5");
}
</script>
</window>

View file

@ -1,56 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=340800
-->
<head>
<title>Test for Bug 340800</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=340800">Mozilla Bug 340800</a>
<p id="display"></p>
<div id="content" style="display: none">
<h1>iframe text/plain as DOM test</h1>
<div>
<iframe name="iframe1" width="100%" height="200"
src="/static/bug340800_iframe.txt"></iframe>
</div>
<div>
<h2>textarea with iframe content</h2>
<textarea rows="10" cols="80" id="textarea1"></textarea>
</div>
<div>
<h2>div with white-space: pre and iframe content</h2>
<div id="div1"></div>
</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 340800 **/
function populateIframes () {
var iframe, iframeBody;
if ((iframe = window.frames.iframe1) && (iframeBody = iframe.document.body)) {
$('div1').innerHTML = iframeBody.innerHTML;
$('textarea1').value = iframeBody.innerHTML;
}
is($('div1').firstChild.tagName, "PRE", "innerHTML from txt iframe works with div");
ok($('textarea1').value.indexOf("<pre>") > -1, "innerHTML from txt iframe works with textarea.value");
SimpleTest.finish();
}
addLoadEvent(populateIframes);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

View file

@ -1,34 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=342448
-->
<head>
<title>Test for Bug 342448</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=342448">Mozilla Bug 342448</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 342448 **/
SimpleTest.waitForExplicitFinish();
try {
setTimeout(1, 0);
} catch (ex) {}
callLater(.1, function() { ok(true, "crash when passing a number as the first arg to setTimeout"); SimpleTest.finish(); })
</script>
</pre>
</body>
</html>

View file

@ -1,44 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=343596
-->
<head>
<title>Test for Bug 343596</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=343596">Mozilla Bug 343596</a>
<p id="display"></p>
<script id="foo"></script>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 343596 **/
SimpleTest.waitForExplicitFinish();
try{
// Insert text into an empty script node that will cause a syntax error.
document.getElementById("foo").appendChild(document.createTextNode("("));
}
catch(ex){
// Note that this catch block does not execute.
ok(false, "this catch block should not execute");
}
setTimeout(function(){ok(true,"setTimeout still executes after bogus script insertion"); SimpleTest.finish();}, 200);
</script>
</pre>
</body>
</html>

View file

@ -1,42 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=344830
-->
<head>
<title>Test for Bug 344830</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=344830">Mozilla Bug 344830</a>
<p id="display"></p>
<div id="content" style="display: block">
<embed name="svg1"
width="200" height="200"
type="image/svg+xml"
src="/static/bug344830_testembed.svg">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 344830 **/
function getSVG() {
var embed = document.embeds["svg1"];
var svgDocument = embed.getSVGDocument();
var element = svgDocument.getElementById("g1");
ok(embed, "document.embeds[] works with SVG");
ok(svgDocument, "document.embeds[] works with SVG and embed.getSVGDocument()");
ok(element, "document.embeds[] works with SVG and svgDocument.getElementById()");
SimpleTest.finish();
}
addLoadEvent(getSVG);
SimpleTest.waitForExplicitFinish()
</script>
</pre>
</body>
</html>

View file

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=344861
-->
<head>
<title>Test for Bug 344861</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=344861">Mozilla Bug 344861</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 344861 **/
SimpleTest.waitForExplicitFinish();
var newwindow = window.open("/", "testwindow", "width=200,height=200");
newwindow.onload = function() {
is(newwindow.innerHeight, 200, "window.open has correct height dimensions");
is(newwindow.innerWidth, 200, "window.open has correct width dimensions");
SimpleTest.finish();
newwindow.close();
}
</script>
</pre>
</body>
</html>

View file

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=345521
-->
<head>
<title>Test for Bug 345521</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=345521">Mozilla Bug 345521</a>
<p id="display"></p>
<div id="content" style="display: none">
<a id="testlink" onclick="return 0">test</a><br />
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 345521 **/
function hitlink() {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
var isOk = $("testlink").dispatchEvent(evt);
ok(isOk, "return 0 should not cancel an event");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(hitlink);
</script>
</pre>
</body>
</html>

View file

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=348497
-->
<head>
<title>Test for Bug 348497</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=348497">Mozilla Bug 348497</a>
<p id="display"></p>
<div id="content">
This page should not crash Mozilla<br>
<iframe id="testIframe"></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 348497 **/
function doe() {
document.getElementById('testIframe').style.display = 'block';
document.getElementById('testIframe').contentDocument.designMode = 'on';
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doe);
addLoadEvent(function() { ok(true, "enabling designmode on an iframe onload does not crash Mozilla")});
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

View file

@ -1,38 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=351601
-->
<head>
<title>Test for Bug 351601</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=351601">Mozilla Bug 351601</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 351601 **/
var foo;
var isOK = false;
try {
foo = navigator.buildID;
isOK = true;
} catch (ex) { /* do not do anything here, as we are checking result below. */ }
if (foo == "0000000000")
ok(isOK, "navigator.buildID should never throw");
else
ok(isOK, "navigator.buildID is not 0000000000, but we can confirm the normal case does not crash.");
</script>
</pre>
</body>
</html>

View file

@ -1,125 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=352728
-->
<head>
<title>Test for Bug 352728</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=352728">Mozilla Bug 352728</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 352728 **/
function checkTypes(aNode, aNodeType, aTypeArray)
{
for (var i = 0; i < aTypeArray.length; ++i) {
ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i,
aNodeType + " should be a " + aTypeArray[i]);
}
}
function checkInterfaces(aNode, aNodeType, aInterfaceArray)
{
for (var i = 0; i < aInterfaceArray.length; ++i) {
ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
aNodeType + " interface test " + i,
aNodeType + " should be a " + aInterfaceArray[i]);
}
}
function testCharacterData(aNode, aText)
{
is(aNode.length, aText.length, "Text length should match");
is(aNode.data, aText, "Text content should match");
is(aNode.nodeValue, aText, "Check nodeValue");
is(aNode.localName, null, "Check localName")
is(aNode.namespaceURI, null, "Check namespaceURI");
}
function testComment(aText, aShouldSucceed)
{
try {
var comment = document.createComment(aText);
var types = [ Comment, CharacterData, Node ];
checkTypes(comment, "comment", types);
var interfaces = [ "nsIDOMComment", "nsIDOMCharacterData", "nsIDOMNode",
"nsIDOM3Node", "nsIDOMEventTarget" ];
checkInterfaces(comment, "comment", interfaces);
testCharacterData(comment, aText);
is(comment.nodeName, "#comment", "Check nodeName");
is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType");
if (!aShouldSucceed) {
ok(0, "Invalid comment creation",
"Shouldn't create comment with embedded \"--\"");
}
} catch (e) {
if (aShouldSucceed) {
ok(0, "Correct functioning of comment stuff", "something broke: " + e);
} else {
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
}
}
}
function testCDATASection(aText, aShouldSucceed)
{
try {
var cdataSection = document.createCDATASection(aText);
ok(0, "Invalid CDATA section creation",
"Shouldn't create CDATA sections in HTML");
} catch (e) {
is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code");
}
}
function testPI(aTarget, aData, aShouldSucceed, aReason)
{
try {
var pi = document.createProcessingInstruction(aTarget, aData);
ok(0, "Invalid processing instruction creation",
"Shouldn't create processing instructions in HTML");
} catch (e) {
is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code");
}
}
testComment("Some text", true);
testComment("Some text with a '-' in it", true);
testComment("Some text with a '-' and a '-' and another '-'", true);
testComment("Some text -- this shouldn't create a node!", false);
testComment("<!-- This is an HTML comment -->", false);
testCDATASection("Some text", true);
testCDATASection("Some text with a '?' in it", true);
testCDATASection("Some text with a '>' in it", true);
testCDATASection("Some text with a '?' and a '>' in it", true);
testCDATASection("Some text with a '? >' in it", true);
testCDATASection("Some text -- ?> this should be ok", true);
testCDATASection("Some text ]]&gt; this should not create a node!", false);
testPI("foo", "bar", true);
testPI("foo:bar", "baz", true);
testPI("foo", "bar?", true);
testPI("foo", "bar>", true);
testPI("foo", "bar? >", true);
testPI("<aaa", "bar", false, "Target should not contain '<'");
testPI("aaa>", "bar", false, "Target should not contain '>'");
testPI("aa?", "bar", false, "Target should not contain '?'");
testPI("foo", "bar?>", false, "Data should not contain '?>'");
</script>
</pre>
</body>
</html>

View file

@ -1,195 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=352728
-->
<head>
<title>Test for Bug 352728</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=352728">Mozilla Bug 352728</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<!-- First make sure that a script consisting of multiple CDATA sections is
even supported -->
<script class="testbody" type="text/javascript">
var cdataTest1 = false;
var cdataTest2 = false;
var cdataTest3 = false;
</script>
<script class="testbody" type="text/javascript">
<![CDATA[
cdataTest1 = true;
]]>
cdataTest2 = true;
<![CDATA[
cdataTest3 = true;
]]>
</script>
<script class="testbody" type="text/javascript">
is(cdataTest1, true, "Check first CDATA section");
is(cdataTest2, true, "Check in between CDATA sections");
is(cdataTest3, true, "Check second CDATA section");
</script>
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for Bug 352728 **/
function checkTypes(aNode, aNodeType, aTypeArray)
{
for (var i = 0; i < aTypeArray.length; ++i) {
ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i,
aNodeType + " should be a " + aTypeArray[i]);
}
}
function checkInterfaces(aNode, aNodeType, aInterfaceArray)
{
for (var i = 0; i < aInterfaceArray.length; ++i) {
ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
aNodeType + " interface test " + i,
aNodeType + " should be a " + aInterfaceArray[i]);
}
}
function testCharacterData(aNode, aText)
{
is(aNode.length, aText.length, "Text length should match");
is(aNode.data, aText, "Text content should match");
is(aNode.nodeValue, aText, "Check nodeValue");
is(aNode.localName, null, "Check localName")
is(aNode.namespaceURI, null, "Check namespaceURI");
}
function testComment(aText, aShouldSucceed)
{
try {
var comment = document.createComment(aText);
var types = [ Comment, CharacterData, Node ];
checkTypes(comment, "comment", types);
var interfaces = [ "nsIDOMComment", "nsIDOMCharacterData", "nsIDOMNode",
"nsIDOM3Node", "nsIDOMEventTarget" ];
checkInterfaces(comment, "comment", interfaces);
testCharacterData(comment, aText);
is(comment.nodeName, "#comment", "Check nodeName");
is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType");
if (!aShouldSucceed) {
ok(0, "Invalid comment creation",
"Shouldn't create comment with embedded \"--\"");
}
} catch (e) {
if (aShouldSucceed) {
ok(0, "Correct functioning of comment stuff", "something broke: " + e);
} else {
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
}
}
}
function testCDATASection(aText, aShouldSucceed)
{
try {
var cdataSection = document.createCDATASection(aText);
var types = [ CDATASection, CharacterData, Node ];
checkTypes(cdataSection, "CDATA section", types);
var interfaces = [ "nsIDOMCDATASection", "nsIDOMCharacterData",
"nsIDOMNode", "nsIDOM3Node", "nsIDOMEventTarget" ];
checkInterfaces(cdataSection, "CDATA section", interfaces);
testCharacterData(cdataSection, aText);
is(cdataSection.nodeName, "#cdata-section", "Check nodeName");
is(cdataSection.nodeType, Node.CDATA_SECTION_NODE, "Check nodeType");
if (!aShouldSucceed) {
ok(0, "Invalid CDATA section creation",
]]>
"Shouldn't create CDATA section with embedded \"]]&gt;\"");
<![CDATA[
}
} catch (e) {
if (aShouldSucceed) {
ok(0, "Correct functioning of CDATA section stuff",
"something broke: " + e);
} else {
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
}
}
}
function testPI(aTarget, aData, aShouldSucceed, aReason)
{
try {
var pi = document.createProcessingInstruction(aTarget, aData);
var types = [ ProcessingInstruction, Node ];
checkTypes(pi, "processing instruction", types);
var interfaces = [ "nsIDOMProcessingInstruction", "nsIDOMNode",
"nsIDOM3Node", "nsIDOMEventTarget" ];
checkInterfaces(pi, "processing instruction", interfaces);
is(pi.target, aTarget, "Check target");
is(pi.data, aData, "Check data");
is(pi.nodeName, aTarget, "Check nodeName");
is(pi.nodeValue, aData, "Check nodeValue");
is(pi.localName, null, "Check localName")
is(pi.namespaceURI, null, "Check namespaceURI");
is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
if (!aShouldSucceed) {
ok(0, "Invalid processing instruction creation", aReason);
}
} catch (e) {
if (aShouldSucceed) {
ok(0, "Correct functioning of processing instruction stuff",
"something broke: " + e);
} else {
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
}
}
}
testComment("Some text", true);
testComment("Some text with a '-' in it", true);
testComment("Some text with a '-' and a '-' and another '-'", true);
testComment("Some text -- this shouldn't create a node!", false);
testComment("<!-- This is an HTML comment -->", false);
testCDATASection("Some text", true);
testCDATASection("Some text with a '?' in it", true);
testCDATASection("Some text with a '>' in it", true);
testCDATASection("Some text with a '?' and a '>' in it", true);
testCDATASection("Some text with a '? >' in it", true);
testCDATASection("Some text -- ?> this should be ok", true);
]]>
testCDATASection("Some text ]]&gt; this should not create a node!", false);
<![CDATA[
testPI("foo", "bar", true);
testPI("foo:bar", "baz", true);
testPI("foo", "bar?", true);
testPI("foo", "bar>", true);
testPI("foo", "bar? >", true);
testPI("<aaa", "bar", false, "Target should not contain '<'");
testPI("aaa>", "bar", false, "Target should not contain '>'");
testPI("aa?", "bar", false, "Target should not contain '?'");
testPI("foo", "bar?>", false, "Data should not contain '?>'");
]]>
</script>
</pre>
</body>
</html>

View file

@ -1,30 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Test from Adam Guthrie.
https://bugzilla.mozilla.org/show_bug.cgi?id=355026
-->
<head>
<script type="text/javascript" src="../MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=355026">Mozilla Bug 355026</a>
<div style="display: none" id="lengthtest">
</div>
<pre id="test">
<script type="text/javascript">
var foo = document.createElement("div");
foo.appendChild(document.createElement("div"));
var children = foo.getElementsByTagName("div");
is(children.length, 1, "After appending a child div to a div, div.length should be 1.");
</script>
</pre>
</body>
</html>

View file

@ -1,37 +0,0 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=357509
-->
<head>
<script type="text/javascript" src="../MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
<script>
function foo(elem) {
rng = document.createRange();
rng.setStartBefore(elem);
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=357509">Mozilla Bug 357509</a>
<div style="display: none" id="rangetest">
</div>
<pre id="test">
<script type="text/javascript">
var passed = false;
try {
foo(document.getElementById("rangetest"))
passed = true;
}
catch (e) {
passed = false;
}
<!-- The ok() function tests the first arg -->
ok(passed, "nsIDOMRange.setStartBefore");
</script>
</pre>
</body>
</html>

View file

@ -1,38 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=358660
-->
<head>
<title>Test for Bug 358660</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=358660">Mozilla Bug 358660</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="testframe"
src="data:text/html,<html><body>Some text</body></html>"></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 358660 **/
SimpleTest.waitForExplicitFinish();
window.onload = function() {
var doc = $("testframe").contentDocument;
var range = doc.createRange();
range.selectNode(doc.documentElement);
is(range.toString(), "Some text", "Check text");
SimpleTest.finish()
}
</script>
</pre>
</body>
</html>

View file

@ -1,39 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=358797
-->
<head>
<title>Test for Bug 358797</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=358797">Mozilla Bug 358797</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 358797 **/
var isOK = false;
try {
var range;
range = document.createRange();
range.selectNode(document.firstChild);
range.createContextualFragment('<span></span>');
}
catch (ex) {
isOK = true;
}
ok(isOK, "range.createContextualFragment() should throw when range node is " +
"DocType");
</script>
</pre>
</body>
</html>

View file

@ -1,38 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=359657
-->
<head>
<title>Test for Bug 359657</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=359657">Mozilla Bug 359657</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 359657 **/
function runTest() {
var span = document.createElement("span");
$("test").insertBefore(span, $("test").firstChild);
ok(true, "Reachability", "We should get here without crashing");
is($("test").firstChild, span, "First child is correct");
}
</script>
<div>
<iframe src=""></iframe>
<!-- Important: This test needs to run async at this point. The actual test
is not crashing while running this test! -->
<script type="text/javascript" src="data:text/javascript,runTest()"></script>
</div>
</pre>
</body>
</html>

View file

@ -1,72 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=359754
-->
<window title="Mozilla Bug 359754"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=359754">Mozilla Bug 359754</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
</body>
<description>
Displays a numberbox which ranges from 5 to 10.
</description>
<textbox id="foo" type="number" min="5" max="10"/>
<script class="testbody" type="application/javascript">
function hitIt() {
sendKey("up", "foo");
}
SimpleTest.waitForExplicitFinish();
/** Test for Bug 359754 **/
setTimeout('document.getElementById("foo").focus()', 0);
addLoadEvent(function() {
// pay attention to our key events
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
hitIt();
is($("foo").value, "6", "value is now 6");
hitIt();
is($("foo").value, "7", "value is now 7");
hitIt();
is($("foo").value, "8", "value is now 8");
hitIt();
is($("foo").value, "9", "value is now 9");
// now try to hit it past max
hitIt();
is($("foo").value, "10", "value is now 10");
hitIt();
is($("foo").value, "10", "value is now 10");
hitIt();
is($("foo").value, "10", "value is now 10");
});
addLoadEvent(SimpleTest.finish);
</script>
</window>

View file

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=360220
-->
<window title="Mozilla Bug 360220"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 360220</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=360220">Mozilla Bug 360220</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<menulist id="menulist">
<menupopup>
<menuitem id="firstItem" label="foo" selected="true"/>
<menuitem id="secondItem" label="bar"/>
</menupopup>
</menulist>
<script class="testbody" type="application/javascript">
<![CDATA[
/** Test for Bug 360220 **/
var menulist = document.getElementById("menulist");
var secondItem = document.getElementById("secondItem");
menulist.selectedItem = secondItem;
ok(menulist.label == "bar", "second item was not selected");
secondItem.label = "new label";
ok(menulist.label == "new label", "menulist label was not updated to the label of its selected item");
]]>
</script>
</window>

View file

@ -1,75 +0,0 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:foobar="http://www.foobar.com">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=362391
-->
<head>
<title>Test for Bug 362391</title>
<!-- XHTML needs explicit script elements -->
<script type="text/javascript" src="../MochiKit/Base.js"></script>
<script type="text/javascript" src="../MochiKit/Iter.js"></script>
<script type="text/javascript" src="../MochiKit/DOM.js"></script>
<script type="text/javascript" src="../MochiKit/Style.js"></script>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=362391">Mozilla Bug 362391</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test1"/>
<div id="test2"/>
<div id="test3" attr="null"/>
<div id="test4" foobar:attr="http://www.foobar.com"/>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 362391 **/
var currentTest = 0;
var expected = "";
function listener(evt) {
var r = document.getElementById("result");
++currentTest;
ok(((evt.relatedNode.namespaceURI + "") == expected),
evt.relatedNode.namespaceURI + " == "+ expected);
}
document.addEventListener("DOMAttrModified", listener, true);
function test() {
expected = "null";
document.getElementById("test1")
.setAttribute("attr", "null");
expected = "http://www.foobar.com";
document.getElementById("test2")
.setAttributeNS("http://www.foobar.com", "attr", "http://www.foobar.com");
expected = "http://www.foobar.com";
document.getElementById("test3")
.setAttributeNS("http://www.foobar.com", "attr", "http://www.foobar.com");
expected = "null";
document.getElementById("test4")
.setAttribute("attr", "null");
expected = "http://www.foobar.com";
document.getElementById("test3")
.removeAttributeNS("http://www.foobar.com", "attr");
expected = "null";
document.getElementById("test4")
.removeAttribute("attr");
}
test();
</script>
</pre>
</body>
</html>

View file

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=364092
-->
<head>
<title>Test for Bug 364092</title>
<!-- XHTML needs explicit script elements -->
<script type="text/javascript" src="../MochiKit/Base.js"></script>
<script type="text/javascript" src="../MochiKit/Iter.js"></script>
<script type="text/javascript" src="../MochiKit/DOM.js"></script>
<script type="text/javascript" src="../MochiKit/Style.js"></script>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=364092">Mozilla Bug 364092</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test1" foo="foo"/>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 364092 **/
var test1 = document.getElementById("test1");
var attrNode = test1.getAttributeNode("foo");
function mutationHandler(aEvent) {
ok(attrNode.isSameNode(aEvent.relatedNode));
ok(!test1.hasAttribute("foo"));
}
function runTest() {
test1.addEventListener("DOMAttrModified", mutationHandler, true);
test1.removeAttributeNode(attrNode);
test1.removeEventListener("DOMAttrModified", mutationHandler, true);
}
runTest();
</script>
</pre>
</body>
</html>

View file

@ -1,48 +0,0 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:foobar="http://www.foobar.com">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=364413
-->
<head>
<title>Test for Bug 364413</title>
<!-- XHTML needs explicit script elements -->
<script type="text/javascript" src="../MochiKit/Base.js"></script>
<script type="text/javascript" src="../MochiKit/Iter.js"></script>
<script type="text/javascript" src="../MochiKit/DOM.js"></script>
<script type="text/javascript" src="../MochiKit/Style.js"></script>
<script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=364413">Mozilla Bug 364413</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test1" foobar:foo="foo"/>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 364413 **/
var test1 = document.getElementById("test1");
var attrNode = test1.getAttributeNodeNS("http://www.foobar.com", "foo");
function mutationHandler(aEvent) {
ok(attrNode.isSameNode(aEvent.relatedNode));
ok(aEvent.target == attrNode.ownerElement);
}
function runTest() {
test1.removeAttributeNode(attrNode);
test1.addEventListener("DOMAttrModified", mutationHandler, true);
test1.setAttributeNodeNS(attrNode);
test1.removeEventListener("DOMAttrModified", mutationHandler, true);
}
runTest();
</script>
</pre>
</body>
</html>

View file

@ -1,70 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=365773
-->
<window title="Mozilla Bug 365773"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 365773</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=365773">Mozilla Bug 365773</a>
<p id="display">
<radiogroup id="group" collapsed="true" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<radio id="item" label="Item"/>
</radiogroup>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<script class="testbody" type="application/javascript">
<![CDATA[
/** Test for Bug 365773 **/
function selectItem(item, isIndex, testName) {
var exception = null;
try {
if (isIndex)
document.getElementById("group").selectedIndex = item;
else
document.getElementById("group").selectedItem = item;
}
catch(e) {
exception = e;
}
ok(exception == null, testName);
}
SimpleTest.waitForExplicitFinish();
window.onload = function runTests() {
var item = document.getElementById("item");
selectItem(item, false, "Radio button selected with selectedItem (not focused)");
selectItem(null, false, "Radio button deselected with selectedItem (not focused)");
selectItem(0, true, "Radio button selected with selectedIndex (not focused)");
selectItem(-1, true, "Radio button deselected with selectedIndex (not focused)");
document.getElementById("group").focus();
selectItem(item, false, "Radio button selected with selectedItem (focused)");
selectItem(null, false, "Radio button deselected with selectedItem (focused)");
selectItem(0, true, "Radio button selected with selectedIndex (focused)");
selectItem(-1, true, "Radio button deselected with selectedIndex (focused)");
SimpleTest.finish();
};
]]>
</script>
</window>

View file

@ -1,48 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=367164
-->
<head>
<title>Test for Bug 367164</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=367164">Mozilla Bug 367164</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 367164 **/
var span = document.createElement("span");
var ins1 = false;
var ins2 = false;
var rem1 = false;
var rem2 = false;
span.addEventListener("DOMNodeInserted", function() { ins1 = true; }, true);
span.addEventListener("DOMNodeInserted", function() { ins2 = true; }, false);
span.addEventListener("DOMNodeRemoved", function() { rem1 = true; }, true);
span.addEventListener("DOMNodeRemoved", function() { rem2 = true; }, false);
$("content").appendChild(span);
$("content").removeChild(span);
is(ins1, true, "Capturing DOMNodeInserted listener");
is(ins2, true, "Bubbling DOMNodeInserted listener");
is(rem1, true, "Capturing DOMNodeRemoved listener");
is(rem2, true, "Bubbling DOMNodeRemoved listener");
</script>
</pre>
</body>
</html>

View file

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=51034
-->
<head>
<title>Test for Bug 51034</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=51034">Mozilla Bug 51034</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="divElement">
<span>Subelement1</span>
<span>Subelement2</span>
<span>Subelement3</span>
</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 51034 **/
var x = document.getElementById('divElement');
isOK = false;
try {
x.getElementsByTagName('span');
isOK = true;
} catch (ex) {
isOK = false;
}
ok(isOK, "getElementsByTagName() doesn't cause exception");
</script>
</pre>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=5141
-->
<head>
<title>Test for Bug 5141</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=5141">Mozilla Bug 5141</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 5141 **/
var baz = document.createElement('img');
ok(baz.parentNode === null, "Node.parentNode should be null for standalone nodes");
</script>
</pre>
</body>
</html>

View file

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=589
-->
<head>
<title>Test for Bug 589</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
.letters {list-style-type: upper-alpha;}
.numbers {list-style-type: decimal;}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589">Mozilla Bug 589</a>
<p id="display"></p>
<div id="content" >
<OL id="thelist" class="letters">
<LI id="liA">This list should feature...
<LI id="liB">...letters for each item...
<LI id="li3" class="numbers">...except this one.
</OL>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 589 **/
is(computedStyle($("liA"),"list-style-type"),"upper-alpha");
is(computedStyle($("liB"),"list-style-type"),"upper-alpha");
is(computedStyle($("li3"),"list-style-type"),"decimal");
</script>
</pre>
</body>
</html>

View file

@ -1,32 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=6296
-->
<head>
<title>Test for Bug 6296</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=6296">Mozilla Bug 6296</a>
<p id="display"></p>
<div id="content" style="display: none">
<A HREF="../testdata/test.gif" id="foo" NAME="anchor1" ALT="this is a test of the image
attribute">Hi</A>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 6296 **/
is($("foo").name, "anchor1", "accessing an anchor name should work, and not crash either!")
</script>
</pre>
</body>
</html>

View file

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=691
-->
<head>
<title>Test for Bug 691</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
function show(what) {
var stage = document.getElementById("stage");
if (what == "modularity") {
var spaghetti = document.createElement("IMG",null);
spaghetti.setAttribute("SRC","/static/nnc_lockup.gif");
spaghetti.setAttribute("id","foo");
stage.insertBefore(spaghetti,stage.firstChild);
}
}
function remove() {
var stage = document.getElementById("stage");
var body = document.getElementsByTagName("BODY")[0];
while (stage.firstChild) {
stage.removeChild(stage.firstChild);
}
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691">Mozilla Bug 691</a>
<p id="display"></p>
<div id="content" >
<ul>
<li >foo</li>
</ul>
<div id="stage">
</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 691 **/
show("modularity");
remove();
show("modularity");
remove();
show("modularity");
remove();
show("modularity");
ok($("foo"), "basic DOM manipulation doesn't crash");
</script>
</pre>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=694
-->
<head>
<title>Test for Bug 694</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=694">Mozilla Bug 694</a>
<p id="display"></p>
<div id="content" >
<img src="/missing_on_purpose" width=123 height=25 alt="Hello, &quot;Quotes&quot; how are you?" id="testimg">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 694 **/
is($("testimg").getAttribute("alt"), "Hello, \"Quotes\" how are you?", "entities in alt attribute works");
</script>
</pre>
</body>
</html>

View file

@ -1,29 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696
-->
<head>
<title>Test for Bug 696</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696">Mozilla Bug 696</a>
<p id="display"></p>
<div id="content" style="display: none">
<table><tr id="mytr"><td>Foo</td><td>Bar</td></tr></table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 696 **/
var mytr = $("content").getElementsByTagName("TR")[0];
is(mytr.getAttribute("ID"),"mytr","TR tags expose their ID attribute");
</script>
</pre>
</body>
</html>