Changeset 13759
- Timestamp:
- 05/17/08 08:59:40 (3 months ago)
- Files:
-
- 1 modified
-
dijit/trunk/form/_FormWidget.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/_FormWidget.js
r13752 r13759 300 300 301 301 postCreate: function(){ 302 if(dojo.isIE || dojo.isSafari){ // IE won't stop the event with keypress and Safari won't send an ESCAPE to keypress at all 303 this.connect(this.focusNode || this.domNode, "onkeydown", this._onKeyDown); 304 } 302 305 this.setValue(this.value, null); 303 306 }, … … 329 332 }, 330 333 334 _onKeyDown: function(e){ 335 if(e.keyCode == dojo.keys.ESCAPE && !e.ctrlKey && !e.altKey){ 336 var te; 337 if(dojo.isIE){ 338 e.preventDefault(); // default behavior needs to be stopped here since keypress is too late 339 te = document.createEventObject(); 340 te.keyCode = dojo.keys.ESCAPE; 341 te.shiftKey = e.shiftKey; 342 e.srcElement.fireEvent('onkeypress', te); 343 }else if(dojo.isSafari){ // ESCAPE needs help making it into keypress 344 te = document.createEvent('Events'); 345 te.initEvent('keypress', true, true); 346 te.keyCode = dojo.keys.ESCAPE; 347 te.shiftKey = e.shiftKey; 348 e.target.dispatchEvent(te); 349 } 350 } 351 }, 352 331 353 _onKeyPress: function(e){ 332 if(e.charOrCode == dojo.keys.ESCAPE && !e.shiftKey && !e.ctrlKey && !e.altKey){ 333 if(this._valueChanged()){ 334 this.undo(); 335 dojo.stopEvent(e); 336 return false; 337 } 338 } 339 else if(this.intermediateChanges){ 354 if(e.charOrCode == dojo.keys.ESCAPE && !e.ctrlKey && !e.altKey && this._valueChanged()){ 355 this.undo(); 356 dojo.stopEvent(e); 357 return false; 358 }else if(this.intermediateChanges){ 340 359 var _this = this; 341 360 // the setTimeout allows the key to post to the widget input box