source: Dev/trunk/src/client/dojox/mobile/TextBox.js @ 532

Last change on this file since 532 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.7 KB
Line 
1define([
2        "dojo/_base/declare",
3        "dojo/dom-construct",
4        "dijit/_WidgetBase",
5        "dijit/form/_FormValueMixin",
6        "dijit/form/_TextBoxMixin",
7        "dojo/has",
8        "dojo/has!dojo-bidi?dojox/mobile/bidi/TextBox"
9], function(declare, domConstruct, WidgetBase, FormValueMixin, TextBoxMixin, has, BidiTextBox){
10
11        var TextBox = declare(has("dojo-bidi") ? "dojox.mobile.NonBidiTextBox" : "dojox.mobile.TextBox", [WidgetBase, FormValueMixin, TextBoxMixin],{
12                // summary:
13                //              A non-templated base class for textbox form inputs
14
15                baseClass: "mblTextBox",
16
17                // Override automatic assigning type --> node, it causes exception on IE8.
18                // Instead, type must be specified as this.type when the node is created, as part of the original DOM
19                _setTypeAttr: null,
20
21                // Map widget attributes to DOMNode attributes.
22                _setPlaceHolderAttr: function(/*String*/value){
23                        value = this._cv ? this._cv(value) : value;
24                        this._set("placeHolder", value);
25                        this.textbox.setAttribute("placeholder", value);
26                },
27
28                buildRendering: function(){
29                        if(!this.srcNodeRef){
30                                this.srcNodeRef = domConstruct.create("input", {"type":this.type});
31                        }
32                        this.inherited(arguments);
33                        this.textbox = this.focusNode = this.domNode;
34                },
35
36                postCreate: function(){
37                        this.inherited(arguments);
38                        this.connect(this.textbox, "onmouseup", function(){ this._mouseIsDown = false; });
39                        this.connect(this.textbox, "onmousedown", function(){ this._mouseIsDown = true; });
40                        this.connect(this.textbox, "onfocus", function(e){
41                                this._onFocus(this._mouseIsDown ? "mouse" : e);
42                                this._mouseIsDown = false;
43                        });
44                        this.connect(this.textbox, "onblur", "_onBlur");
45                }
46        });
47        return has("dojo-bidi") ? declare("dojox.mobile.TextBox", [TextBox, BidiTextBox]) : TextBox;   
48});
Note: See TracBrowser for help on using the repository browser.