Chromium Code Reviews| Index: Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| diff --git a/Source/devtools/front_end/documentation/DocumentationURLProvider.js b/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| index 250616331bfb79b29ad2a161e232a267627daf24..1678f3910853cb95acae708497f615180f916b37 100644 |
| --- a/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| +++ b/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| @@ -11,22 +11,22 @@ WebInspector.DocumentationURLProvider = function() |
| /** |
| * @const |
| - * @type {!Array.<!Object, string>} |
| + * @type {!Array.<!Object, string, string>} |
|
apavlov
2014/08/12 12:54:16
This annotation is invalid. Should be:
@type {!Ar
semeny
2014/08/12 14:27:59
Done.
|
| */ |
| WebInspector.DocumentationURLProvider._sources = [ |
| - { source: window, url: "javascript/" }, |
| - { source: window.Node.prototype, url: "dom/Node/" }, |
| - { source: window.Node, url: "dom/Node/" }, |
| - { source: window.Object.prototype, url: "javascript/Object/" }, |
| - { source: window.Object, url: "javascript/Object/" }, |
| - { source: window.Math, url: "javascript/Math/" }, |
| - { source: window.Array.prototype, url: "javascript/Array/" }, |
| - { source: window.Array, url: "javascript/Array/" }, |
| - { source: window.String.prototype, url: "javascript/String/" }, |
| - { source: window.String, url: "javascript/String/" }, |
| - { source: window.Date.prototype, url: "javascript/Date/" }, |
| - { source: window.Date, url: "javascript/Date/" }, |
| - { source: window.JSON, url: "javascript/JSON/" } |
| + { source: window, url: "javascript/", name: "Global" }, |
| + { source: window.Node.prototype, url: "dom/Node/", name: "Node.prototype" }, |
| + { source: window.Node, url: "dom/Node/", name: "Node" }, |
| + { source: window.Object.prototype, url: "javascript/Object/", name: "Object.prototype" }, |
| + { source: window.Object, url: "javascript/Object/", name: "Object" }, |
| + { source: window.Math, url: "javascript/Math/", name: "Math" }, |
| + { source: window.Array.prototype, url: "javascript/Array/", name: "Array.prototype" }, |
| + { source: window.Array, url: "javascript/Array/", name: "Array" }, |
| + { source: window.String.prototype, url: "javascript/String/", name: "String.prototype" }, |
| + { source: window.String, url: "javascript/String/", name: "String" }, |
| + { source: window.Date.prototype, url: "javascript/Date/", name: "Date.prototype" }, |
| + { source: window.Date, url: "javascript/Date/", name: "Date" }, |
| + { source: window.JSON, url: "javascript/JSON/", name: "JSON" } |
| ]; |
| /** |
| @@ -37,15 +37,20 @@ WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ |
| WebInspector.DocumentationURLProvider.prototype = { |
| /** |
| * @param {string} searchTerm |
| - * @return {?string} |
| + * @return {!Array.<{url: string, name: string}>} |
| */ |
| itemPath: function(searchTerm) |
|
yurys
2014/08/12 12:49:59
documentationUrls
apavlov
2014/08/12 12:54:16
This no longer returns a "path". Let's rename it t
semeny
2014/08/12 14:27:59
Done.
|
| { |
| + var possiblePaths = []; |
| for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.length; ++i) { |
| var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; |
| - if (sourceRef.source[searchTerm] instanceof Function) |
| - return String.sprintf(WebInspector.DocumentationURLProvider._urlFormat, sourceRef.url, searchTerm); |
| + if (sourceRef.source[searchTerm] instanceof Function) { |
|
yurys
2014/08/12 12:49:59
typeof sourceRef.source[searchTerm] !== "undefined
semeny
2014/08/12 14:27:59
Currently we are working only with methods, not pr
|
| + var property = {} |
|
apavlov
2014/08/12 12:54:16
You can initialize the fields right in the literal
semeny
2014/08/12 14:27:59
Done.
|
| + property.url = String.sprintf(WebInspector.DocumentationURLProvider._urlFormat, sourceRef.url, searchTerm); |
| + property.name = sourceRef.name + "." + searchTerm; |
| + possiblePaths.push(property); |
| + } |
| } |
| - return null; |
| + return possiblePaths; |
| } |
| } |