4 https://bugzilla.mozilla.org/show_bug.cgi?id=
8 <title>Test for Bug
</title>
10 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css">
12 <script type=
"application/javascript" src=
"inspector-helpers.js"></script>
13 <script type=
"application/javascript">
16 window.onload = function() {
17 SimpleTest.waitForExplicitFinish();
21 let gInspectee = null;
24 addTest(async function setup() {
25 const url = document.getElementById(
"inspectorContent").href;
26 const { target, doc } = await attachURL(url);
28 const inspector = await target.getFront(
"inspector");
29 gWalker = inspector.walker;
33 addTest(function testChangeAttrs() {
34 const attrNode = gInspectee.querySelector(
"#a");
36 promiseDone(gWalker.querySelector(gWalker.rootNode,
"#a").then(front =
> {
38 dump(
"attrFront is: " + attrFront +
"\n");
39 // Add a few attributes.
40 const list = attrFront.startModifyingAttributes();
41 list.setAttribute(
"data-newattr",
"newvalue");
42 list.setAttribute(
"data-newattr2",
"newvalue");
45 // We're only going to test that the change hit the document.
46 // There are other tests that make sure changes are propagated
48 is(attrNode.getAttribute(
"data-newattr"),
"newvalue",
49 "Node should have the first new attribute");
50 is(attrNode.getAttribute(
"data-newattr2"),
"newvalue",
51 "Node should have the second new attribute.");
53 // Change an attribute.
54 const list = attrFront.startModifyingAttributes();
55 list.setAttribute(
"data-newattr",
"changedvalue");
58 is(attrNode.getAttribute(
"data-newattr"),
"changedvalue",
59 "Node should have the changed first value.");
60 is(attrNode.getAttribute(
"data-newattr2"),
"newvalue",
61 "Second value should remain unchanged.");
63 const list = attrFront.startModifyingAttributes();
64 list.removeAttribute(
"data-newattr2");
67 is(attrNode.getAttribute(
"data-newattr"),
"changedvalue",
68 "Node should have the changed first value.");
69 ok(!attrNode.hasAttribute(
"data-newattr2"),
"Second value should be removed.");
70 }).then(runNextTest));
73 addTest(function cleanup() {
81 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug
</a>
82 <a id=
"inspectorContent" target=
"_blank" href=
"inspector-traversal-data.html">Test Document
</a>
84 <div id=
"content" style=
"display: none">