views:

29

answers:

1

Playing around with shjs in order to display line numbers, line breaks and spaces, i came across this: Using Pseudo-Elements for the ›hidden‹ characters it behaves just as expected (in Firefox): no line numbers, spaces or line endings get copied to clipboard.

As IE8 displays everything well, I was surprised it behaves different with copy+paste.

Copy+pasting a line from FF looks like so (which is fine):

config = ({

While the same, copied from IE8 reads:

14·config· =· ({¶

The same with Opera, btw.

Does anyone know which behaviour is the correct one, and if there is a way to teach the browser the desired behaviour?

Thanks in advance

+1  A: 

Opera and IE are correct: There is no rule which forbids copying generated content. Mozilla’s behavior is btw one of the many reasons why you can’t use the <q> element …

Unfortunately, you can’t bring all browsers in line. Generated content is not part of the DOM and therefor not accessible per Javascript.

toscho
Many thanks for the quick reply. As Javascript doesn't access the generated content, no sanitazion would be required, leaving only the true dom when accessed via javascript.That's good news on this issue, at least.
nonano