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

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

Issue 2912383002: Add support for Element.getAttributeNames() (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/Element/getAttributeNames.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Element/getAttributeNames.html b/third_party/WebKit/LayoutTests/fast/dom/Element/getAttributeNames.html
new file mode 100644
index 0000000000000000000000000000000000000000..87c9a837c606a61bec9d74c367add63dc554b23b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/Element/getAttributeNames.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<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
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ test(function() {
+ var element = document.createElement("div");
+ assert_equals(element.getAttributeNames().length, 0);
+
+ element.setAttribute("foo", "bar");
+ assert_equals(element.getAttributeNames().length, 1);
+ assert_equals(element.getAttributeNames()[0], element.attributes[0].name);
+ assert_equals(element.getAttributeNames()[0], "foo");
+
+ element.removeAttribute("foo");
+ assert_equals(element.getAttributeNames().length, 0);
+
+ element.setAttribute("foo", "bar");
+ element.setAttributeNS("", "FOO", "bar");
+ element.setAttributeNS("dummy1", "foo", "bar");
+ element.setAttributeNS("dummy2", "dummy:foo", "bar");
+ assert_equals(element.getAttributeNames().length, 4);
+ assert_equals(element.getAttributeNames()[0], "foo");
+ assert_equals(element.getAttributeNames()[1], "FOO");
+ assert_equals(element.getAttributeNames()[2], "foo");
+ assert_equals(element.getAttributeNames()[3], "dummy:foo");
+ assert_equals(element.getAttributeNames()[0], element.attributes[0].name);
+ assert_equals(element.getAttributeNames()[1], element.attributes[1].name);
+ assert_equals(element.getAttributeNames()[2], element.attributes[2].name);
+ assert_equals(element.getAttributeNames()[3], element.attributes[3].name);
+
+ element.removeAttributeNS("", "FOO");
+ assert_equals(element.getAttributeNames().length, 3);
+ assert_equals(element.getAttributeNames()[0], "foo");
+ assert_equals(element.getAttributeNames()[1], "foo");
+ assert_equals(element.getAttributeNames()[2], "dummy:foo");
+ assert_equals(element.getAttributeNames()[0], element.attributes[0].name);
+ assert_equals(element.getAttributeNames()[1], element.attributes[1].name);
+ assert_equals(element.getAttributeNames()[2], element.attributes[2].name);
+ });
+</script>

Powered by Google App Engine
This is Rietveld 408576698