stringBuilder Replace on defer in GSPTV_PageAdapter breaks correctly deferred scripts

Mar 9, 2010 at 7:20 AM


I work with a sharepoint solution that uses your GSPTV_PageAdapter in a framework, i.e. I have no control over it's use.

I have found that the method of correcting incorrectly deferred scripts actually breaks scripts that are already correctly deferred. For example a script tag with a correct defer attribute such as <script type="text/javascript" src="/foo.js" defer="defer"></script> is broken like this <script type="text/javascript" src="/foo.js" defer="defer"="defer="defer""></script>.

A work around for me could be to defer that script incorrectly on purpose but since I rely on a framework and that script is added from there I can't.

Maybe change to stringBuilder.Replace("defer>", "defer=\"defer\">"); would do the trick?

Best Regards