Re: [w3c/selection-api] Selection.toString is under specified (#7)

Also important to include in tests is how the `<br>` tag is rendered in plain text, of which there are also several platform-dependent possibilities—ranging from the ASCII line feed U+000A to the Microsoft CRLF newline U+000D,U+000A to the Unicode Line Separator U+2028. Whatever `<br>` becomes in plain text, it (as well as double line separators for `<br><br>`) would ideally be distinguishable from whatever paragraph separator that `<p>` becomes. The same, of course, applies to `innerText`.

`Selection.toString` and `innerText` might have to end up explicitly platform dependent, affecting interoperability. An example may be found in the [Hypothes.is library](https://github.com/hypothesis/h), an implementation of the [Web Annotations standards](https://www.w3.org/blog/news/archives/6156). The standards’ `TextQuoteSelector` type requires that arbitrary user-selected HTML text be “normalized” by stripping it of formatting markup, then exactly matching it to a stored plain-text string. Hypothes.is uses the `Selection` API to do this “normalization”, which opens it up to platform differences in line separators, paragraph separators, and so forth.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/7#issuecomment-295305400

Received on Wednesday, 19 April 2017 15:14:57 UTC