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 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 */ | 2481 */ |
2482 cvox.DomUtil.isMathJax = function(node) { | 2482 cvox.DomUtil.isMathJax = function(node) { |
2483 if (!node || !node.tagName || !node.className) { | 2483 if (!node || !node.tagName || !node.className) { |
2484 return false; | 2484 return false; |
2485 } | 2485 } |
2486 | 2486 |
2487 function isSpanWithClass(n, cl) { | 2487 function isSpanWithClass(n, cl) { |
2488 return (n.tagName == 'SPAN' && | 2488 return (n.tagName == 'SPAN' && |
2489 n.className.split(' ').some(function(x) { | 2489 n.className.split(' ').some(function(x) { |
2490 return x.toLowerCase() == cl;})); | 2490 return x.toLowerCase() == cl;})); |
2491 }; | 2491 } |
2492 if (isSpanWithClass(node, 'math')) { | 2492 if (isSpanWithClass(node, 'math')) { |
2493 var ancestors = cvox.DomUtil.getAncestors(node); | 2493 var ancestors = cvox.DomUtil.getAncestors(node); |
2494 return ancestors.some(function(x) {return isSpanWithClass(x, 'mathjax');}); | 2494 return ancestors.some(function(x) {return isSpanWithClass(x, 'mathjax');}); |
2495 } | 2495 } |
2496 return false; | 2496 return false; |
2497 }; | 2497 }; |
2498 | 2498 |
2499 | 2499 |
2500 /** | 2500 /** |
2501 * Computes the id of the math span in a MathJax DOM element. | 2501 * Computes the id of the math span in a MathJax DOM element. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2601 var describedNode = document.getElementById(describedById); | 2601 var describedNode = document.getElementById(describedById); |
2602 if (describedNode) { | 2602 if (describedNode) { |
2603 desc += ' ' + cvox.DomUtil.getName( | 2603 desc += ' ' + cvox.DomUtil.getName( |
2604 describedNode, true, true, true); | 2604 describedNode, true, true, true); |
2605 } | 2605 } |
2606 } | 2606 } |
2607 } | 2607 } |
2608 } | 2608 } |
2609 return desc; | 2609 return desc; |
2610 }; | 2610 }; |
OLD | NEW |