Merge pull request #12995 from leonfeng/fix/loop-protect-html

Disable loopProtect for non-JavaScript code
pull/13022/head
Samuel Plumppu 2017-02-01 00:34:59 +01:00 committed by GitHub
commit 9f858700d7
1 changed files with 5 additions and 0 deletions

View File

@ -24,6 +24,11 @@ const transformersForHtmlJS = {
{ {
name: 'add-loop-protect', name: 'add-loop-protect',
transformer: function addLoopProtect(file) { transformer: function addLoopProtect(file) {
const _contents = file.contents.toLowerCase();
if (file.ext === 'html' && !_contents.includes('<script>')) {
// No JavaScript in user code, so no need for loopProtect
return updateContents(file.contents, file);
}
return updateContents(loopProtect(file.contents), file); return updateContents(loopProtect(file.contents), file);
} }
}, },