`maxLength` property value incorrect when `maxlength` attribute is not set #522

kitcambridge opened this Issue Oct 19, 2012 · 1 comment


None yet
2 participants

According to section 17.4 of the HTML 4.01 spec (HTML 5 seems to be more ambiguous, but states that it should be a non-negative integer), the default value of the maxlength attribute—and thus the reflected maxLength property—should be an "unlimited number."

jsdom allows negative values, sets maxLength to NaN if the maxlength attribute is specified without a value, and sets maxLength to 0 if the attribute is unspecified. In all three cases, the invalid attribute should not be reflected by the maxLength property.

(FWIW, Firefox uses -1 instead of an implementation-dependent maximum number).

I'm willing to submit a pull request, once I familiarize myself with the jsdom source. 😃


domenic commented Oct 19, 2012

Awesome! I just updated the contributing guidelines with more info on how to find relevant DOM and HTML test suites.

It sounds like there might be quite a divergence between the spec and the various browsers, given the spec's vagueness and especially if Firefox contradicts it by using -1 instead of a nonnegative number. In that case we'll need to use our best judgement, but if we can match web reality that would be best.

Looking forward to your contribution! Let me know if there's anything I can do to help familiarize you with the source. Always great to have more people hacking on jsdom!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment