Blame dom/base/test/test_bug433533.html

Packit f0b94e
Packit f0b94e
<html>
Packit f0b94e
Packit f0b94e
https://bugzilla.mozilla.org/show_bug.cgi?id=433533
Packit f0b94e
-->
Packit f0b94e
<head>
Packit f0b94e
  <title>Test for Bug 433533</title>
Packit f0b94e
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
Packit f0b94e
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
Packit f0b94e
</head>
Packit f0b94e
<body>
Packit f0b94e
Mozilla Bug 433533
Packit f0b94e

Packit f0b94e
Packit f0b94e
  
Packit f0b94e
Packit f0b94e
Packit f0b94e
<script class="testbody" type="text/javascript">
Packit f0b94e
Packit f0b94e
/** Test for Bug 433533 **/
Packit f0b94e
Packit f0b94e
var input = document.createElement("input");
Packit f0b94e
input.setAttribute("type", "hidden");
Packit f0b94e
is(input.getAttribute("type"), "hidden", "Setting type attribute didn't work!");
Packit f0b94e
input.setAttribute("type", "hiDDen");
Packit f0b94e
is(input.getAttribute("type"), "hiDDen", "Type attribute didn't store the original value");
Packit f0b94e
is(input.type, "hidden", "Wrong input.type!");
Packit f0b94e
input.setAttribute("type", "HIDDEN");
Packit f0b94e
is(input.getAttribute("type"), "HIDDEN", "Type attribute didn't store the original value");
Packit f0b94e
is(input.type, "hidden", "Wrong input.type!");
Packit f0b94e
Packit f0b94e
var td = document.createElement("td");
Packit f0b94e
td.setAttribute("scope", "rOW");
Packit f0b94e
is(td.getAttribute("scope"), "rOW", "Scope attribute didn't store the original value");
Packit f0b94e
td.setAttribute("scope", "row");
Packit f0b94e
is(td.getAttribute("scope"), "row", "Scope attribute didn't store the original value");
Packit f0b94e
td.setAttribute("colspan", "100k");
Packit f0b94e
is(td.getAttribute("colspan"), "100k", "Colspan attribute didn't store the original value");
Packit f0b94e
td.setAttribute("colspan", " 100 ");
Packit f0b94e
is(td.getAttribute("colspan"), " 100 ", "Colspan attribute didn't store the original value");
Packit f0b94e
td.setAttribute("colspan", "100");
Packit f0b94e
is(td.getAttribute("colspan"), "100", "Colspan attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
// Note, if colspan is negative, it is set to 1, because of backwards compatibility.
Packit f0b94e
// @see nsHTMLTableCellElement::ParseAttribute
Packit f0b94e
td.setAttribute("colspan", "-100k");
Packit f0b94e
is(td.getAttribute("colspan"), "-100k", "Colspan attribute didn't store the original value");
Packit f0b94e
td.setAttribute("colspan", " -100 ");
Packit f0b94e
is(td.getAttribute("colspan"), " -100 ", "Colspan attribute didn't store the original value");
Packit f0b94e
is(td.colSpan, 1, "Colspan reflection should be correct for ' -100 '");
Packit f0b94e
td.setAttribute("colspan", "-100");
Packit f0b94e
is(td.getAttribute("colspan"), "-100", "Colspan attribute didn't store the original value");
Packit f0b94e
is(td.colSpan, 1, "Colspan reflection should be correct for '-100'");
Packit f0b94e
Packit f0b94e
Packit f0b94e
td.setAttribute("colspan", "foobar");
Packit f0b94e
is(td.getAttribute("colspan"), "foobar", "Colspan attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
var iframe = document.createElement("iframe");
Packit f0b94e
iframe.setAttribute("marginwidth", "50%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "50%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "50");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "50",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "0");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "0",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "0%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "0%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "9999999999999999999999");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "9999999999999999999999",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "9999999999999999999999%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "9999999999999999999999%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "-9999999999999999999999");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-9999999999999999999999",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-9999999999999999999999%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-9999999999999999999999%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
   
Packit f0b94e
// Test PRInt32 min/max value
Packit f0b94e
iframe.setAttribute("marginwidth", "2147483647");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "2147483647",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "2147483647%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "2147483647%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "-2147483648");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-2147483648",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-2147483648%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-2147483648%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "2147483646");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "2147483646",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "2147483647%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "2147483647%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "-2147483647");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-2147483647",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-2147483647%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-2147483647%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "2147483648");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "2147483648",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "2147483648%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "2147483648%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "-2147483649");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-2147483649",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-2147483649%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-2147483649%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
// some values 0 > x > NS_ATTRVALUE_INTEGERTYPE_MAXVALUE
Packit f0b94e
iframe.setAttribute("marginwidth", "134217726");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217726",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "134217727");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217727",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "134217728");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217728",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "134217729");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217729",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "134217726%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217726%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "134217727%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217727%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "134217728%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217728%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "134217729%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "134217729%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
// some values 0 < x < NS_ATTRVALUE_INTEGERTYPE_MINVALUE
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217727");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217727",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217728");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217728",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217729");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217729",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217730");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217730",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217727%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217727%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217728%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217728%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217729%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217729%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-134217730%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-134217730%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
iframe.setAttribute("marginwidth", "-0");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-0",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-0%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-0%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");   
Packit f0b94e
iframe.setAttribute("marginwidth", " 0 ");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), " 0 ",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", " 0% ");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), " 0% ",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-50%");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-50%",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "-50");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "-50",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", " -50% ");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), " -50% ",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", " -50 ");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), " -50 ",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
iframe.setAttribute("marginwidth", "foobar");
Packit f0b94e
is(iframe.getAttribute("marginwidth"), "foobar",
Packit f0b94e
   "Marginwidth attribute didn't store the original value");
