yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
define([
    "dojo/_base/declare", // declare
    "dojo/sniff", // has("dijit-legacy-requires"), has("msapp")
    "dojo/_base/kernel", // kernel.deprecated
    "dojo/ready",
    "../_Widget",
    "../_CssStateMixin",
    "../_TemplatedMixin",
    "./_FormWidgetMixin"
], function(declare, has, kernel, ready, _Widget, _CssStateMixin, _TemplatedMixin, _FormWidgetMixin){
 
    // module:
    //      dijit/form/_FormWidget
 
    // Back compat w/1.6, remove for 2.0
    if(has("dijit-legacy-requires")){
        ready(0, function(){
            var requires = ["dijit/form/_FormValueWidget"];
            require(requires);  // use indirection so modules not rolled into a build
        });
    }
 
    return declare("dijit.form._FormWidget", [_Widget, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin], {
        // summary:
        //      Base class for widgets corresponding to native HTML elements such as `<checkbox>` or `<button>`,
        //      which can be children of a `<form>` node or a `dijit/form/Form` widget.
        //
        // description:
        //      Represents a single HTML element.
        //      All these widgets should have these attributes just like native HTML input elements.
        //      You can set them during widget construction or afterwards, via `dijit/_WidgetBase.set()`.
        //
        //      They also share some common methods.
 
        setDisabled: function(/*Boolean*/ disabled){
            // summary:
            //      Deprecated.  Use set('disabled', ...) instead.
            kernel.deprecated("setDisabled(" + disabled + ") is deprecated. Use set('disabled'," + disabled + ") instead.", "", "2.0");
            this.set('disabled', disabled);
        },
 
        setValue: function(/*String*/ value){
            // summary:
            //      Deprecated.  Use set('value', ...) instead.
            kernel.deprecated("dijit.form._FormWidget:setValue(" + value + ") is deprecated.  Use set('value'," + value + ") instead.", "", "2.0");
            this.set('value', value);
        },
 
        getValue: function(){
            // summary:
            //      Deprecated.  Use get('value') instead.
            kernel.deprecated(this.declaredClass + "::getValue() is deprecated. Use get('value') instead.", "", "2.0");
            return this.get('value');
        },
 
        postMixInProperties: function(){
            // Setup name=foo string to be referenced from the template (but only if a name has been specified).
            // Unfortunately we can't use _setNameAttr to set the name in IE due to IE limitations, see #8484, #8660.
            // But when IE6 and IE7 are desupported, then we probably don't need this anymore, so should remove it in 2.0.
            // Also, don't do this for Windows 8 Store Apps because it causes a security exception (see #16452).
            // Regarding escaping, see heading "Attribute values" in
            // http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2
            this.nameAttrSetting = (this.name && !has("msapp")) ? ('name="' + this.name.replace(/"/g, "&quot;") + '"') : '';
            this.inherited(arguments);
        }
    });
});