mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Implement normalization for textarea "API value"
This commit is contained in:
parent
a7a5babb3a
commit
95a7e09b40
2 changed files with 5 additions and 10 deletions
|
@ -770,7 +770,11 @@ impl<T: ClipboardProvider> TextInput<T> {
|
||||||
/// any \n encountered will be stripped and force a new logical line.
|
/// any \n encountered will be stripped and force a new logical line.
|
||||||
pub fn set_content(&mut self, content: DOMString) {
|
pub fn set_content(&mut self, content: DOMString) {
|
||||||
self.lines = if self.multiline {
|
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 {
|
} else {
|
||||||
vec!(content)
|
vec!(content)
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
[value-defaultValue-textContent.html]
|
[value-defaultValue-textContent.html]
|
||||||
type: testharness
|
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]
|
[defaultValue and value are affected by textContent in combination with appending a DocumentFragment]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[defaultValue and value reflect child text content, not textContent]
|
[defaultValue and value reflect child text content, not textContent]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[value normalizes CRLF even spread over multiple text nodes]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue