Re: CSS and copy/pasting guidelines

It seems we want to make following operations to yield same result:
 - Clipboard data text/plain
 - Selection.toString()
 - Element.innerText

In current implementation, Blink/WebKit Selection.toString() returns
visible text, applied text-transform, skipping display:none.
Note: visibility:hidden, opacity:0, color=background-color, wdth:0 text are
appeared in result of toString(). In here, term "visible" means no
layout/render object for Node, rather than human's visibility.

For Seleciton.toString() about visible string, see also
https://www.w3.org/Bugs/Public/show_bug.cgi?id=10583

CSS generated content, ::before, ::after, number(OL/LI), bullet(UL/LI), are
yet another thing editing wants to have guide line.

-yosi

2016年3月25日(金) 6:28 Hallvord Reiar Michaelsen Steen <hsteen@mozilla.com>:

> On Wed, Mar 23, 2016 at 12:07 AM, Johannes Wilm
> <johannes@fiduswriter.org> wrote:
> >> The CSSWG discussed the effect of 'text-transform' on copy/pasted text
> >> last year:
> >>   https://lists.w3.org/Archives/Public/www-style/2015Apr/0282.html
> >
> > This sounds like this is about the plain text version of the copied
> > contents. There it may make sense.
> >
> > Just to make sure: the html/richtext version should probably not do
> anything
> > like this, as JS editor programmers will want o manipualte clipboard
> > contents before the actual pasting is happening, cleaning it up in ways
> we
> > cannot quite imagine here right now.
> >
> > Also, I wonder if this is something the clipboard API people have an
> opinion
> > about (CC Hallvord).
>
> I do have an opinion (FWIW), in short we should strive to not surprise
> the user. If the user thinks s/he is copying upper-case text we should
> paste upper-case text. So that's what I'd recommend doing for
> plain-text. For rich text we should grab the original source code
> including the case and preferably include a CSS fragment that does the
> transform.
>
> >> One principle that was proposed is that CSS in general shouldn't affect
> >> copy/paste operations except for
> >>   * generated content
> >>   * the 'display' property
>
> What about hidden? If I have this document:
> <p style="visibility:hidden">Hello world!</p>
> and do ctrl-a, ctrl-c - what should the plain text on the clipboard
> be, if anything? Or opacity:0? This is perhaps best covered by people
> spec'ing Selection-stuff though.
> -Hallvord
>
>

Received on Friday, 25 March 2016 01:40:36 UTC