summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-textarea-element/textarea-textLength.html
blob: d249278960e9573f4f17b0cb07109d5ede272028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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>