Permalink
Browse files

Disable text selection

  • Loading branch information...
1 parent 20e5447 commit 3283da9552ac2a14995aab9a84fb3603a5994eef @kneath committed Oct 19, 2008
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/timeframe.js
View
@@ -240,6 +240,7 @@ Timeframe.Events = {
field.addEvent('blur', this.handleFieldBlur.bind(this));
field.addEvent('keyup', this.handleFieldChange.bind(this));
}, this);
+ this._disableTextSelection();
},
// Listens to all clicks for the document
@@ -281,6 +282,19 @@ Timeframe.Events = {
// Handles when a field's value changes
handleFieldChange: function(){
+ },
+
+ _disableTextSelection: function() {
+ if (Browser.Engine.trident){
+ this.element.onselectstart = function(event) {
+ if (!/input|textarea/i.test((new Event(event)).target.tagName)) return false;
+ }
+ }else{
+ this.element.onmousedown = function(event) {
+ if (!/input|textarea/i.test((new Event(event)).target.tagName)) return false;
+ }
+ }
+ return this;
}
}
Timeframe.implement(Timeframe.Events);

0 comments on commit 3283da9

Please sign in to comment.