scriptsharp icon indicating copy to clipboard operation
scriptsharp copied to clipboard

IE8 StringBuilder toString bugfix

Open lduchosal opened this issue 11 years ago • 1 comments

Before : var t = new ss.StringBuilder; t.appendLine("toString overriden"), var s = t.toString(); // IE8 returns [object Object]

After : var t = new ss.StringBuilder; t.appendLine("IE8 toString override bug"), var s = t.toString(); // IE8 returns "toString overriden"

More informations on this bug : http://stackoverflow.com/questions/6821354/issues-with-object-tostring-in-ie8-backbone-js

Runtime scripts : I have search for every "toString" that was overriden in scriptsharp "Runtime scripts" but only found this one.

Compiled scripts : ScriptSharp compiler prevent overriding "toString" with a "Your C# source code use an unsupported feature" error.

Thanks for your time. Regards Luc

lduchosal avatar Oct 15 '13 08:10 lduchosal

Based on the referenced SO question, wouldn't this work? (likely somewhere at the bottom of the runtime script, after types have been registered, prototype has been set etc.)

StringBuilder.prototype.toString = StringBuilder$.toString;

nikhilk avatar Nov 01 '13 20:11 nikhilk