Packit f0b94e
Packit f0b94e
var bd = document.createElement("body");
Packit f0b94e
bd.setAttribute("bgcolor", "red");
Packit f0b94e
is(bd.getAttribute("bgcolor"), "red", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "red", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.setAttribute("bgcolor", "  red  ");
Packit f0b94e
is(bd.getAttribute("bgcolor"), "  red  ", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "  red  ", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.setAttribute("bgcolor", "#ff0000");
Packit f0b94e
is(bd.getAttribute("bgcolor"), "#ff0000", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "#ff0000", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.setAttribute("bgcolor", "#f00");
Packit f0b94e
is(bd.getAttribute("bgcolor"), "#f00", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "#f00", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.setAttribute("bgcolor", "  #ff0000  ");
Packit f0b94e
is(bd.getAttribute("bgcolor"), "  #ff0000  ", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "  #ff0000  ", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.setAttribute("bgcolor", "nonsense(complete)");
Packit f0b94e
is(bd.getAttribute("bgcolor"), "nonsense(complete)", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "nonsense(complete)", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
// same test again setting the prop
Packit f0b94e
bd.bgColor = "red";
Packit f0b94e
is(bd.getAttribute("bgcolor"), "red", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "red", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.bgColor = "  red  ";
Packit f0b94e
is(bd.getAttribute("bgcolor"), "  red  ", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "  red  ", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.bgColor = "#ff0000";
Packit f0b94e
is(bd.getAttribute("bgcolor"), "#ff0000", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "#ff0000", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.bgColor = "#f00";
Packit f0b94e
is(bd.getAttribute("bgcolor"), "#f00", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "#f00", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.bgColor = "  #ff0000  ";
Packit f0b94e
is(bd.getAttribute("bgcolor"), "  #ff0000  ", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "  #ff0000  ", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
bd.bgColor = "nonsense(complete)";
Packit f0b94e
is(bd.getAttribute("bgcolor"), "nonsense(complete)", "Bgcolor attribute didn't store the original value");
Packit f0b94e
is(bd.bgColor, "nonsense(complete)", ".bgColor didn't return the right value!");
Packit f0b94e
Packit f0b94e
// equal color, unequal string
Packit f0b94e
var f1 = document.createElement("font");
Packit f0b94e
var f2 = document.createElement("font");
Packit f0b94e
var f3 = document.createElement("font");
Packit f0b94e
f1.color = "#f00";
Packit f0b94e
f2.color = "#ff0000";
Packit f0b94e
f3.color = "red";
Packit f0b94e
isnot(f1.color, f2.color, "#f00 and #ff0000 should not compare equal");
Packit f0b94e
isnot(f1.color, f3.color, "#f00 and red should not compare equal");
Packit f0b94e
isnot(f2.color, f3.color, "#ff0000 and red should not compare equal");
Packit f0b94e
Packit f0b94e
isnot(f1.getAttribute("color"), f2.getAttribute("color"),
Packit f0b94e
      "#f00 and #ff0000 should not compare equal [attr]");
Packit f0b94e
isnot(f1.getAttribute("color"), f3.getAttribute("color"),
Packit f0b94e
      "#f00 and red should not compare equal [attr]");
Packit f0b94e
isnot(f2.getAttribute("color"), f3.getAttribute("color"),
Packit f0b94e
      "#ff0000 and red should not compare equal [attr]");
Packit f0b94e
Packit f0b94e
var video = document.createElement("video");
Packit f0b94e
video.setAttribute("playbackrate", "1");
Packit f0b94e
is(video.getAttribute('playbackrate'), "1",
Packit f0b94e
   "Playbackrate attribute didn't store the original value");
Packit f0b94e
video.setAttribute("playbackrate", "1.5");
Packit f0b94e
is(video.getAttribute('playbackrate'), "1.5",
Packit f0b94e
   "Playbackrate attribute didn't store the original value");
Packit f0b94e
video.setAttribute("playbackrate", "999999999999999999");
Packit f0b94e
is(video.getAttribute('playbackrate'), "999999999999999999",
Packit f0b94e
   "Playbackrate attribute didn't store the original value");
Packit f0b94e
video.setAttribute("playbackrate", "-999999999999999999");
Packit f0b94e
is(video.getAttribute('playbackrate'), "-999999999999999999",
Packit f0b94e
   "Playbackrate attribute didn't store the original value");
Packit f0b94e
video.setAttribute("playbackrate", "foo");
Packit f0b94e
is(video.getAttribute('playbackrate'), "foo",
Packit f0b94e
   "Playbackrate attribute didn't store the original value");
Packit f0b94e
</script>
Packit f0b94e
Packit f0b94e
</body>
Packit f0b94e
</html>
Packit f0b94e