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) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 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 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1778 }, | 1778 }, |
1779 | 1779 |
1780 /** | 1780 /** |
1781 * @param {string} selector | 1781 * @param {string} selector |
1782 * @param {!Node=} opt_startNode | 1782 * @param {!Node=} opt_startNode |
1783 * @return {*} | 1783 * @return {*} |
1784 */ | 1784 */ |
1785 $$: function (selector, opt_startNode) | 1785 $$: function (selector, opt_startNode) |
1786 { | 1786 { |
1787 if (this._canQuerySelectorOnNode(opt_startNode)) | 1787 if (this._canQuerySelectorOnNode(opt_startNode)) |
1788 return opt_startNode.querySelectorAll(selector); | 1788 return Array.from(opt_startNode.querySelectorAll(selector)); |
pfeldman
2015/07/14 11:47:22
We should instead use local implementation of slic
yurys
2015/07/14 12:50:44
My first reaction was the same but then I realized
| |
1789 return inspectedGlobalObject.document.querySelectorAll(selector); | 1789 return Array.from(inspectedGlobalObject.document.querySelectorAll(select or)); |
1790 }, | 1790 }, |
1791 | 1791 |
1792 /** | 1792 /** |
1793 * @param {!Node=} node | 1793 * @param {!Node=} node |
1794 * @return {boolean} | 1794 * @return {boolean} |
1795 */ | 1795 */ |
1796 _canQuerySelectorOnNode: function(node) | 1796 _canQuerySelectorOnNode: function(node) |
1797 { | 1797 { |
1798 return !!node && InjectedScriptHost.subtype(node) === "node" && (node.no deType === Node.ELEMENT_NODE || node.nodeType === Node.DOCUMENT_NODE || node.nod eType === Node.DOCUMENT_FRAGMENT_NODE); | 1798 return !!node && InjectedScriptHost.subtype(node) === "node" && (node.no deType === Node.ELEMENT_NODE || node.nodeType === Node.DOCUMENT_NODE || node.nod eType === Node.DOCUMENT_FRAGMENT_NODE); |
1799 }, | 1799 }, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2027 */ | 2027 */ |
2028 _logEvent: function(event) | 2028 _logEvent: function(event) |
2029 { | 2029 { |
2030 inspectedGlobalObject.console.log(event.type, event); | 2030 inspectedGlobalObject.console.log(event.type, event); |
2031 } | 2031 } |
2032 } | 2032 } |
2033 | 2033 |
2034 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 2034 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
2035 return injectedScript; | 2035 return injectedScript; |
2036 }) | 2036 }) |
OLD | NEW |