mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #21052 - tigercosmos:rrr, r=jdm
add TextLength <!-- Please describe your changes on the following line: --> add TextLength in HTMLTextAreaElement --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21052) <!-- Reviewable:end -->
This commit is contained in:
commit
0c5b020163
4 changed files with 35 additions and 1 deletions
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>The textLengh IDL attribute</title>
|
||||
<meta content="charset=utf-16">
|
||||
<link rel="author" title="tigercosmos" href="mailto:phy.tiger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-textarea-textlength">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<textarea id="textarea"></textarea>
|
||||
<script>
|
||||
var textarea = document.getElementById("textarea");
|
||||
|
||||
test(function () {
|
||||
textarea.value= "Hello, World!";
|
||||
assert_equals(textarea.textLength, 13);
|
||||
|
||||
textarea.value = "\u4f60\u597d\uff0c\u4e16\u754c\uff01"; //你好,世界!
|
||||
assert_equals(textarea.textLength, 6);
|
||||
}, "Textarea's 'testLength' should work for utf-16.");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue