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

Unified Diff: Source/devtools/front_end/ui/Tooltip.js

Issue 1300703004: DevTools: only set title w/ shortcut via Tooltip manager API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 5 years, 4 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/ui/Toolbar.js ('k') | Source/devtools/front_end/ui/treeoutline.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/Tooltip.js
diff --git a/Source/devtools/front_end/ui/Tooltip.js b/Source/devtools/front_end/ui/Tooltip.js
index a0bc70ea02a32eb9d0c412bda9557773d5ca563f..dd5555f058dde93b74e5c6154691768f878fab02 100644
--- a/Source/devtools/front_end/ui/Tooltip.js
+++ b/Source/devtools/front_end/ui/Tooltip.js
@@ -132,7 +132,30 @@ WebInspector.Tooltip.installHandler = function(doc)
*/
WebInspector.Tooltip.install = function(element, tooltipContent, actionId)
{
- if (typeof tooltipContent === "string" && tooltipContent === "")
+ if (typeof tooltipContent === "string" && tooltipContent === "") {
+ delete element[WebInspector.Tooltip._symbol];
return;
+ }
element[WebInspector.Tooltip._symbol] = { content: tooltipContent, actionId: actionId };
}
+
+Object.defineProperty(HTMLElement.prototype, "title", {
+ /**
+ * @return {!Element|string}
+ * @this {!Element}
+ */
+ get: function()
+ {
+ var tooltip = this[WebInspector.Tooltip._symbol];
+ return tooltip ? tooltip.content : "";
+ },
+
+ /**
+ * @param {!Element|string} x
+ * @this {!Element}
+ */
+ set: function(x)
+ {
+ WebInspector.Tooltip.install(this, x);
+ }
+});
« no previous file with comments | « Source/devtools/front_end/ui/Toolbar.js ('k') | Source/devtools/front_end/ui/treeoutline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698