Index: third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9eef94dccd496b2ec91c5218c1158620dd44f812 |
--- /dev/null |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js |
@@ -0,0 +1,36 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+UI.ARIAUtils = {}; |
+ |
+/** |
+ * @param {!Element} element |
+ */ |
+UI.ARIAUtils.markAsTab = function(element) { |
+ element.setAttribute('role', 'tab'); |
+}; |
+ |
+/** |
+ * @param {!Element} element |
+ * @param {boolean} value |
+ */ |
+UI.ARIAUtils.setSelected = function(element, value) { |
+ element.setAttribute('aria-selected', !!value); |
dgozman
2017/01/27 23:12:59
Let's add a comment about !!
einbinder
2017/02/02 22:53:32
Done.
|
+}; |
+ |
+/** |
+ * @param {!Element} element |
+ * @param {boolean} value |
+ */ |
+UI.ARIAUtils.setPressed = function(element, value) { |
+ element.setAttribute('aria-pressed', !!value); |
dgozman
2017/01/27 23:12:59
Let's add a comment about !!
einbinder
2017/02/02 22:53:32
Done.
|
+}; |
+ |
+/** |
+ * @param {!Element} element |
+ * @param {string} name |
+ */ |
+UI.ARIAUtils.setAccessibleName = function(element, name) { |
+ element.setAttribute('aria-label', name); |
+}; |