Text property in script tags - Clarification?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: While reading angular's directives code , I saw this : var scriptDirective = ['$templateCache', function($templateCache) { return { restrict: 'E', terminal: true, compile: function(element, attr) { if (attr.type == 'text/ng-template') { var templateUrl = attr.id, text = element[0].text;// <-- Look here $templateCache.put(templateUrl, text); } } }; }]; But I didn't know what is that text property ( I mean ― why not use innerText ?) I was told that : "it's like textContent just only grabs the text nodes inside the element, no recursion or the