You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was referred here by annevk as WHATWG deals with insertAdjacentElement() spec, whilst w3c manages insertAdjacentHTML() spec - a bit confusing to a newcomer :)
At the moment of writing insertAdjacentElement() returns the resulting element, yet insertAdjacentHTML() doesn't have a return value. In my mind it should return a NodeList if successful. Has this been discussed in the past? Having a return (NodeList or otherwise) removes the need to do a querySelector/querySelectorAll/getElementByID after insertion - making it cleaner to use.
It makes more sense to me than the insertAdjacentElement() use case, where you already have a pre-existing reference to the attached element - however insertAdjacentHTML() starts from scratch, necessitating the lookup after insertion if you want to reference it later.
The text was updated successfully, but these errors were encountered:
I was referred here by annevk as WHATWG deals with
insertAdjacentElement()
spec, whilst w3c managesinsertAdjacentHTML()
spec - a bit confusing to a newcomer :)At the moment of writing
insertAdjacentElement()
returns the resulting element, yetinsertAdjacentHTML()
doesn't have a return value. In my mind it should return a NodeList if successful. Has this been discussed in the past? Having a return (NodeList or otherwise) removes the need to do aquerySelector
/querySelectorAll
/getElementByID
after insertion - making it cleaner to use.It makes more sense to me than the
insertAdjacentElement()
use case, where you already have a pre-existing reference to the attached element - howeverinsertAdjacentHTML()
starts from scratch, necessitating the lookup after insertion if you want to reference it later.The text was updated successfully, but these errors were encountered: