OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!Document} doc | 7 * @param {!Document} doc |
8 */ | 8 */ |
9 WebInspector.Tooltip = function(doc) | 9 WebInspector.Tooltip = function(doc) |
10 { | 10 { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 new WebInspector.Tooltip(doc); | 125 new WebInspector.Tooltip(doc); |
126 } | 126 } |
127 | 127 |
128 /** | 128 /** |
129 * @param {!Element} element | 129 * @param {!Element} element |
130 * @param {!Element|string} tooltipContent | 130 * @param {!Element|string} tooltipContent |
131 * @param {string=} actionId | 131 * @param {string=} actionId |
132 */ | 132 */ |
133 WebInspector.Tooltip.install = function(element, tooltipContent, actionId) | 133 WebInspector.Tooltip.install = function(element, tooltipContent, actionId) |
134 { | 134 { |
135 if (Runtime.experiments.isEnabled("tooltips") && typeof tooltipContent === "
string" && tooltipContent === "") | 135 if (typeof tooltipContent === "string" && tooltipContent === "") |
136 return; | 136 return; |
137 if (Runtime.experiments.isEnabled("tooltips")) | 137 element[WebInspector.Tooltip._symbol] = { content: tooltipContent, actionId
: actionId }; |
138 element[WebInspector.Tooltip._symbol] = { content: tooltipContent, acti
onId: actionId }; | |
139 else if (typeof tooltipContent === "string") | |
140 element.title = tooltipContent; | |
141 else | |
142 console.assert("Cannot set an element without custom tooltips enabled"); | |
143 } | 138 } |
OLD | NEW |