Index: third_party/WebKit/Source/devtools/front_end/accessibility/ARIAMetadata.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAMetadata.js b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAMetadata.js |
index 2303ece2c75dc8f7371aae4915fab3fada825032..222223d1f78fa395bffc85b2d679b93eff12618e 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAMetadata.js |
+++ b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAMetadata.js |
@@ -1,85 +1,82 @@ |
// Copyright (c) 2016 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. |
- |
/** |
- * @constructor |
- * @param {?Object} config |
+ * @unrestricted |
*/ |
-WebInspector.ARIAMetadata = function(config) |
-{ |
+WebInspector.ARIAMetadata = class { |
+ /** |
+ * @param {?Object} config |
+ */ |
+ constructor(config) { |
/** @type {!Map<string, !WebInspector.ARIAMetadata.Attribute>} */ |
this._attributes = new Map(); |
if (config) |
- this._initialize(config); |
-}; |
+ this._initialize(config); |
+ } |
-/** |
- * @return {!WebInspector.ARIAMetadata} |
- */ |
-WebInspector.ariaMetadata = function() |
-{ |
- if (!WebInspector.ARIAMetadata._instance) |
- WebInspector.ARIAMetadata._instance = new WebInspector.ARIAMetadata(WebInspector.ARIAMetadata._config || null); |
- return WebInspector.ARIAMetadata._instance; |
-}; |
+ /** |
+ * @param {!Object} config |
+ */ |
+ _initialize(config) { |
+ var attributes = config['attributes']; |
-WebInspector.ARIAMetadata.prototype = { |
- /** |
- * @param {!Object} config |
- */ |
- _initialize: function(config) |
- { |
- var attributes = config["attributes"]; |
+ var booleanEnum = ['true', 'false']; |
+ for (var name in attributes) { |
+ var attributeConfig = attributes[name]; |
+ if (attributeConfig.type === 'boolean') |
+ attributeConfig.enum = booleanEnum; |
+ this._attributes.set(name, new WebInspector.ARIAMetadata.Attribute(attributeConfig)); |
+ } |
- var booleanEnum = ["true", "false"]; |
- for (var name in attributes) { |
- var attributeConfig = attributes[name]; |
- if (attributeConfig.type === "boolean") |
- attributeConfig.enum = booleanEnum; |
- this._attributes.set(name, new WebInspector.ARIAMetadata.Attribute(attributeConfig)); |
- } |
+ /** @type {!Array<string>} */ |
+ this._roleNames = Object.keys(config['roles']); |
+ } |
- /** @type {!Array<string>} */ |
- this._roleNames = Object.keys(config["roles"]); |
- }, |
+ /** |
+ * @param {string} property |
+ * @return {!Array<string>} |
+ */ |
+ valuesForProperty(property) { |
+ if (this._attributes.has(property)) |
+ return this._attributes.get(property).getEnum(); |
- /** |
- * @param {string} property |
- * @return {!Array<string>} |
- */ |
- valuesForProperty: function(property) |
- { |
- if (this._attributes.has(property)) |
- return this._attributes.get(property).enum(); |
+ if (property === 'role') |
+ return this._roleNames; |
- if (property === "role") |
- return this._roleNames; |
+ return []; |
+ } |
+}; |
- return []; |
- } |
+/** |
+ * @return {!WebInspector.ARIAMetadata} |
+ */ |
+WebInspector.ariaMetadata = function() { |
+ if (!WebInspector.ARIAMetadata._instance) |
+ WebInspector.ARIAMetadata._instance = new WebInspector.ARIAMetadata(WebInspector.ARIAMetadata._config || null); |
+ return WebInspector.ARIAMetadata._instance; |
}; |
/** |
- * @constructor |
- * @param {!Object} config |
+ * @unrestricted |
*/ |
-WebInspector.ARIAMetadata.Attribute = function(config) |
-{ |
+WebInspector.ARIAMetadata.Attribute = class { |
+ /** |
+ * @param {!Object} config |
+ */ |
+ constructor(config) { |
/** @type {!Array<string>} */ |
this._enum = []; |
- if ("enum" in config) |
- this._enum = config.enum; |
-}; |
+ if ('enum' in config) |
+ this._enum = config.enum; |
+ } |
-WebInspector.ARIAMetadata.Attribute.prototype = { |
- /** |
- * @return {!Array<string>} |
- */ |
- enum: function() |
- { |
- return this._enum; |
- } |
+ /** |
+ * @return {!Array<string>} |
+ */ |
+ getEnum() { |
+ return this._enum; |
+ } |
}; |