fix(external-script): script attrs
This commit is contained in:
parent
d7b0d1b949
commit
2653849a3e
1 changed files with 2 additions and 2 deletions
|
|
@ -8,8 +8,8 @@ function handleExternalScript () {
|
|||
if (script && script.src) {
|
||||
const newScript = document.createElement('script')
|
||||
|
||||
;['src', 'async', 'defer'].forEach(attribute => {
|
||||
newScript[attribute] = script[attribute]
|
||||
Array.prototype.slice.call(script.attributes).forEach(attribute => {
|
||||
newScript[attribute.name] = attribute.value
|
||||
})
|
||||
|
||||
script.parentNode.insertBefore(newScript, script)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue