createShadowRoot() is an old way to bind the shadow-root element to host. This was suggested in the original specification, which was then deprecated in favor of attachShadow . Spec has also been updated .
But the new API has not been standardized and none of the browsers currently support it. Therefore, I would suggest sticking with createShadowRoot . After you start receiving browser warnings for the browser, it will be time to switch to attachShadow .
source share