SteveSanderson/knockout — Issue #299: text binding produces different html encoding depending upon browser
Author: cheranm
Created: 2012-01-28 19:17:43+00:00
State: open

My view model property is a string property. if the string property contains the new line characters and space, the generated htm differs the between browsers.

I have created the sample that shows the issue
http://jsfiddle.net/cheranm/zyh8c/

Run the above link in different browsers.

In IE 9, the below html is generated as expected.

First line.
Second Line.
Third line precedes with 5 space characters.

In FireFox 9.0,.1 (Notice newline and spaces are not HTML encoded)

First line. Second Line. Third line precedes with 5 space characters.

In Chrome (Space characters are not html encoded.)

First line.
Second Line.
Third line preceeds with 5 space characters.

Is it a known limitation/bug with text binding. Is there any alternative.