| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 result = result.concat(nextLevel); | 586 result = result.concat(nextLevel); |
| 587 } | 587 } |
| 588 } | 588 } |
| 589 return result; | 589 return result; |
| 590 }; | 590 }; |
| 591 | 591 |
| 592 | 592 |
| 593 /** | 593 /** |
| 594 * Recursively finds the first node(s) that match the role. | 594 * Recursively finds the first node(s) that match the role. |
| 595 * | 595 * |
| 596 * @param {Element} current The node to start looking at. | 596 * @param {Node} current The node to start looking at. |
| 597 * @param {Array<string>} role The role(s) to match. | 597 * @param {Array<string>} role The role(s) to match. |
| 598 * @return {Array<Element>} The array of matching nodes. | 598 * @return {Array<Element>} The array of matching nodes. |
| 599 */ | 599 */ |
| 600 cvox.AriaUtil.getNextLevelItems = function(current, role) { | 600 cvox.AriaUtil.getNextLevelItems = function(current, role) { |
| 601 if (current.nodeType != 1) { // If reached a node that is not an element. | 601 if (current.nodeType != 1) { // If reached a node that is not an element. |
| 602 return []; | 602 return []; |
| 603 } | 603 } |
| 604 if (role.indexOf(cvox.AriaUtil.getRoleAttribute(current)) != -1) { | 604 if (role.indexOf(cvox.AriaUtil.getRoleAttribute(current)) != -1) { |
| 605 return [current]; | 605 return [current]; |
| 606 } else { | 606 } else { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 * @param {Node} node The node to be checked. | 965 * @param {Node} node The node to be checked. |
| 966 * @return {boolean} Whether or not the node is an ARIA math node. | 966 * @return {boolean} Whether or not the node is an ARIA math node. |
| 967 */ | 967 */ |
| 968 cvox.AriaUtil.isMath = function(node) { | 968 cvox.AriaUtil.isMath = function(node) { |
| 969 if (!node || !node.getAttribute) { | 969 if (!node || !node.getAttribute) { |
| 970 return false; | 970 return false; |
| 971 } | 971 } |
| 972 var role = cvox.AriaUtil.getRoleAttribute(node); | 972 var role = cvox.AriaUtil.getRoleAttribute(node); |
| 973 return role == 'math'; | 973 return role == 'math'; |
| 974 }; | 974 }; |
| OLD | NEW |