Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<!--
-->
<head>
<title>Test for Bug 411103</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content">
<marquee id="a" style="border: 1px solid black;">marquee</marquee>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/* The todos are cases where IE/Edge is throwing errors, but
for Mozilla it was decided to not do that for now */
var x=document.getElementById('a');
SimpleTest.waitForExplicitFinish();
setTimeout(function() {
is(x.behavior, "scroll", "Wrong behavior value");
x.setAttribute('behavior', 'alternate');
is(x.behavior, "alternate", "Wrong behavior value");
x.setAttribute('behavior', 'invalid');
is(x.behavior, "scroll", "Wrong behavior value");;
x.setAttribute('behavior', 'Scroll');
is(x.behavior, "scroll", "Wrong behavior value");
x.setAttribute('behavior', 'Slide');
is(x.behavior, "slide", "Wrong behavior value");
x.setAttribute('behavior', '');
is(x.behavior, "scroll", "Wrong behavior value");
x.setAttribute('behavior', 'slide');
x.removeAttribute('behavior');
is(x.behavior, "scroll", "Wrong behavior value");
is(x.getAttribute('behavior'), null, "Wrong behavior attribute");
x.behavior = 'alternate';
is(x.behavior, "alternate", "Wrong behavior value");
x.behavior = 'invalid';
is(x.behavior, "scroll", "Wrong behavior value");
is(x.getAttribute('behavior'), "invalid", "Wrong behavior attribute");
x.behavior = 'Slide';
is(x.behavior, "slide", "Wrong behavior value");
is(x.getAttribute('behavior'), "Slide", "Wrong behavior attribute");
x.behavior = 'invalid';
is(x.behavior, "scroll", "Wrong behavior value");
x.behavior = null;
is(x.behavior, "scroll", "Wrong behavior value");
x.behavior = undefined;
is(x.behavior, "scroll", "Wrong behavior value");
is(x.getAttribute('behavior'), 'undefined', "Wrong behavior attribute");
// This doesn't work in Mozilla due to chrome XBL security issues
x.behavior = { toString: function _toString() { return "scroll"} }
is(x.behavior, x.getAttribute('behavior'), "Wrong behavior value");
x.behavior = 'scroll';
is(x.behavior, "scroll", "Wrong behavior value");
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '1');
is(x.loop, 1, "Wrong loop value");
x.setAttribute('loop', 'invalid');
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '');
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '0');
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '1000');
is(x.loop, 1000, "Wrong loop value");
x.setAttribute('loop', '-0.123');
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '-1.123');
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '-1');
is(x.loop, -1, "Wrong loop value");
x.setAttribute('loop', '1000');
is(x.loop, 1000, "Wrong loop value");
x.removeAttribute('loop');
is(x.loop, -1, "Wrong loop value");
is(x.getAttribute('loop'), null, "Wrong loop attribute");
x.loop = 1;
is(x.loop, 1, "Wrong loop value");
is(x.getAttribute('loop'), "1", "Wrong loop attribute");
try {
x.loop = -2;
todo_is(false, true, "marquee.loop = -2 should throw");
} catch(e) {
ok(true, "Exception was raised");
}
is(x.loop, 1, "Wrong loop value");
is(x.getAttribute('loop'), "1", "Wrong loop attribute");
try {
x.loop = 'invalid';
todo_is(false, true, ".loop = 'invalid' should throw");
} catch(e) {
ok(true, "Exception was raised");
}
is(x.loop, 1, "Wrong loop value");
is(x.getAttribute('loop'), "1", "Wrong loop attribute");
try {
x.loop = null;
todo_is(false, true, "marquee.loop = null should throw");
} catch(e) {
ok(true, "Exception was raised");
}
is(x.loop, 1, "Wrong loop value");
is(x.getAttribute('loop'), "1", "Wrong loop attribute");
x.loop = -1;
is(x.loop, -1, "Wrong loop value");
is(x.getAttribute('loop'), "-1", "Wrong loop attribute");
x.loop = '100';
is(x.loop, 100, "Wrong loop value");
is(x.getAttribute('loop'), "100", "Wrong loop attribute");
try {
x.loop = -0.123;
todo_is(false, true, "marquee.loop = -0.123 should throw");
} catch(e) {
ok(true, "Exception was raised");
}
is(x.loop, 100, "Wrong loop value");
is(x.getAttribute('loop'), "100", "Wrong loop attribute");
try {
x.loop = 0;
todo_is(false, true, "marquee.loop = 0 should throw");
} catch(e) {
ok(true, "Exception was raised");
}
is(x.loop, 100, "Wrong loop value");
is(x.getAttribute('loop'), "100", "Wrong loop attribute");
x.loop = -1.123;
is(x.loop, -1, "Wrong loop value");
is(x.getAttribute('loop'), "-1", "Wrong loop attribute");
is(x.scrollAmount, 6, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', '1');
is(x.scrollAmount, 1, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', 'invalid');
is(x.scrollAmount, 6, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', '1000');
is(x.scrollAmount, 1000, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', '-1');
is(x.scrollAmount, 6, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', '999');
is(x.scrollAmount, 999, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', '');
is(x.scrollAmount, 6, "Wrong scrollAmount value");
x.setAttribute('scrollAmount', '999');
x.removeAttribute('scrollAmount');
is(x.scrollAmount, 6, "Wrong scrollAmount value");
is(x.getAttribute('scrollamount'), null, "Wrong scrollamount attribute");
x.scrollAmount = 1;
is(x.scrollAmount, 1, "Wrong scrollAmount value");
is(x.getAttribute('scrollamount'), "1", "Wrong scrollamount attribute");
x.scrollAmount = -2;
is(x.scrollAmount, 6, "Wrong scrollAmount value");
is(x.getAttribute('scrollamount'), "6", "Wrong scrollamount attribute");
x.scrollAmount = 'invalid';
is(x.scrollAmount, 0, "Wrong scrollAmount value");
is(x.getAttribute('scrollamount'), "0", "Wrong scrollamount attribute");
x.scrollAmount = 1;
x.scrollAmount = null;
is(x.scrollAmount, 0, "Wrong scrollAmount value");
is(x.getAttribute('scrollamount'), "0", "Wrong scrollamount attribute");
x.scrollAmount = '2';
is(x.scrollAmount, 2, "Wrong scrollAmount value");
is(x.getAttribute('scrollamount'), "2", "Wrong scrollamount attribute");
is(x.scrollDelay, 85, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '1');
is(x.scrollDelay, 1, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', 'invalid');
is(x.scrollDelay, 85, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '70');
is(x.scrollDelay, 70, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '59');
is(x.scrollDelay, 59, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '1000');
is(x.scrollDelay, 1000, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '-1');
is(x.scrollDelay, 85, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '');
is(x.scrollDelay, 85, "Wrong scrollDelay value");
x.setAttribute('scrollDelay', '1000');
x.removeAttribute('scrollDelay');
is(x.scrollDelay, 85, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), null, "Wrong scrolldelay attribute");
x.scrollDelay = 100;
is(x.scrollDelay, 100, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute");
x.scrollDelay = -2;
is(x.scrollDelay, 85, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), "85", "Wrong scrolldelay attribute");
x.scrollDelay = 'invalid';
is(x.scrollDelay, 0, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), "0", "Wrong scrolldelay attribute");
x.scrollDelay = null;
is(x.scrollDelay, 0, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), "0", "Wrong scrolldelay attribute");
x.scrollDelay = -1;
is(x.scrollDelay, 85, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), "85", "Wrong scrolldelay attribute");
x.scrollDelay = '50';
is(x.scrollDelay, 50, "Wrong scrollDelay value");
is(x.getAttribute('scrolldelay'), "50", "Wrong scrolldelay attribute");
is(x.trueSpeed, false, "Wrong trueSpeed value");
x.setAttribute('trueSpeed', '1');
is(x.trueSpeed, true, "Wrong trueSpeed value");
x.setAttribute('trueSpeed', 'false');
is(x.trueSpeed, true, "Wrong trueSpeed value");
x.setAttribute('trueSpeed', '');
is(x.trueSpeed, true, "Wrong trueSpeed value");
x.removeAttribute('trueSpeed');
is(x.trueSpeed, false, "Wrong trueSpeed value");
is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute");
x.trueSpeed = 1;
is(x.trueSpeed, true, "Wrong trueSpeed value");
is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
x.trueSpeed = -2;
is(x.trueSpeed, true, "Wrong trueSpeed value");
is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
x.trueSpeed = null;
is(x.trueSpeed, false, "Wrong trueSpeed value");
is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute");
x.trueSpeed = '100';
is(x.trueSpeed, true, "Wrong trueSpeed value");
is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
is(x.direction, "left", "Wrong direction value");
x.setAttribute('direction', 'right');
is(x.direction, "right", "Wrong direction value");
x.setAttribute('direction', 'invalid');
is(x.direction, "left", "Wrong direction value");
x.setAttribute('direction', 'RIGHT');
is(x.direction, "right", "Wrong direction value");
x.setAttribute('direction', '');
is(x.direction, "left", "Wrong direction value");
x.setAttribute('direction', 'right');
x.removeAttribute('direction');
is(x.direction, "left", "Wrong direction value");
is(x.getAttribute('direction'), null, "Wrong direction attribute");
x.setAttribute('direction', 'up');
is(x.direction, "up", "Wrong direction value");
x.setAttribute('direction', 'down');
is(x.direction, "down", "Wrong direction value");
x.removeAttribute('direction');
is(x.direction, "left", "Wrong direction value");
is(x.getAttribute('direction'), null, "Wrong direction attribute");
x.direction = 'right';
is(x.direction, "right", "Wrong direction value");
is(x.getAttribute('direction'), "right", "Wrong direction attribute");
x.direction = 'up';
is(x.direction, "up", "Wrong direction value");
is(x.getAttribute('direction'), "up", "Wrong direction attribute");
x.direction = 'down';
is(x.direction, "down", "Wrong direction value");
is(x.getAttribute('direction'), "down", "Wrong direction attribute");
x.direction = 1;
is(x.direction, "left", "Wrong direction value");
is(x.getAttribute('direction'), "1", "Wrong direction attribute");
x.direction = null;
is(x.direction, "left", "Wrong direction value");
is(x.getAttribute('direction'), "null", "Wrong direction attribute");
// This doesn't work in Mozilla due to chrome XBL security issues
x.direction = { toString: function _toString() { return "right"} }
is(x.direction, x.getAttribute('direction'), "Wrong direction value");
x.direction = 'left';
is(x.direction, "left", "Wrong direction value");
SimpleTest.finish();
}, 0);
</script>
</pre>
</body>
</html>