Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/dom_util.js

Issue 828373007: Fix math support on wikipedia. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 return node.className.toLowerCase().split(' ').some(function(className) {
dmazzoni 2015/01/14 08:20:34 Can you use classList.contains? Or at least, itera
David Tseng 2015/01/14 18:17:35 No; since the current code lower cases the classna
2451 return cvox.DomUtil.ALT_MATH_CLASSES.tex.indexOf(className) != -1 || 2451 return cvox.DomUtil.ALT_MATH_CLASSES.tex.indexOf(className) != -1 ||
2452 cvox.DomUtil.ALT_MATH_CLASSES.asciimath.indexOf(className) != -1; 2452 cvox.DomUtil.ALT_MATH_CLASSES.asciimath.indexOf(className) != -1;
2453 });
2453 }; 2454 };
2454 2455
2455 2456
2456 /** 2457 /**
2457 * Checks to see whether a node is a MathML node. 2458 * Checks to see whether a node is a MathML node.
2458 * !! This is necessary as Chrome currently does not upperCase Math tags !! 2459 * !! This is necessary as Chrome currently does not upperCase Math tags !!
2459 * @param {Node} node The node to be tested. 2460 * @param {Node} node The node to be tested.
2460 * @return {boolean} Whether or not a node is a MathML node. 2461 * @return {boolean} Whether or not a node is a MathML node.
2461 */ 2462 */
2462 cvox.DomUtil.isMathml = function(node) { 2463 cvox.DomUtil.isMathml = function(node) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 var describedNode = document.getElementById(describedById); 2593 var describedNode = document.getElementById(describedById);
2593 if (describedNode) { 2594 if (describedNode) {
2594 desc += ' ' + cvox.DomUtil.getName( 2595 desc += ' ' + cvox.DomUtil.getName(
2595 describedNode, true, true, true); 2596 describedNode, true, true, true);
2596 } 2597 }
2597 } 2598 }
2598 } 2599 }
2599 } 2600 }
2600 return desc; 2601 return desc;
2601 }; 2602 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698