Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1637)

Unified Diff: Source/devtools/front_end/common/DOMExtension.js

Issue 340513003: DevTools: Add JSDoc for static methods, fix JSDoc types and induced errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased patch Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/audits/AuditsPanel.js ('k') | Source/devtools/front_end/common/ModuleManager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/common/DOMExtension.js
diff --git a/Source/devtools/front_end/common/DOMExtension.js b/Source/devtools/front_end/common/DOMExtension.js
index 0dac503811e7e738e08007c09f5e988f218563d1..4ab8d1854cc73056ad5e8fd6cd3061ccf51cae2d 100644
--- a/Source/devtools/front_end/common/DOMExtension.js
+++ b/Source/devtools/front_end/common/DOMExtension.js
@@ -297,15 +297,25 @@ Element.prototype.containsEventPoint = function(event)
box.top < event.y && event.y < box.bottom;
}
+/**
+ * @param {!Array.<string>} nameArray
+ * @return {?Node}
+ */
Node.prototype.enclosingNodeOrSelfWithNodeNameInArray = function(nameArray)
{
- for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
- for (var i = 0; i < nameArray.length; ++i)
+ for (var node = this; node && node !== this.ownerDocument; node = node.parentNode) {
+ for (var i = 0; i < nameArray.length; ++i) {
if (node.nodeName.toLowerCase() === nameArray[i].toLowerCase())
return node;
+ }
+ }
return null;
}
+/**
+ * @param {string} nodeName
+ * @return {?Node}
+ */
Node.prototype.enclosingNodeOrSelfWithNodeName = function(nodeName)
{
return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);
@@ -314,15 +324,21 @@ Node.prototype.enclosingNodeOrSelfWithNodeName = function(nodeName)
/**
* @param {string} className
* @param {!Element=} stayWithin
+ * @return {?Element}
*/
Node.prototype.enclosingNodeOrSelfWithClass = function(className, stayWithin)
{
- for (var node = this; node && node !== stayWithin && node !== this.ownerDocument; node = node.parentNode)
+ for (var node = this; node && node !== stayWithin && node !== this.ownerDocument; node = node.parentNode) {
if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains(className))
- return node;
+ return /** @type {!Element} */ (node);
+ }
return null;
}
+/**
+ * @param {string} query
+ * @return {?Node}
+ */
Element.prototype.query = function(query)
{
return this.ownerDocument.evaluate(query, this, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
@@ -492,7 +508,7 @@ Element.prototype.offsetRelativeToWindow = function(targetWindow)
}
/**
- * @param {!Window} targetWindow
+ * @param {!Window=} targetWindow
* @return {!AnchorBox}
*/
Element.prototype.boxInWindow = function(targetWindow)
« no previous file with comments | « Source/devtools/front_end/audits/AuditsPanel.js ('k') | Source/devtools/front_end/common/ModuleManager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698