Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/third_party/closure/goog/ui/custombutton.js
4506 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview A button rendered via {@link goog.ui.CustomButtonRenderer}.
9
*/
10
11
goog.provide('goog.ui.CustomButton');
12
13
goog.require('goog.ui.Button');
14
goog.require('goog.ui.CustomButtonRenderer');
15
goog.require('goog.ui.registry');
16
goog.requireType('goog.dom.DomHelper');
17
goog.requireType('goog.ui.ButtonRenderer');
18
goog.requireType('goog.ui.ControlContent');
19
20
21
22
/**
23
* A custom button control. Identical to {@link goog.ui.Button}, except it
24
* defaults its renderer to {@link goog.ui.CustomButtonRenderer}. One could
25
* just as easily pass `goog.ui.CustomButtonRenderer.getInstance()` to
26
* the {@link goog.ui.Button} constructor and get the same result. Provided
27
* for convenience.
28
*
29
* @param {goog.ui.ControlContent} content Text caption or existing DOM
30
* structure to display as the button's caption.
31
* @param {goog.ui.ButtonRenderer=} opt_renderer Optional renderer used to
32
* render or decorate the button; defaults to
33
* {@link goog.ui.CustomButtonRenderer}.
34
* @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for
35
* document interaction.
36
* @constructor
37
* @extends {goog.ui.Button}
38
*/
39
goog.ui.CustomButton = function(content, opt_renderer, opt_domHelper) {
40
'use strict';
41
goog.ui.Button.call(
42
this, content, opt_renderer || goog.ui.CustomButtonRenderer.getInstance(),
43
opt_domHelper);
44
};
45
goog.inherits(goog.ui.CustomButton, goog.ui.Button);
46
47
48
// Register a decorator factory function for goog.ui.CustomButtons.
49
goog.ui.registry.setDecoratorByClassName(
50
goog.ui.CustomButtonRenderer.CSS_CLASS, function() {
51
'use strict';
52
// CustomButton defaults to using CustomButtonRenderer.
53
return new goog.ui.CustomButton(null);
54
});
55
56