Skip to content

IE8 StringBuilder toString bugfix #400

Open
wants to merge 1 commit into from

2 participants

@lduchosal

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 lduchosal IE8 StringBuilder toString bugfix
var t = new ss.StringBuilder;
t.appendLine("IE8 toString override bug"),
var s = t.toString(''); // IE8 returns [object Object]
cf0d56f
@nikhilk
Owner
nikhilk commented Nov 1, 2013

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.