New issue
Advanced search Search tips

Issue 655412 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug

Blocking:
issue 633074



Sign in to add a comment

Input dirty flag should be false if the value mode is changed from non-value to value

Project Member Reported by tkent@chromium.org, Oct 13 2016

Issue description

Version: 56 canary.
OS: All

What steps will reproduce the problem?
(1) Load the following HTML

<!DOCTYPE html>
<input type=hidden value="value1">
<script>
var i = document.querySelector('input');
i.type = "text";
i.defaultValue = "value2";
alert('Should be "value2": ' + i.value);  
</script>


What is the expected output?
A dialog says 'Should be "value2": value2'

What do you see instead?
A dialog says 'Should be "value2": value1'

Please use labels and text to provide additional information.
Firefox works as expected.

Specification:
https://html.spec.whatwg.org/multipage/forms.html#input-type-change
> Otherwise, if the previous state of the element's type attribute put the value IDL attribute in any mode other than the value mode, and the new state of the element's type attribute puts the value IDL attribute in the value mode, then set the value of the element to the value of the value content attribute, if there is one, or the empty string otherwise, and then set the control's dirty value flag to false.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2cabef4e7d4a0b298a114add1298920cc0cfb321

commit 2cabef4e7d4a0b298a114add1298920cc0cfb321
Author: tkent <tkent@chromium.org>
Date: Thu Oct 13 01:54:05 2016

Input element: Fix the dirty value flag after type change.

When the input type was changed from type=hidden, of which value-mode is
"default", to type=text, of which value-mode is "value", we incorrectly set
dirty value flag to true.

This CL fixes it.

Specification:
https://html.spec.whatwg.org/multipage/forms.html#input-type-change

BUG= 655412 

Review-Url: https://codereview.chromium.org/2417753003
Cr-Commit-Position: refs/heads/master@{#424936}

[modify] https://crrev.com/2cabef4e7d4a0b298a114add1298920cc0cfb321/third_party/WebKit/LayoutTests/fast/forms/input-type-change3-expected.txt
[modify] https://crrev.com/2cabef4e7d4a0b298a114add1298920cc0cfb321/third_party/WebKit/LayoutTests/fast/forms/input-type-change3.html
[modify] https://crrev.com/2cabef4e7d4a0b298a114add1298920cc0cfb321/third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Comment 2 by tkent@chromium.org, Oct 13 2016

Labels: M-56
Status: Fixed (was: Started)

Sign in to add a comment