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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 // This adds up a total error up to 2. | 179 // This adds up a total error up to 2. |
180 return Math.abs(this.scrollTop + this.clientHeight - this.scrollHeight) <= 2 ; | 180 return Math.abs(this.scrollTop + this.clientHeight - this.scrollHeight) <= 2 ; |
181 } | 181 } |
182 | 182 |
183 /** | 183 /** |
184 * @param {!Node} fromNode | 184 * @param {!Node} fromNode |
185 * @param {!Node} toNode | 185 * @param {!Node} toNode |
186 */ | 186 */ |
187 function removeSubsequentNodes(fromNode, toNode) | 187 function removeSubsequentNodes(fromNode, toNode) |
188 { | 188 { |
189 for (var node = fromNode; node && node !== toNode; ) { | 189 for (var node = fromNode; node && node !== toNode;) { |
paulirish
2016/04/22 09:50:50
This is the only change I feel bad about.
| |
190 var nodeToRemove = node; | 190 var nodeToRemove = node; |
191 node = node.nextSibling; | 191 node = node.nextSibling; |
192 nodeToRemove.remove(); | 192 nodeToRemove.remove(); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 /** | 196 /** |
197 * @param {!Event} event | 197 * @param {!Event} event |
198 * @return {boolean} | 198 * @return {boolean} |
199 */ | 199 */ |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 { | 739 { |
740 for (var i = 0, n = arguments.length; i < n; ++i) | 740 for (var i = 0, n = arguments.length; i < n; ++i) |
741 this.appendChild(arguments[i]); | 741 this.appendChild(arguments[i]); |
742 } | 742 } |
743 | 743 |
744 /** | 744 /** |
745 * @return {string} | 745 * @return {string} |
746 */ | 746 */ |
747 Node.prototype.deepTextContent = function() | 747 Node.prototype.deepTextContent = function() |
748 { | 748 { |
749 return this.childTextNodes().map(function (node) { return node.textContent; }).join(""); | 749 return this.childTextNodes().map(function(node) { return node.textContent; } ).join(""); |
750 } | 750 } |
751 | 751 |
752 /** | 752 /** |
753 * @return {!Array.<!Node>} | 753 * @return {!Array.<!Node>} |
754 */ | 754 */ |
755 Node.prototype.childTextNodes = function() | 755 Node.prototype.childTextNodes = function() |
756 { | 756 { |
757 var node = this.traverseNextTextNode(this); | 757 var node = this.traverseNextTextNode(this); |
758 var result = []; | 758 var result = []; |
759 var nonTextTags = { "STYLE": 1, "SCRIPT": 1 }; | 759 var nonTextTags = { "STYLE": 1, "SCRIPT": 1 }; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
987 { | 987 { |
988 window.removeEventListener("DOMContentLoaded", windowLoaded, false); | 988 window.removeEventListener("DOMContentLoaded", windowLoaded, false); |
989 callback(); | 989 callback(); |
990 } | 990 } |
991 | 991 |
992 if (document.readyState === "complete" || document.readyState === "interacti ve") | 992 if (document.readyState === "complete" || document.readyState === "interacti ve") |
993 callback(); | 993 callback(); |
994 else | 994 else |
995 window.addEventListener("DOMContentLoaded", windowLoaded, false); | 995 window.addEventListener("DOMContentLoaded", windowLoaded, false); |
996 } | 996 } |
OLD | NEW |