WYSI not quite WYG
Copying and pasting stylized and generated text (when you can select it) from a browser to an application which supports rich text styling does not adhere to the What You See Is What You Get principle.
I tested this by using the Select All command on this bit of markup.
Selecting
Generated text selection behavior varies among the Mac OS X browsers that support the :before and :after pseudo-elements.
- Mozilla: only content in the HTML markup can be selected, list numbers do not appear as selected.
- Safari: HTML markup + :before content - :after generated content cannot be selected, list numbers are not selected.
- Opera: all content but list numbers is selected.
It is displayed in the browser, so why can’t it be selected?! My use of the :before and :after elements is not the intended one, but it is a problem nonetheless.
Pasting
As with selection, generated and styled paste behavior also varies.
- Mozilla: all selected content is copied, list numbers are retained, all styling is lost.
- Safari: the selected :before content is not copied, font-style: italic is lost, list numbers are copied.
- Opera: all content, including the :before and :after, is copied, no styling is retained, list numbers are not copied.
My test markup reveals (known?) CSS2 bugs in Safari and Opera.
- Safari does not properly apply the :first-line property, displaying only the HTML content in italics. The generated content is rendered normally, regardless of where the text wraps.
- Opera does not apply the :first-letter element to the generated :before content.
Mozilla applies both the :first-letter and :first-line properties as recommended in the CSS2 spec in section 5.12.3.


Leave a Reply