| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return /** @type {!Element} */ (node); | 239 return /** @type {!Element} */ (node); |
| 240 if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) | 240 if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) |
| 241 return /** @type {!Element} */ (node.host); | 241 return /** @type {!Element} */ (node.host); |
| 242 return null; | 242 return null; |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * @return {?Node} | 246 * @return {?Node} |
| 247 */ | 247 */ |
| 248 Node.prototype.parentNodeOrShadowHost = function() { | 248 Node.prototype.parentNodeOrShadowHost = function() { |
| 249 return this.parentNode || this.host || null; | 249 if (this.parentNode) |
| 250 return this.parentNode; |
| 251 if (this.nodeType === Node.DOCUMENT_FRAGMENT_NODE && this.host) |
| 252 return this.host; |
| 253 return null; |
| 250 }; | 254 }; |
| 251 | 255 |
| 252 /** | 256 /** |
| 253 * @return {?Selection} | 257 * @return {?Selection} |
| 254 */ | 258 */ |
| 255 Node.prototype.getComponentSelection = function() { | 259 Node.prototype.getComponentSelection = function() { |
| 256 var parent = this.parentNode; | 260 var parent = this.parentNode; |
| 257 while (parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) | 261 while (parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) |
| 258 parent = parent.parentNode; | 262 parent = parent.parentNode; |
| 259 return parent instanceof ShadowRoot ? parent.getSelection() : this.window().ge
tSelection(); | 263 return parent instanceof ShadowRoot ? parent.getSelection() : this.window().ge
tSelection(); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 function windowLoaded() { | 818 function windowLoaded() { |
| 815 window.removeEventListener('DOMContentLoaded', windowLoaded, false); | 819 window.removeEventListener('DOMContentLoaded', windowLoaded, false); |
| 816 callback(); | 820 callback(); |
| 817 } | 821 } |
| 818 | 822 |
| 819 if (document.readyState === 'complete' || document.readyState === 'interactive
') | 823 if (document.readyState === 'complete' || document.readyState === 'interactive
') |
| 820 callback(); | 824 callback(); |
| 821 else | 825 else |
| 822 window.addEventListener('DOMContentLoaded', windowLoaded, false); | 826 window.addEventListener('DOMContentLoaded', windowLoaded, false); |
| 823 } | 827 } |
| OLD | NEW |