Closed Bug 437379 Opened 16 years ago Closed 16 years ago

maxlength is not respected when text input value is changed dynamically through javascript

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jairak, Unassigned)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a1pre) Gecko/2008060403 Minefield/3.1a1pre

Maxlength is not respected when value of the text input changes dynamically with javascript. Firefox 2 behaves as expected and the value is truncated.

<input type="text" maxlength="5" id="test" />
<script language="JavaScript">
document.getElementById('test').value = "longer than it should be";
</script>

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Attached file maxlength test
No, not a dupe. It's asking (without providing any reason other than Fx2-compat) that bug 345267 be reverted. Assuming the comments there are correct, and the current behavior is the same as every other browser except Fx2, it's a wontfix.
Blocks: 345267
Component: General → Layout: Form Controls
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → layout.form-controls
Hardware: PC → All
Version: unspecified → Trunk
Indeed.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
It's just strange behaviour for javascript to not respect html when the DOM is modified. Are there any official specifications on how this should actually work - rather than saying "other browsers do it like that"? If this mentality is used, then we'd have to duplicate all IE quirks as it's how the other half of the world is doing it.
> Are there any official specifications on how this should actually
> work - rather than saying "other browsers do it like that"?

Not yet.  HTML5 is specifying this behavior (and Firefox 3 is following the draft HTML5 spec).

> then we'd have to duplicate all IE quirks

We basically do duplicate all the IE quirks that don't violate existing specifications and are needed to make significant numbers of existing web sites work...  So do all the other browsers.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: