How would I know what the maximum length of an element's attribute value is?
e.g.
<div id="value1..."></div>
What's the maximum allowable length for ID attribute of this div and any other attributes of any elements?
The maxlength attribute defines the maximum number of characters (as UTF-16 code units) the user can enter into an <input> or <textarea> . This must be an integer value 0 or higher. If no maxlength is specified, or an invalid value is specified, the input or textarea has no maximum length.
This limit is usually between 8 and 13 characters, depending on how long I've been working and if the names make sense in the context of the element.
The length attribute has a numeric value equal to the number of bytes occupied by the data that is named by the symbol specified in the attribute reference.
According to the SGML Declaration of HTML 4, the limit could be 65536 characters:
ATTSPLEN 65536 -- These are the largest values --
LITLEN 65536 -- permitted in the declaration --
NAMELEN 65536 -- Avoid fixed limits in actual --
PILEN 65536 -- implementations of HTML UA's --
The LITLEN
limits the number of characters which can appear in a single attribute value literal and the ATTSPLEN
limits the sum of all lengths of all attribute value specifications which appear in a tag.
Apparently, the limits used to be much lower in HTML 2, and people were complaining back then in 1995.
According to this page, technically unlimited. An actual test in various browsers will show their limits but my guess is the limit would be unreasonably long.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With