Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google chrome bug with pre-wrap

What I'm trying to achieve is to have sequences whitespaces in a textarea preserved and words not broken at the end of the line.

so according to this: http://www.w3schools.com/cssref/pr_text_white-space.asp

when we set

white-space: pre-wrap;

the WHITESPACES should be preserved and the words not splitted at the end.

However as this jsfiddle demonstrates, google chrome does not preserve sequences of whitespaces ( there are many spaces in the textarea but chrome displays less. Notice how every other browser displays them, but chrome no ).

http://jsfiddle.net/LXUEe/2/

Is there any solution to this problem ?

I can preserve the whitespaces by using:

white-space: pre;

but then all long words split at the end of the line ( though only for chrome... )

Is there any solution ?

Thanks in advance!

edit: try to continually enter spaces at a line at that jsfiddle. the cursor will get stucked once it reaches the far right end and won't go under in the next line ( chrome )

like image 767
MirrorMirror Avatar asked Feb 03 '13 18:02

MirrorMirror


1 Answers

I'd say Chrome is the only browser correctly following W3C recommendations.

Look at the second point 4

If spaces (U+0020) or tabs (U+0009) at the end of a line have 'white-space' set to 'pre-wrap', UAs may visually collapse them.

Hope that helps.

like image 145
Will Hawker Avatar answered Nov 08 '22 02:11

Will Hawker