Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2b73027

Browse files
committedFeb 13, 2014
fix(input): setViewValue on compositionend
Because of a4e6d96, model is not updated on input/change between the compositionstart and compositionend events. Unfortunately, the compositionend event does not always happen prior to an input/change event. This changeset calls the listener function to update the model after a compositionend event is received. Closes #6058 Closes #5433
1 parent 1079105 commit 2b73027

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎src/ng/directive/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
447447

448448
element.on('compositionend', function() {
449449
composing = false;
450+
listener();
450451
});
451452
}
452453

‎test/ng/directive/inputSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ describe('input', function() {
509509
});
510510
}
511511

512+
it('should update the model on "compositionend"', function() {
513+
compileInput('<input type="text" ng-model="name" name="alias" />');
514+
if (!(msie < 9)) {
515+
browserTrigger(inputElm, 'compositionstart');
516+
changeInputValueTo('caitp');
517+
expect(scope.name).toBeUndefined();
518+
browserTrigger(inputElm, 'compositionend');
519+
expect(scope.name).toEqual('caitp');
520+
}
521+
});
522+
512523
describe('"change" event', function() {
513524
function assertBrowserSupportsChangeEvent(inputEventSupported) {
514525
// Force browser to report a lack of an 'input' event

0 commit comments

Comments
 (0)
This repository has been archived.