@simevidas you could add a reference to https://infra.spec.whatwg.org/#string-length that specifies that the length of a string is the number of UTF-16 code units.
(Alas, I personally would would prefer that graphemes would be the length – disappearing children or others tend to surprise users)