Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Element/getAttributeNames.html

Issue 2912383002: Add support for Element.getAttributeNames() (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Element.getAttributeNames() API</title>
fs 2017/06/01 08:39:25 Wouldn't it be better to place this test in extern
Shanmuga Pandi 2017/06/01 09:14:14 Yes. You are right. I removed this file. It is not
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script>
6 test(function() {
7 var element = document.createElement("div");
8 assert_equals(element.getAttributeNames().length, 0);
9
10 element.setAttribute("foo", "bar");
11 assert_equals(element.getAttributeNames().length, 1);
12 assert_equals(element.getAttributeNames()[0], element.attributes[0].name);
13 assert_equals(element.getAttributeNames()[0], "foo");
14
15 element.removeAttribute("foo");
16 assert_equals(element.getAttributeNames().length, 0);
17
18 element.setAttribute("foo", "bar");
19 element.setAttributeNS("", "FOO", "bar");
20 element.setAttributeNS("dummy1", "foo", "bar");
21 element.setAttributeNS("dummy2", "dummy:foo", "bar");
22 assert_equals(element.getAttributeNames().length, 4);
23 assert_equals(element.getAttributeNames()[0], "foo");
24 assert_equals(element.getAttributeNames()[1], "FOO");
25 assert_equals(element.getAttributeNames()[2], "foo");
26 assert_equals(element.getAttributeNames()[3], "dummy:foo");
27 assert_equals(element.getAttributeNames()[0], element.attributes[0].name);
28 assert_equals(element.getAttributeNames()[1], element.attributes[1].name);
29 assert_equals(element.getAttributeNames()[2], element.attributes[2].name);
30 assert_equals(element.getAttributeNames()[3], element.attributes[3].name);
31
32 element.removeAttributeNS("", "FOO");
33 assert_equals(element.getAttributeNames().length, 3);
34 assert_equals(element.getAttributeNames()[0], "foo");
35 assert_equals(element.getAttributeNames()[1], "foo");
36 assert_equals(element.getAttributeNames()[2], "dummy:foo");
37 assert_equals(element.getAttributeNames()[0], element.attributes[0].name);
38 assert_equals(element.getAttributeNames()[1], element.attributes[1].name);
39 assert_equals(element.getAttributeNames()[2], element.attributes[2].name);
40 });
41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698