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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 return true; | 898 return true; |
899 } | 899 } |
900 return false; | 900 return false; |
901 }; | 901 }; |
902 | 902 |
903 | 903 |
904 /** | 904 /** |
905 * Returns the id of an earcon to play along with the description for a node. | 905 * Returns the id of an earcon to play along with the description for a node. |
906 * | 906 * |
907 * @param {Node} node The node to get the earcon for. | 907 * @param {Node} node The node to get the earcon for. |
908 * @return {number?} The earcon id, or null if none applies. | 908 * @return {cvox.Earcon?} The earcon id, or null if none applies. |
909 */ | 909 */ |
910 cvox.AriaUtil.getEarcon = function(node) { | 910 cvox.AriaUtil.getEarcon = function(node) { |
911 if (!node || !node.getAttribute) { | 911 if (!node || !node.getAttribute) { |
912 return null; | 912 return null; |
913 } | 913 } |
914 var role = cvox.AriaUtil.getRoleAttribute(node); | 914 var role = cvox.AriaUtil.getRoleAttribute(node); |
915 switch (role) { | 915 switch (role) { |
916 case 'button': | 916 case 'button': |
917 return cvox.AbstractEarcons.BUTTON; | 917 return cvox.Earcon.BUTTON; |
918 case 'checkbox': | 918 case 'checkbox': |
919 case 'radio': | 919 case 'radio': |
920 case 'menuitemcheckbox': | 920 case 'menuitemcheckbox': |
921 case 'menuitemradio': | 921 case 'menuitemradio': |
922 var checked = node.getAttribute('aria-checked'); | 922 var checked = node.getAttribute('aria-checked'); |
923 if (checked == 'true') { | 923 if (checked == 'true') { |
924 return cvox.AbstractEarcons.CHECK_ON; | 924 return cvox.Earcon.CHECK_ON; |
925 } else { | 925 } else { |
926 return cvox.AbstractEarcons.CHECK_OFF; | 926 return cvox.Earcon.CHECK_OFF; |
927 } | 927 } |
928 case 'combobox': | 928 case 'combobox': |
929 case 'listbox': | 929 case 'listbox': |
930 return cvox.AbstractEarcons.LISTBOX; | 930 return cvox.Earcon.LISTBOX; |
931 case 'textbox': | 931 case 'textbox': |
932 return cvox.AbstractEarcons.EDITABLE_TEXT; | 932 return cvox.Earcon.EDITABLE_TEXT; |
933 case 'listitem': | 933 case 'listitem': |
934 return cvox.AbstractEarcons.BULLET; | 934 return cvox.Earcon.BULLET; |
935 case 'link': | 935 case 'link': |
936 return cvox.AbstractEarcons.LINK; | 936 return cvox.Earcon.LINK; |
937 } | 937 } |
938 | 938 |
939 return null; | 939 return null; |
940 }; | 940 }; |
941 | 941 |
942 | 942 |
943 /** | 943 /** |
944 * Returns the role of the node. | 944 * Returns the role of the node. |
945 * | 945 * |
946 * This is equivalent to targetNode.getAttribute('role') | 946 * This is equivalent to targetNode.getAttribute('role') |
(...skipping 22 matching lines...) Expand all 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 |