| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description('Test for HTMLTextAreaElement.textLength'); |
| |
| var textArea = document.createElement('textarea'); |
| document.body.appendChild(textArea); |
| shouldBe('textArea.textLength', '0'); |
| |
| textArea.value = 'abcd'; |
| shouldBe('textArea.textLength', '4'); |
| |
| textArea.focus(); |
| eventSender.keyDown('e', []); |
| shouldBe('textArea.textLength', '5'); |
| |
| // Test for a character larger than U+FFFF. |
| textArea = document.createElement('textarea'); |
| textArea.innerHTML = '𝔸'; |
| // Firefox 3.5 and Opera 10 return 2 for 1 surrogate pair. |
| shouldBe('textArea.textLength', '2'); |
| |
| // Test for combined characters. |
| textArea = document.createElement('textarea'); |
| // U+3055 Hiragana Letter Sa |
| // U+3099 Combining Katakana-HIragana Voiced Sound Mark |
| textArea.innerHTML = 'ざ'; |
| // Firefox 3.5 seems to apply NFC for the value, and .textLength and .value.length is 1. |
| // Opera 10 returns 2, and IE's .value.length is 2. |
| shouldBe('textArea.textLength', '2'); |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |