mimo84/bootstrap-maxlength

Newline counted twice in textarea

Closed this issue · 1 comments

Newline counted twice in textarea

You can disable by setting "twoCharLinebreak" to false, although line breaks are counted twice in IE10+ and Chrome textarea validation so you may have issues on form submission in those browsers.

2 characters is also the correct HTML spec: The element’s value is defined to be the element’s raw value with the textarea wrapping transformation applied. The textarea wrapping transformation is the following algorithm, as applied to a string:
Replace every occurrence of a U+000D CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character, and every occurrence of a U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR) character, by a two-character string consisting of a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair.

http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-textarea-element