我们正在使用 ASP.NET Web 优化框架与捆绑和缩小。一个包只包含 jquery 和modernizr。这一切都适用于 jquery 1.8.3,但由于我们更新到 1.9.0,jquery/modernizer 组合包不再工作。
bundles.Add(new ScriptBundle("~/st-scripts-load-first.js")
.Include("~/Resources/JavaScript/jquery-1.9.0.js",
"~/Resources/JavaScript/modernizr.form-placeholder.js"));
我们在目录中有 jquery-1.9.0.js 和 jquery-1.9.0.min.js。如果没有 .min 文件,优化框架会自动生成一个。无论 .min 文件是否存在,它都不起作用。
如果编译 debug="true" 并且没有缩小或捆绑,则它可以工作。
/* Minification failed. Returning unminified contents.
(5,2-3): run-time warning JS1195: Expected expression: *
(11,60-61): run-time warning JS1004: Expected ';': {
(395,2-3): run-time warning JS1195: Expected expression: )
(397,21-22): run-time warning JS1004: Expected ';': {
(397,4590-4591): run-time warning JS1195: Expected expression: )
(398,28-29): run-time warning JS1195: Expected expression: )
(398,84-85): run-time warning JS1002: Syntax error: }
(402,44-45): run-time warning JS1195: Expected expression: )
(408,1-2): run-time warning JS1002: Syntax error: }
(393,5-22): run-time warning JS1018: 'return' statement outside of function: return Modernizr;
(404,5,406,16): run-time warning JS1018: 'return' statement outside of function: return !!('placeholder' in (Modernizr.input || document.createElement('input')) &&
'placeholder' in (Modernizr.textarea || document.createElement('textarea'))
);
*/