See also https://bugzilla.wikimedia.org/show_bug.cgi?id=28650 and r86698 in which this module was created.
r91844 added a test suite exposed a bug.
jquery.byteLimit is preventing characters to be added as soon as byteLength(currentValue) + 3 is more than the given limit.
Consider the following scenarios:
byteLimit: 10
input: "123456890123456890" (20 chars, 20 bytes)
result: 8 chars
expected: 10 chars ("1234567890")
The last 2 characters were incorrectly prevented from insertion.
byteLimit: 14
input: "1234567890€1234567890€" (22 chars, 26 bytes; contains two euro-symbols of 3 bytes each)
result: 13 chars
expected: 14 ("1234567890" + "€" + 1)
The last one was incorrectly prevented.
byteLimit: 12
input: "1234567890€1234567890€"
result: 10 chars
expected: 10 ("1234567890". as the next 3-byte "€" would exceed the limit)
This third scenario is the only one correctly passing.
Version: unspecified
Severity: major