Skip to content

Commit

Permalink
moved focus/blur machinery to enyo.Control
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreisen committed Feb 28, 2013
1 parent 7452871 commit 930b1ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 18 additions & 0 deletions source/dom/Control.js
Expand Up @@ -514,6 +514,24 @@ enyo.kind({
hide: function() {
this.setShowing(false);
},
//* Focus on this control
focus: function() {
if (this.hasNode()) {
this.node.focus();
}
},
//* Blur this control
blur: function() {
if (this.hasNode()) {
this.node.blur();
}
},
//* Returns true if the control is focused.
hasFocus: function() {
if (this.hasNode()) {
return document.activeElement === this.node;
}
},
/**
Returns an object describing the geometry of this object, like so:
Expand Down
18 changes: 0 additions & 18 deletions source/ui/Input.js
Expand Up @@ -114,24 +114,6 @@ enyo.kind({
clear: function() {
this.setValue("");
},
//* Focus on this input
focus: function() {
if (this.hasNode()) {
this.node.focus();
}
},
//* Blur this input
blur: function() {
if (this.hasNode()) {
this.node.blur();
}
},
//* Returns true if the Input is focused.
hasFocus: function() {
if (this.hasNode()) {
return document.activeElement === this.node;
}
},
// note: we disallow dragging of an input to allow text selection on all platforms
dragstart: function() {
return this.hasFocus();
Expand Down

0 comments on commit 930b1ff

Please sign in to comment.