Re: Survival of Styling with Copy and Paste

----- Original Message ----- 
From: "Christoph Päper" <christoph.paeper@crissov.de>
To: "W3C CSS" <www-style@w3.org>
Sent: Tuesday, February 20, 2007 6:14 AM
Subject: Survival of Styling with Copy and Paste


|
| Bert Bos:
| > when you copy & paste text of which a part is generated ('content'
| > property), do you get the document's text only or also the
| > generated text?
| >
| > Some time ago, the CSS WG also discussed another, similar question:
| > if you copy & paste an element that is subject to 'text-transform:
| > uppercase', do you get uppercase or the original text?
| >
| > In both questions, the answer was that that is out of scope.
|
| I thought the answer was very simple, and twofold. If you copy (and
| paste) plain text*, no styling is retained whatsoever. If you copy
| (and paste) "rich" text, styling is preserved as far as the
| application the selection is inserted to supports the styling, so |
| text-transform| should survive most of the time, but generated
| content is not that much supported elsewhere.
| Nevertheless, this is indeed out of the scope of CSS to define.

That requires definition of the "richtext".

What happens in reality: copy/past clipboard contains html fragment
that might be not full.

Say you have source document:
<html>
<style>
   #content p { color:blue; }
</style>
...
<div id="content">
  ....
      <p>text to copy</p>
  ....
</div>
</html>

and on 'copy' UA will put in clipboard following:

<html>
      <p><!-- start -->text to copy<!-- end --></p>
</html>

As you may see even if CSS is available for the target application (where paste 
happens)
it will not work as the selector
   #content p
will match nothing in this case.

This is first. And the second: target environment may have its own opinion
about what system of styles shall be used in the document where paste happen.

So the only feasible option of inter-document copying is use of
pure html without any styling information. CSS (cascading) simply
does not work in this use case.

|
| * Note the border case of plain text as used in e-mail and
| newsgroups, there 'font-weight: bold' for instance should be rendered
| as asterisks (|*|) before and after the applicable text, likewise
| generated and transformed text should be hard-coded.
|

This is cultural and context specific - cannot be used as an universal
principle.

Andrew Fedoniouk.
http://terrainformatica.com

Received on Tuesday, 20 February 2007 23:06:37 UTC