简体   繁体   English

如何判断是否未使用MicrosoftAjax javascript库?

[英]How to tell if the MicrosoftAjax javascript library is not being used?

I've got the following scripts in an MVC3 application, but I'm thinking that they aren't being used, just referenced. 我在MVC3应用程序中有以下脚本,但是我认为它们并未被使用,只是被引用了。 Is there an easy way to tell if they are being used somewhere within the markup? 有没有一种简单的方法可以判断它们是否在标记中的某处被使用?

<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>  
<script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
<script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>

From "Pro ASP.NET MVC 3 Framework, Third Edition" 来自“ Pro ASP.NET MVC 3 Framework,第三版”

There are also a set of files in the ' ~/Scripts ' folder whose names start with Microsoft , for example MicrosoftAjax.js 〜/ Scripts文件夹中还有一组文件的名称以Microsoft开头,例如MicrosoftAjax.js

These are from version 2 of the MVC framework and predate Microsoft fully embracing jQuery in ASP.NET MVC. 这些来自MVC框架的版本2,并且早于Microsoft在ASP.NET MVC中完全拥抱jQuery。 We don't discuss these files since they have been superseded and are included in MVC framework just for compatibillity with earlier versions. 我们不讨论这些文件,因为它们已被取代并且仅出于与早期版本的兼容性而包含在MVC框架中。

Since the book was written by Adam Freeman & Steven Sanderson (and the later works for Microsoft) then I think that's good enough for me ;) 由于该书是由亚当·弗里曼(Adam Freeman)和史蒂文·桑德森(Steven Sanderson)撰写的(后来是微软的作品),所以我认为这对我来说已经足够了;)

The easiest way to tell that they are not being used is to remove all references to them, then thoroughly test all client-side functionality. 判断未使用它们的最简单方法是删除所有对它们的引用,然后彻底测试所有客户端功能。

Most likely... unless your app was upgraded from MVC2 or someone added some code using the MS scripts noted, they are not needed for your MVC3 site. 很有可能...除非您的应用程序是从MVC2升级的,或者有人使用提到的MS脚本添加了一些代码,否则MVC3网站不需要它们。

The scripts that you have listed are required for a backward compatibility with MVC 2 applications. 与MVC 2应用程序向后兼容时,您需要列出的脚本。

As your question is regarding MVC 3 application, removing these scripts will have no effect on your application. 由于您的问题与MVC 3应用程序有关,因此删除这些脚本不会对您的应用程序产生影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM