ale*_*cxe 11 javascript debugging backport internet-explorer-8 angularjs
Angular 1.3引入了一种新debugInfoEnabled()方法,如果false在应用程序配置函数中调用,它可以提高性能:
myApp.config(['$compileProvider', function ($compileProvider) {
$compileProvider.debugInfoEnabled(false);
}]);
Run Code Online (Sandbox Code Playgroud)
此外,Angular 1.3放弃了IE8的支持.这对我来说是一个问题,我的应用程序必须在IE8上运行.因此,我无法升级到角度1.3并且必须使用1.2.
有没有办法用角度1.2实现相同的功能?
特别是,至少有一部分debugInfoEnabled()做了:
ng-scope/ ng-isolated-scopeCSS类作为一种可能的选择,我可以分叉angularjs存储库并将该功能反向回1.2.然后,使用fork维护来自上游的更新.
非常感谢任何指针.
使用基础DOM setAttribute方法来防止默认行为.我在另一个答案中编辑了plunker:
http://plnkr.co/edit/cMar0d9IbalFxDA6AU3e?p=preview
做以下事情:
setAttribute原型方法ng调试属性来覆盖它ng调试属性,返回false使用方法如下:
/* Clone the original */
HTMLElement.prototype.ngSetAttribute = HTMLElement.prototype.setAttribute;
/* Override the API */
HTMLElement.prototype.setAttribute = function(foo, bar) {
/* Define ng attributes */
var nglist = {"ng-binding": true, "ng-scope":true,"ng-class":true,"ng-isolated-scope":true};
console.log([foo,bar]);
/* Block ng attributes; otherwise call the clone */
if (nglist[foo])
return false;
else if (JSON.stringify(nglist).match(foo) )
return false;
else
return this.ngSetAttribute(foo, bar);
}
Run Code Online (Sandbox Code Playgroud)
更换HTMLElement用Element的IE8.
参考
| 归档时间: |
|
| 查看次数: |
2713 次 |
| 最近记录: |