Fix evalScripts() (#186)
* Set the id of the inserted <script>. * Check if the <script> still exists before trying to remove it.
This commit was merged in pull request #186.
This commit is contained in:
@@ -12,6 +12,7 @@ module.exports = function(el) {
|
||||
}
|
||||
|
||||
script.type = "text/javascript"
|
||||
script.id = el.id;
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (src !== "") {
|
||||
@@ -33,7 +34,7 @@ module.exports = function(el) {
|
||||
// execute
|
||||
parent.appendChild(script)
|
||||
// avoid pollution only in head or body tags
|
||||
if (parent instanceof HTMLHeadElement || parent instanceof HTMLBodyElement) {
|
||||
if ((parent instanceof HTMLHeadElement || parent instanceof HTMLBodyElement) && parent.contains(script)) {
|
||||
parent.removeChild(script)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user