On 11/21/2025 1:26 PM, Martin Thomson wrote:
I don't know if this is reasonable, but I see some interesting compatibility challenges here.

Take:
https://datatracker.ietf.org/doc/html/rfc9000#:~:text=7841.,Information

That selects over a pilcrow that is in a <span> marked with `user-select: none`.  Edge presently returns '7841.¶\n\nInformation' when asking for the selection.  That seems consistent with your `getSelection().getRangeAt(0).toString()` variant.  Firefox does not include the pilcrow OR the line feed characters. Firefox presently returns '7841.Information'.  What do you expect to happen with the change?  (There's a long-standing open bug on not including the line feed characters when copying content like this that I'd love to see fixed, FWIW. https://bugzilla.mozilla.org/show_bug.cgi?id=1832443)

Well, the serialization is managed by the serializer module which is currently maintained by Edgar. According to his comment in the review, we ignore "user-select:none" contents. I don't know whether this is reasonable or not. From point of view of the rendering result, not containing them is reasonable because they are painted as not selected. From point of view of the some users, they may want the non-selectable content in the clipboard data since they selected across the non-selectable nodes.

On the other hand, the range across the boundaries of the paragraphs. Then, I think it should be reasonable to contain the line break before "Information". And with the fix, the line break is also copied into the clipboard.

When Gecko splits a user selected range to multiple ranges, Gecko started 2nd or latter range from following leaf content. I guess that that the cause of not copying the line break caused by the new paragraph. Gecko will ignore non-selectable nodes at serialization so that the block boundaries won't be lost.

--
Masayuki Nakano<[email protected]>
Working on DOM, Events, editor and IME handling for Gecko

--
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/6d1e7f2c-75b8-4dc6-b43b-5d48ee94315f%40d-toybox.com.

Reply via email to