mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 23:50:23 +00:00
fix(directive.script): Do not compile content of script tags
This commit is contained in:
parent
d1558d7924
commit
4c1c50fd9b
2 changed files with 19 additions and 0 deletions
|
|
@ -783,6 +783,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
|
|||
|
||||
var scriptTemplateLoader = ['$templateCache', function($templateCache) {
|
||||
return {
|
||||
terminal: true,
|
||||
compile: function(element, attr) {
|
||||
if (attr.type == 'text/ng-template') {
|
||||
var templateUrl = attr.id;
|
||||
|
|
|
|||
|
|
@ -949,5 +949,23 @@ describe('widget', function() {
|
|||
expect($templateCache.get('/ignore')).toBeUndefined();
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('should not compile scripts', inject(function($compile, $templateCache, $rootScope) {
|
||||
if (msie <=8) return; // see above
|
||||
|
||||
var doc = jqLite('<div></div>');
|
||||
// jQuery is too smart and removes
|
||||
doc[0].innerHTML = '<script type="text/javascript">some {{binding}}</script>' +
|
||||
'<script type="text/ng-template" id="/some">other {{binding}}</script>';
|
||||
|
||||
$compile(doc)($rootScope);
|
||||
$rootScope.$digest();
|
||||
|
||||
var scripts = doc.find('script');
|
||||
expect(scripts.eq(0).text()).toBe('some {{binding}}');
|
||||
expect(scripts.eq(1).text()).toBe('other {{binding}}');
|
||||
dealoc(doc);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue