Shazwazza / ClientDependency

DEPRECATED. A library for managing CSS & JavaScript dependencies and optimization in ASP.Net
139 stars 65 forks source link

htmlCompatibility="html5" doesn't remove type when using the LazyLoadRenderer #203

Open andersbrohall opened 2 years ago

andersbrohall commented 2 years ago

When using 1.9.10, with htmlCompatibility set to "html5" the output in the view still contains type="text/javascript" in the script tags rendered as a compliment to /WebResource.axd.

Example:

StandardRenderer: <script src="/Scripts/blocking.js?cdv=123" ></script>

LazyLoadRenderer: <script src="/WebResource.axd?d=zwknGD9um8nJ5iro3fpcG6bP2uF2y04XGbo_kIftxgePzGwzeshejCqMB8cS1HzSGnFy8XC_FwwsdTjCXr93L7CZirYmQHdnVXsyZQaaAgvbNxmmOF0IktRA-cyRKfds_yH9ij26fEtQug7rP96QCdpLt8-YwLyrldbrOM2vkTY1&t=637570492660000000" ></script><script type="text/javascript">CDLazyLoader.AddJs('/Scripts/lazy.js?cdv=123');</script>

The htmlCompatibility-switch is in set the clientDependency element in web.config (or /config/ClientDependency.config to be precise since we're using Umbraco 8.13.0) <clientDependency htmlCompatibility="html5" version="123" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.CdfLogger, Umbraco.Web">

Works: Html.RequiresJs(new JavascriptFile("~/Scripts/blocking.js") {ForceProvider = "StandardRenderer"}); @Html.Raw(Html.RenderJsHere("StandardRenderer"))

Not working: Html.RequiresJs(new JavascriptFile("~/Scripts/lazy.js") {ForceProvider = "LazyLoadRenderer"}); @Html.Raw(Html.RenderJsHere("LazyLoadRenderer"))