2 <title>SVGTextContentElement.getSubStringLength
</title>
3 <script src=
"../../resources/testharness.js"></script>
4 <script src=
"../../resources/testharnessreport.js"></script>
7 <svg xmlns=
"http://www.w3.org/2000/svg" width=
"100" height=
"100">
8 <text x=
"10" y=
"20">W3C
نشاط</text>
9 <text x=
"10 50" y=
"40">AB
</text>
14 var text
= document
.querySelector('text');
15 assert_equals(text
.getNumberOfChars(), 8);
16 var lenFirst4
= text
.getSubStringLength(0, 4);
17 var lenLast4
= text
.getSubStringLength(4, 4);
18 var lenAll
= text
.getSubStringLength(0, 8);
19 assert_approx_equals(lenFirst4
+ lenLast4
, lenAll
, 0.01, 'Sum of the parts equal the total.');
20 }, document
.title
+', BiDi.');
22 var text
= document
.querySelector('text + text');
23 assert_equals(text
.getNumberOfChars(), 2);
24 var lenFirst
= text
.getSubStringLength(0, 1);
25 var lenLast
= text
.getSubStringLength(1, 1);
26 var lenAll
= text
.getSubStringLength(0, 2);
27 assert_approx_equals(lenFirst
+ lenLast
, lenAll
, 0.01, 'Sum of the parts equal the total.');
28 }, document
.title
+', multiple text-chunks.');