<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - document.execCommand() should not count as a "user edit" for the purposes of ValidityState.tooLong"
href="https://bugs.webkit.org/show_bug.cgi?id=149911">149911</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>document.execCommand() should not count as a "user edit" for the purposes of ValidityState.tooLong
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>Forms
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>webkit@chrisrebert.com
</td>
</tr></table>
<p>
<div>
<pre>Steps to reproduce the problem:
1. Open <a href="http://jsfiddle.net/cvrebert/vdy3emx2/">http://jsfiddle.net/cvrebert/vdy3emx2/</a> in WebKit Nightly
2. Look at the console output.
What is the expected behavior?
The console output should be:
<span class="quote">> Before script edit: false
> After script edit: false</span >
Quoting from <a href="https://html.spec.whatwg.org/multipage/forms.html#attr-fe-maxlength">https://html.spec.whatwg.org/multipage/forms.html#attr-fe-maxlength</a>
<span class="quote">> Constraint validation: If an element has a maximum allowed value length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change made by a script), and the code-unit length of the element's value is greater than the element's maximum allowed value length, then the element is suffering from being too long.</span >
Since the <input>'s value was last changed by script unbiddenly invoking document.execCommand(), which should count as a script edit, not a user edit, the <input>'s validity.tooLong boolean should remain false because the "its value was last changed by a user edit (as opposed to a change made by a script)" condition has not been satisfied.
What went wrong?
The actual console output is:
<span class="quote">> Before script edit: false
> After script edit: true</span >
Which indicates that document.execCommand() is being treated as a "user edit", thus causing input.validity.tooLong to become true.
This bug is causing some test failures in
<a href="http://w3c-test.org/html/semantics/forms/constraints/form-validation-validity-tooLong.html">http://w3c-test.org/html/semantics/forms/constraints/form-validation-validity-tooLong.html</a>
(AKA <a href="https://github.com/w3c/web-platform-tests/blob/master/html/semantics/forms/constraints/form-validation-validity-tooLong.html">https://github.com/w3c/web-platform-tests/blob/master/html/semantics/forms/constraints/form-validation-validity-tooLong.html</a> )
Analogous Chrome bug: <a href="https://code.google.com/p/chromium/issues/detail?id=540978">https://code.google.com/p/chromium/issues/detail?id=540978</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>