aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/input.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng/directive/input.js')
-rw-r--r--src/ng/directive/input.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index 2574360c..db594ebe 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -413,6 +413,15 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
} else {
var timeout;
+ var deferListener = function() {
+ if (!timeout) {
+ timeout = $browser.defer(function() {
+ listener();
+ timeout = null;
+ });
+ }
+ };
+
element.bind('keydown', function(event) {
var key = event.keyCode;
@@ -420,16 +429,16 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
// command modifiers arrows
if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
- if (!timeout) {
- timeout = $browser.defer(function() {
- listener();
- timeout = null;
- });
- }
+ deferListener();
});
// if user paste into input using mouse, we need "change" event to catch it
element.bind('change', listener);
+
+ // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+ if ($sniffer.hasEvent('paste')) {
+ element.bind('paste cut', deferListener);
+ }
}