OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview A collection of JavaScript utilities used to simplify working | 6 * @fileoverview A collection of JavaScript utilities used to simplify working |
7 * with ARIA (http://www.w3.org/TR/wai-aria). | 7 * with ARIA (http://www.w3.org/TR/wai-aria). |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... | |
33 cvox.AriaUtil.WIDGET_ROLE_TO_NAME = { | 33 cvox.AriaUtil.WIDGET_ROLE_TO_NAME = { |
34 'alert' : 'aria_role_alert', | 34 'alert' : 'aria_role_alert', |
35 'alertdialog' : 'aria_role_alertdialog', | 35 'alertdialog' : 'aria_role_alertdialog', |
36 'button' : 'aria_role_button', | 36 'button' : 'aria_role_button', |
37 'checkbox' : 'aria_role_checkbox', | 37 'checkbox' : 'aria_role_checkbox', |
38 'columnheader' : 'aria_role_columnheader', | 38 'columnheader' : 'aria_role_columnheader', |
39 'combobox' : 'aria_role_combobox', | 39 'combobox' : 'aria_role_combobox', |
40 'dialog' : 'aria_role_dialog', | 40 'dialog' : 'aria_role_dialog', |
41 'grid' : 'aria_role_grid', | 41 'grid' : 'aria_role_grid', |
42 'gridcell' : 'aria_role_gridcell', | 42 'gridcell' : 'aria_role_gridcell', |
43 'link' : 'aria_role_link', | 43 'link' : 'tag_link', |
dmazzoni
2015/09/25 16:23:35
Slightly confusing to me because the tag name for
| |
44 'listbox' : 'aria_role_listbox', | 44 'listbox' : 'aria_role_listbox', |
45 'log' : 'aria_role_log', | 45 'log' : 'aria_role_log', |
46 'marquee' : 'aria_role_marquee', | 46 'marquee' : 'aria_role_marquee', |
47 'menu' : 'aria_role_menu', | 47 'menu' : 'aria_role_menu', |
48 'menubar' : 'aria_role_menubar', | 48 'menubar' : 'aria_role_menubar', |
49 'menuitem' : 'aria_role_menuitem', | 49 'menuitem' : 'aria_role_menuitem', |
50 'menuitemcheckbox' : 'aria_role_menuitemcheckbox', | 50 'menuitemcheckbox' : 'aria_role_menuitemcheckbox', |
51 'menuitemradio' : 'aria_role_menuitemradio', | 51 'menuitemradio' : 'aria_role_menuitemradio', |
52 'option' : 'aria_role_option', | 52 'option' : 'aria_role_option', |
53 'progressbar' : 'aria_role_progressbar', | 53 'progressbar' : 'aria_role_progressbar', |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 | 338 |
339 /** | 339 /** |
340 * Returns a string to be presented to the user that identifies what the | 340 * Returns a string to be presented to the user that identifies what the |
341 * targetNode's role is. | 341 * targetNode's role is. |
342 * | 342 * |
343 * @param {Node} targetNode The node to get the role name for. | 343 * @param {Node} targetNode The node to get the role name for. |
344 * @return {string} The role name for the targetNode. | 344 * @return {string} The role name for the targetNode. |
345 */ | 345 */ |
346 cvox.AriaUtil.getRoleName = function(targetNode) { | 346 cvox.AriaUtil.getRoleName = function(targetNode) { |
347 var roleMsg = cvox.AriaUtil.getRoleNameMsg(targetNode); | 347 var roleMsg = cvox.AriaUtil.getRoleNameMsg(targetNode); |
348 var roleName = cvox.ChromeVox.msgs.getMsg(roleMsg); | 348 var roleName = Msgs.getMsg(roleMsg); |
349 var role = cvox.AriaUtil.getRoleAttribute(targetNode); | 349 var role = cvox.AriaUtil.getRoleAttribute(targetNode); |
350 if ((role == 'heading') && (targetNode.hasAttribute('aria-level'))) { | 350 if ((role == 'heading') && (targetNode.hasAttribute('aria-level'))) { |
351 roleName += ' ' + targetNode.getAttribute('aria-level'); | 351 roleName += ' ' + targetNode.getAttribute('aria-level'); |
352 } | 352 } |
353 return roleName ? roleName : ''; | 353 return roleName ? roleName : ''; |
354 }; | 354 }; |
355 | 355 |
356 /** | 356 /** |
357 * Returns a string that gives information about the state of the targetNode. | 357 * Returns a string that gives information about the state of the targetNode. |
358 * | 358 * |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 * @param {Node} node The node to be checked. | 969 * @param {Node} node The node to be checked. |
970 * @return {boolean} Whether or not the node is an ARIA math node. | 970 * @return {boolean} Whether or not the node is an ARIA math node. |
971 */ | 971 */ |
972 cvox.AriaUtil.isMath = function(node) { | 972 cvox.AriaUtil.isMath = function(node) { |
973 if (!node || !node.getAttribute) { | 973 if (!node || !node.getAttribute) { |
974 return false; | 974 return false; |
975 } | 975 } |
976 var role = cvox.AriaUtil.getRoleAttribute(node); | 976 var role = cvox.AriaUtil.getRoleAttribute(node); |
977 return role == 'math'; | 977 return role == 'math'; |
978 }; | 978 }; |
OLD | NEW |