? Pending

User tests: Successful: Unsuccessful:

avatar C-Lodder
C-Lodder
9 Sep 2017

Summary of Changes

This PR fixes the console error being produced in J4:

document.head.insertAdjacentElement is not a function

avatar joomla-cms-bot joomla-cms-bot - change - 9 Sep 2017
Category JavaScript
avatar C-Lodder C-Lodder - open - 9 Sep 2017
avatar C-Lodder C-Lodder - change - 9 Sep 2017
Status New Pending
avatar C-Lodder C-Lodder - change - 9 Sep 2017
The description was changed
avatar C-Lodder C-Lodder - edited - 9 Sep 2017
avatar dgt41
dgt41 - comment - 9 Sep 2017

According to MDN: https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement
this function exists even in IE8 so document.head.insertAdjacentElement('beforeend', newScript); is fine!

avatar dgt41
dgt41 - comment - 9 Sep 2017

also http://caniuse.com/#feat=insert-adjacent

@C-Lodder can you share the actual console.log?

avatar C-Lodder
C-Lodder - comment - 9 Sep 2017

@dgt41 - I posted the error in my initial comment. It's coming from line 989 of core.js

avatar dgt41
dgt41 - comment - 9 Sep 2017

@C-Lodder check your error and the function name, there are not the same! one is insertAdjacentElement and you have an error on a function insertAdjacentHTML, so the error is not in this line

avatar C-Lodder C-Lodder - change - 9 Sep 2017
The description was changed
avatar C-Lodder C-Lodder - edited - 9 Sep 2017
avatar dgt41
dgt41 - comment - 9 Sep 2017

Also which browser gives this error?

avatar C-Lodder
C-Lodder - comment - 9 Sep 2017

ah sorry, it was insertAdjacentElement, not insertAdjacentHtml

avatar dgt41
dgt41 - comment - 9 Sep 2017

never mind, @wilsonge you can merge this, it's the same functionality

avatar dgt41
dgt41 - comment - 9 Sep 2017

@C-Lodder just for the record which browser gave this error? I am using this function in coupe CEs

avatar C-Lodder
C-Lodder - comment - 9 Sep 2017

Firefox

avatar dgt41
dgt41 - comment - 9 Sep 2017

I can't replicate it in none of Firefox stable, Firefox Developer edition and Firefox Nightly

avatar wilsonge wilsonge - change - 9 Sep 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-09-09 15:11:01
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 9 Sep 2017
avatar wilsonge wilsonge - merge - 9 Sep 2017

Add a Comment

Login with GitHub to post a comment