|
| 1 | +<!doctype html> |
| 2 | +<meta charset="utf-8"> |
| 3 | +<title>white-space on contenteditable=plaintext-only</title> |
| 4 | +<script src="/resources/testharness.js"></script> |
| 5 | +<script src="/resources/testharnessreport.js"></script> |
| 6 | + |
| 7 | +<div contenteditable=true data-expect=normal></div> |
| 8 | +<div contenteditable=false data-expect=normal></div> |
| 9 | +<div contenteditable=plaintext-only data-expect=pre-wrap> |
| 10 | + <div contenteditable=true data-expect=pre-wrap></div> |
| 11 | + <div contenteditable=false data-expect=pre-wrap></div> |
| 12 | +</div> |
| 13 | +<div contenteditable=PLAINTEXT-ONLY data-expect=pre-wrap></div> |
| 14 | + |
| 15 | +<div contenteditable=plaintext-only style="white-space: normal" data-expect=normal></div> |
| 16 | +<div contenteditable=plaintext-only style="white-space: pre" data-expect=pre></div> |
| 17 | +<div contenteditable=plaintext-only style="white-space: nowrap" data-expect=nowrap></div> |
| 18 | +<div contenteditable=plaintext-only style="white-space: break-spaces" data-expect=break-spaces></div> |
| 19 | +<div contenteditable=plaintext-only style="white-space: pre-line" data-expect=pre-line></div> |
| 20 | + |
| 21 | +<svg contenteditable=plaintext-only data-expect=normal></svg> |
| 22 | +<script> |
| 23 | +const els = document.querySelectorAll('[data-expect]'); |
| 24 | +function serializeStartTag(el) { |
| 25 | + let rv = `<${el.localName}`; |
| 26 | + for (const attr of el.attributes) { |
| 27 | + if (attr.name !== 'data-expect') { |
| 28 | + rv += ` ${attr.name}="${attr.value}"`; |
| 29 | + } |
| 30 | + } |
| 31 | + rv += '>'; |
| 32 | + return rv; |
| 33 | +} |
| 34 | +for (const el of els) { |
| 35 | + test(() => { |
| 36 | + assert_equals(getComputedStyle(el).whiteSpace, el.dataset.expect); |
| 37 | + }, serializeStartTag(el.parentNode) + serializeStartTag(el)); |
| 38 | +} |
| 39 | +</script> |
0 commit comments