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 the DOM. | 7 * with the DOM. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 * @param {Node} node The node to be tested. | 2440 * @param {Node} node The node to be tested. |
2441 * @return {boolean} Whether or not a node has an image with class TeX or LaTeX. | 2441 * @return {boolean} Whether or not a node has an image with class TeX or LaTeX. |
2442 */ | 2442 */ |
2443 cvox.DomUtil.isMathImg = function(node) { | 2443 cvox.DomUtil.isMathImg = function(node) { |
2444 if (!node || !node.tagName || !node.className) { | 2444 if (!node || !node.tagName || !node.className) { |
2445 return false; | 2445 return false; |
2446 } | 2446 } |
2447 if (node.tagName != 'IMG') { | 2447 if (node.tagName != 'IMG') { |
2448 return false; | 2448 return false; |
2449 } | 2449 } |
2450 var className = node.className.toLowerCase(); | 2450 for (var i = 0, className; className = node.classList.item(i); i++) { |
2451 return cvox.DomUtil.ALT_MATH_CLASSES.tex.indexOf(className) != -1 || | 2451 className = className.toLowerCase(); |
2452 cvox.DomUtil.ALT_MATH_CLASSES.asciimath.indexOf(className) != -1; | 2452 if (cvox.DomUtil.ALT_MATH_CLASSES.tex.indexOf(className) != -1 || |
| 2453 cvox.DomUtil.ALT_MATH_CLASSES.asciimath.indexOf(className) != -1) { |
| 2454 return true; |
| 2455 } |
| 2456 } |
| 2457 return false; |
2453 }; | 2458 }; |
2454 | 2459 |
2455 | 2460 |
2456 /** | 2461 /** |
2457 * Checks to see whether a node is a MathML node. | 2462 * Checks to see whether a node is a MathML node. |
2458 * !! This is necessary as Chrome currently does not upperCase Math tags !! | 2463 * !! This is necessary as Chrome currently does not upperCase Math tags !! |
2459 * @param {Node} node The node to be tested. | 2464 * @param {Node} node The node to be tested. |
2460 * @return {boolean} Whether or not a node is a MathML node. | 2465 * @return {boolean} Whether or not a node is a MathML node. |
2461 */ | 2466 */ |
2462 cvox.DomUtil.isMathml = function(node) { | 2467 cvox.DomUtil.isMathml = function(node) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 var describedNode = document.getElementById(describedById); | 2597 var describedNode = document.getElementById(describedById); |
2593 if (describedNode) { | 2598 if (describedNode) { |
2594 desc += ' ' + cvox.DomUtil.getName( | 2599 desc += ' ' + cvox.DomUtil.getName( |
2595 describedNode, true, true, true); | 2600 describedNode, true, true, true); |
2596 } | 2601 } |
2597 } | 2602 } |
2598 } | 2603 } |
2599 } | 2604 } |
2600 return desc; | 2605 return desc; |
2601 }; | 2606 }; |
OLD | NEW |