Skip to content

Commit

Permalink
TextBox, MappedTextBox, DropDownBox: remove deprecated API's, refs #4:
Browse files Browse the repository at this point in the history
- remove deprecated methods (setDisplayedValue, getDisplayedValue)
- remove nameAttrSetting variable; it was only needed for IE6/IE7
  • Loading branch information
wkeese committed Apr 30, 2013
1 parent 6e8bb8f commit 900a3a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 43 deletions.
18 changes: 2 additions & 16 deletions form/MappedTextBox.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
define([
"dojo/_base/declare", // declare
"dojo/sniff", // has("msapp")
"dojo/dom-construct", // domConstruct.place
"./ValidationTextBox"
], function(declare, has, domConstruct, ValidationTextBox){
], function(declare, domConstruct, ValidationTextBox){

// module:
// dijit/form/MappedTextBox
Expand All @@ -22,14 +21,6 @@ define([
// tags:
// protected

postMixInProperties: function(){
this.inherited(arguments);

// We want the name attribute to go to the hidden <input>, not the displayed <input>,
// so override _FormWidget.postMixInProperties() setting of nameAttrSetting for IE.
this.nameAttrSetting = "";
},

// Remap name attribute to be mapped to hidden node created in buildRendering(), rather than this.focusNode
_setNameAttr: "valueNode",

Expand Down Expand Up @@ -67,12 +58,7 @@ define([

// Create a hidden <input> node with the serialized value used for submit
// (as opposed to the displayed value).
// Passing in name as markup rather than relying on _setNameAttr custom setter above
// to make query(input[name=...]) work on IE. (see #8660).
// But not doing that for Windows 8 Store apps because it causes a security exception (see #16452).
this.valueNode = domConstruct.place("<input type='hidden'" +
((this.name && !has("msapp")) ? ' name="' + this.name.replace(/"/g, "&quot;") + '"' : "") + "/>",
this.textbox, "after");
this.valueNode = domConstruct.place("<input type='hidden'/>", this.textbox, "after");
},

reset: function(){
Expand Down
30 changes: 5 additions & 25 deletions form/TextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ define([
"dojo/_base/declare", // declare
"dojo/dom-construct", // domConstruct.create
"dojo/dom-style", // domStyle.getComputedStyle
"dojo/_base/kernel", // kernel.deprecated
"dojo/_base/lang", // lang.hitch
"dojo/on",
"dojo/sniff", // has("ie") has("mozilla")
"./_FormValueWidget",
"./_TextBoxMixin",
"dojo/text!./templates/TextBox.html",
"../main" // to export dijit._setSelectionRange, remove in 2.0
], function(declare, domConstruct, domStyle, kernel, lang, on, has,
_FormValueWidget, _TextBoxMixin, template, dijit){
"dojo/text!./templates/TextBox.html"
], function(declare, domConstruct, domStyle, lang, on, has,
_FormValueWidget, _TextBoxMixin, template){

// module:
// dijit/form/TextBox
Expand All @@ -21,7 +19,7 @@ define([
// A base class for textbox form inputs

templateString: template,
_singleNodeTemplate: '<input class="dijit dijitReset dijitLeft dijitInputField" data-dojo-attach-point="textbox,focusNode" autocomplete="off" type="${type}" ${!nameAttrSetting} />',
_singleNodeTemplate: '<input class="dijit dijitReset dijitLeft dijitInputField" data-dojo-attach-point="textbox,focusNode" autocomplete="off" type="${type}"/>',

_buttonInputDisabled: has("ie") ? "disabled" : "", // allows IE to disallow focus, but Firefox cannot be disabled for mousedown events

Expand Down Expand Up @@ -99,24 +97,6 @@ define([
this._updatePlaceHolder();
},

getDisplayedValue: function(){
// summary:
// Deprecated. Use get('displayedValue') instead.
// tags:
// deprecated
kernel.deprecated(this.declaredClass+"::getDisplayedValue() is deprecated. Use get('displayedValue') instead.", "", "2.0");
return this.get('displayedValue');
},

setDisplayedValue: function(/*String*/ value){
// summary:
// Deprecated. Use set('displayedValue', ...) instead.
// tags:
// deprecated
kernel.deprecated(this.declaredClass+"::setDisplayedValue() is deprecated. Use set('displayedValue', ...) instead.", "", "2.0");
this.set('displayedValue', value);
},

_onBlur: function(e){
if(this.disabled){ return; }
this.inherited(arguments);
Expand Down Expand Up @@ -145,7 +125,7 @@ define([
};

// Overrides definition of _setSelectionRange from _TextBoxMixin (TODO: move to _TextBoxMixin.js?)
dijit._setSelectionRange = _TextBoxMixin._setSelectionRange = function(/*DomNode*/ element, /*Number?*/ start, /*Number?*/ stop){
_TextBoxMixin._setSelectionRange = function(/*DomNode*/ element, /*Number?*/ start, /*Number?*/ stop){
if(element.createTextRange){
var r = element.createTextRange();
r.collapse(true);
Expand Down
2 changes: 1 addition & 1 deletion form/templates/DropDownBox.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
><input class="dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value="&#935; " type="text" tabIndex="-1" readonly="readonly" role="presentation"
/></div
><div class="dijitReset dijitInputField dijitInputContainer"
><input class='dijitReset dijitInputInner' ${!nameAttrSetting} type="text" autocomplete="off"
><input class='dijitReset dijitInputInner' type="text" autocomplete="off"
data-dojo-attach-point="textbox,focusNode" role="textbox"
/></div
></div>
2 changes: 1 addition & 1 deletion form/templates/TextBox.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="dijit dijitReset dijitInline dijitLeft" id="widget_${id}" role="presentation"
><div class="dijitReset dijitInputField dijitInputContainer"
><input class="dijitReset dijitInputInner" data-dojo-attach-point='textbox,focusNode' autocomplete="off"
${!nameAttrSetting} type='${type}'
type='${type}'
/></div
></div>

0 comments on commit 900a3a9

Please sign in to comment.