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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js

Issue 2655393003: DevTools: Introduce ARIAUtils (Closed)
Patch Set: Use namespace instead of class Created 3 years, 11 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/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);
+};

Powered by Google App Engine
This is Rietveld 408576698