Skip to content

Commit

Permalink
Implement normalization for textarea "API value"
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Nov 25, 2017
1 parent a7a5bab commit 95a7e09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 5 additions & 1 deletion components/script/textinput.rs
Expand Up @@ -770,7 +770,11 @@ impl<T: ClipboardProvider> TextInput<T> {
/// any \n encountered will be stripped and force a new logical line.
pub fn set_content(&mut self, content: DOMString) {
self.lines = if self.multiline {
content.split('\n').map(DOMString::from).collect()
// https://html.spec.whatwg.org/multipage/#textarea-line-break-normalisation-transformation
content.replace("\r\n", "\n")
.split(|c| c == '\n' || c == '\r')
.map(DOMString::from)
.collect()
} else {
vec!(content)
};
Expand Down
@@ -1,17 +1,8 @@
[value-defaultValue-textContent.html]
type: testharness
[defaultValue and value treat CRLF differently]
expected: FAIL

[tests for the value setter]
expected: FAIL

[defaultValue and value are affected by textContent in combination with appending a DocumentFragment]
expected: FAIL

[defaultValue and value reflect child text content, not textContent]
expected: FAIL

[value normalizes CRLF even spread over multiple text nodes]
expected: FAIL

0 comments on commit 95a7e09

Please sign in to comment.