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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 * @param {Node} root The root of the subtree to check. | 223 * @param {Node} root The root of the subtree to check. |
224 * @param {boolean} recursive Whether or not to check beyond the root of the | 224 * @param {boolean} recursive Whether or not to check beyond the root of the |
225 * subtree for visible nodes. This option exists for performance tuning. | 225 * subtree for visible nodes. This option exists for performance tuning. |
226 * Sometimes we already have information about the descendants, and we do | 226 * Sometimes we already have information about the descendants, and we do |
227 * not need to check them again. | 227 * not need to check them again. |
228 * @return {boolean} True if the subtree contains a visible node. | 228 * @return {boolean} True if the subtree contains a visible node. |
229 * @private | 229 * @private |
230 */ | 230 */ |
231 cvox.DomUtil.hasVisibleNodeSubtree_ = function(root, recursive) { | 231 cvox.DomUtil.hasVisibleNodeSubtree_ = function(root, recursive) { |
232 if (!(root instanceof Element)) { | 232 if (!(root instanceof Element)) { |
| 233 if (!root.parentElement) { |
| 234 return false; |
| 235 } |
233 var parentStyle = document.defaultView | 236 var parentStyle = document.defaultView |
234 .getComputedStyle(root.parentElement, null); | 237 .getComputedStyle(root.parentElement, null); |
235 var isVisibleParent = !cvox.DomUtil.isInvisibleStyle(parentStyle); | 238 var isVisibleParent = !cvox.DomUtil.isInvisibleStyle(parentStyle); |
236 return isVisibleParent; | 239 return isVisibleParent; |
237 } | 240 } |
238 | 241 |
239 var rootStyle = document.defaultView.getComputedStyle(root, null); | 242 var rootStyle = document.defaultView.getComputedStyle(root, null); |
240 var isRootVisible = !cvox.DomUtil.isInvisibleStyle(rootStyle); | 243 var isRootVisible = !cvox.DomUtil.isInvisibleStyle(rootStyle); |
241 if (isRootVisible) { | 244 if (isRootVisible) { |
242 return true; | 245 return true; |
(...skipping 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 var describedNode = document.getElementById(describedById); | 2600 var describedNode = document.getElementById(describedById); |
2598 if (describedNode) { | 2601 if (describedNode) { |
2599 desc += ' ' + cvox.DomUtil.getName( | 2602 desc += ' ' + cvox.DomUtil.getName( |
2600 describedNode, true, true, true); | 2603 describedNode, true, true, true); |
2601 } | 2604 } |
2602 } | 2605 } |
2603 } | 2606 } |
2604 } | 2607 } |
2605 return desc; | 2608 return desc; |
2606 }; | 2609 }; |
OLD | NEW |