Chromium Code Reviews| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 element.addEventListener("error", oncomplete); | 726 element.addEventListener("error", oncomplete); |
| 727 | 727 |
| 728 function oncomplete() | 728 function oncomplete() |
| 729 { | 729 { |
| 730 resolve(element); | 730 resolve(element); |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 | 734 |
| 735 /** | 735 /** |
| 736 * @param {!Node} node | |
| 737 */ | |
| 738 Node.prototype.swapChildren = function(node) { | |
|
lushnikov
2016/07/20 23:54:26
let's inline this for now
luoe
2016/07/22 22:30:58
Done.
| |
| 739 if (!node) | |
| 740 return; | |
| 741 | |
| 742 var copyOfChildren = Array.prototype.slice.call(this.childNodes); | |
| 743 this.removeChildren(); | |
| 744 this.appendChildren.apply(this, node.childNodes); | |
| 745 node.removeChildren(); | |
| 746 node.appendChildren.apply(node, copyOfChildren); | |
| 747 }; | |
| 748 | |
| 749 /** | |
| 736 * @param {...!Node} var_args | 750 * @param {...!Node} var_args |
| 737 */ | 751 */ |
| 738 Node.prototype.appendChildren = function(var_args) | 752 Node.prototype.appendChildren = function(var_args) |
| 739 { | 753 { |
| 740 for (var i = 0, n = arguments.length; i < n; ++i) | 754 for (var i = 0, n = arguments.length; i < n; ++i) |
| 741 this.appendChild(arguments[i]); | 755 this.appendChild(arguments[i]); |
| 742 } | 756 } |
| 743 | 757 |
| 744 /** | 758 /** |
| 745 * @return {string} | 759 * @return {string} |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 987 { | 1001 { |
| 988 window.removeEventListener("DOMContentLoaded", windowLoaded, false); | 1002 window.removeEventListener("DOMContentLoaded", windowLoaded, false); |
| 989 callback(); | 1003 callback(); |
| 990 } | 1004 } |
| 991 | 1005 |
| 992 if (document.readyState === "complete" || document.readyState === "interacti ve") | 1006 if (document.readyState === "complete" || document.readyState === "interacti ve") |
| 993 callback(); | 1007 callback(); |
| 994 else | 1008 else |
| 995 window.addEventListener("DOMContentLoaded", windowLoaded, false); | 1009 window.addEventListener("DOMContentLoaded", windowLoaded, false); |
| 996 } | 1010 } |
| OLD | NEW |