Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setRangeText should probably set the dirty value flag #2425

Closed
bzbarsky opened this issue Mar 8, 2017 · 4 comments
Closed

setRangeText should probably set the dirty value flag #2425

bzbarsky opened this issue Mar 8, 2017 · 4 comments
Assignees
Labels
compat Standard is not web compatible or proprietary feature needs standardizing topic: forms

Comments

@bzbarsky
Copy link
Contributor

bzbarsky commented Mar 8, 2017

Consider this testcase:

<textarea>abcde</textarea>
<script>
  var t = document.querySelector("textarea");
  t.selectionStart = 1;
  t.selectionEnd = 2;
  t.setRangeText("xyz");
  t.defaultValue = "Why am I here?";
  alert(t.value);
</script>

Per spec this should alert (and show in the textarea) "Why am I here?" because https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-setrangetext never sets the dirty value flag. That's not what what UAs do. They alert "axyzcde" (or at least Chrome, Safari, and Firefox do). As far as I can tell this is a spec bug; setRangeText should set the flag.

@cdumez @annevk @domenic @travisleithead

@bzbarsky
Copy link
Contributor Author

bzbarsky commented Mar 8, 2017

I should note that Gecko alerts "Why am I here?" if <input> is used instead of <textarea>. I consider that a bug that I will fix to make the two match.

@annevk annevk added compat Standard is not web compatible or proprietary feature needs standardizing topic: forms labels Mar 9, 2017
@bzbarsky
Copy link
Contributor Author

I have changed Gecko behavior for <input> to match other UAs and <textarea>.

Once this is sorted out, there is a test at the end of https://hg.mozilla.org/mozilla-central/file/7b19a6386225/testing/web-platform/mozilla/tests/html/semantics/forms/textfieldselection/selection-value-interactions.html that can be moved to a normal wpt test.

@rniwa
Copy link

rniwa commented Mar 14, 2017

I agree this is a spec bug. We should just make this spec text change.

annevk added a commit that referenced this issue Mar 14, 2017
annevk added a commit that referenced this issue Mar 15, 2017
annevk added a commit that referenced this issue Mar 16, 2017
annevk added a commit that referenced this issue Mar 16, 2017
domenic pushed a commit that referenced this issue Mar 16, 2017
@bzbarsky
Copy link
Contributor Author

Test moved over to the "to be upstreamed" bucket: https://hg.mozilla.org/integration/mozilla-inbound/rev/7b89ee0ae4204848f8d6f8f03ea036b6eeff3814

alice pushed a commit to alice/html that referenced this issue Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Standard is not web compatible or proprietary feature needs standardizing topic: forms
Development

No branches or pull requests

3 participants