Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
/angular.jsPublic archive

fix(input): update $viewValue when cleared#14772

Open
wesleycho wants to merge1 commit intoangular:master
base:master
Choose a base branch
Loading
fromwesleycho:fix/ie-input

Conversation

wesleycho
Copy link
Contributor

  • Fix when user clicks clear button in an input element in IE, $viewValue not being correctly updated

This shouldfix#11193.

@Narretz
Copy link
Contributor

Cool! I believe writing a test is difficult because we can't click the clear button?

Splaktar reacted with thumbs up emoji

@wesleychowesleychoforce-pushed thefix/ie-input branch 2 times, most recently from2445f95 to1da5563CompareJune 14, 2016 15:51
@wesleycho
Copy link
ContributorAuthor

Yeah - fussing around with this a bit to get the right condition currently, but I think the right fix might be attainable here.

@wesleycho
Copy link
ContributorAuthor

This is a little tough - so falsy model changes will convert to the empty string, so this potentially breaks some behavior. Any ideas on good workarounds for that situation?

@wesleychowesleychoforce-pushed thefix/ie-input branch 10 times, most recently from6273af0 tod997158CompareJune 14, 2016 17:14
var timeout;
var timeout, oldVal;
var viewValueUpdated = true, msieInput = msie >= 10 && msie <= 11;
if (msieInput && inputType === 'text') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why only text inputs? Won't types such as number have the same issue?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks like you're correct - I assumed it would have the spinner, but apparently not.

@@ -1152,10 +1158,18 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
}
};

function ieListener(ev) {
var val = element.val();
if (val === oldVal && !viewValueUpdated) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is it possible that the validity changed but the value did not (similar to thevalue === '' && ctrl.$$hasNativeValidators check inlistener)? Although I'm not seeing how that would have been handled previously either (in the!hasEvent('input') case)...

var timeout;
var timeout, oldVal;
var viewValueUpdated = false, msieInput = msie >= 10 && msie <= 11;
if (msieInput && attr.type in IE_INPUTS_WITH_CLEARING) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do we even care about the type for setting the initial oldVal though? I'd think we'd always want to setup theoldVal ifmsieInput is true...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Wouldn't that trigger a potentially unnecessary DOM access though? That is likely more expensive than this check I think. I originally had it just accessing the value, I'd be fine changing it back.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If we keep it I think it should be part of themsieInput condition, not this setup condition.

But I'd thinkelement.val() is cheap enough it doesn't matter.

@wesleycho
Copy link
ContributorAuthor

There are some complicated scenarios I'm having trouble figuring out a good solution to.

Here is an incomplete table:

Initial view valueInitial model valueView value after view changeModel value after model changeErroneous IE input eventsRun $parsers/$validators
''undefined''N/Afalsetrue
''null''N/Afalsetrue
''nullN/A''falsetrue
''undefinedN/AN/Atruefalse

- Fix when user clicks clear button in an input element in IE, $viewValue not being correctly updated
@gkalpak
Copy link
Member

Wouldn't it be easier to just add an extra listener on IEs:

element.on('??mousedown/mouseup/click??',function(event){deferListener(event,this,this.value);});

@Narretz
Copy link
Contributor

@wesleycho Do you still want to work on this?

@wesleycho
Copy link
ContributorAuthor

Don't have the bandwidth anymore :( .

@blemaire
Copy link

What's the status on this issue (not doubt i'm not the only one encountering this)
Thanks

@gkalpak
Copy link
Member

It has been abandoned (afaict) 😁
If anyone wants to take it over, we will be more than happy to offer guidance and reviews, but I don't think we have the resources to take it over, given that we have less than a month of active feature development before entering LTS.

Splaktar reacted with thumbs up emoji

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AngularJS binding does not update when IE's clear button is clicked
6 participants
@wesleycho@Narretz@gkalpak@blemaire@jbedard@googlebot

[8]ページ先頭

©2009-2025 Movatter.jp