| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * 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 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 _cancelSearch: function() | 1731 _cancelSearch: function() |
| 1732 { | 1732 { |
| 1733 if (this._searchId) { | 1733 if (this._searchId) { |
| 1734 this._agent.discardSearchResults(this._searchId); | 1734 this._agent.discardSearchResults(this._searchId); |
| 1735 delete this._searchId; | 1735 delete this._searchId; |
| 1736 } | 1736 } |
| 1737 }, | 1737 }, |
| 1738 | 1738 |
| 1739 /** | 1739 /** |
| 1740 * @param {!DOMAgent.NodeId} nodeId | 1740 * @param {!DOMAgent.NodeId} nodeId |
| 1741 * @return {!Promise<!Array<string>>} |
| 1742 */ |
| 1743 classNamesPromise: function(nodeId) |
| 1744 { |
| 1745 return new Promise(promiseBody.bind(this)); |
| 1746 |
| 1747 /** |
| 1748 * @param {function(!Array<string>)} fulfill |
| 1749 * @this {WebInspector.DOMModel} |
| 1750 */ |
| 1751 function promiseBody(fulfill) |
| 1752 { |
| 1753 this._agent.collectClassNamesFromSubtree(nodeId, classNamesCallback)
; |
| 1754 |
| 1755 /** |
| 1756 * @param {?string} error |
| 1757 * @param {?Array<string>} classNames |
| 1758 */ |
| 1759 function classNamesCallback(error, classNames) |
| 1760 { |
| 1761 if (!error && classNames) |
| 1762 fulfill(classNames); |
| 1763 else |
| 1764 fulfill([]); |
| 1765 } |
| 1766 } |
| 1767 }, |
| 1768 |
| 1769 /** |
| 1770 * @param {!DOMAgent.NodeId} nodeId |
| 1741 * @param {string} selectors | 1771 * @param {string} selectors |
| 1742 * @param {function(?DOMAgent.NodeId)=} callback | 1772 * @param {function(?DOMAgent.NodeId)=} callback |
| 1743 */ | 1773 */ |
| 1744 querySelector: function(nodeId, selectors, callback) | 1774 querySelector: function(nodeId, selectors, callback) |
| 1745 { | 1775 { |
| 1746 this._agent.querySelector(nodeId, selectors, this._wrapClientCallback(ca
llback)); | 1776 this._agent.querySelector(nodeId, selectors, this._wrapClientCallback(ca
llback)); |
| 1747 }, | 1777 }, |
| 1748 | 1778 |
| 1749 /** | 1779 /** |
| 1750 * @param {!DOMAgent.NodeId} nodeId | 1780 * @param {!DOMAgent.NodeId} nodeId |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2280 } | 2310 } |
| 2281 | 2311 |
| 2282 /** | 2312 /** |
| 2283 * @param {!WebInspector.Target} target | 2313 * @param {!WebInspector.Target} target |
| 2284 * @return {?WebInspector.DOMModel} | 2314 * @return {?WebInspector.DOMModel} |
| 2285 */ | 2315 */ |
| 2286 WebInspector.DOMModel.fromTarget = function(target) | 2316 WebInspector.DOMModel.fromTarget = function(target) |
| 2287 { | 2317 { |
| 2288 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM
odel)); | 2318 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM
odel)); |
| 2289 } | 2319 } |
| OLD | NEW |