Could you use testcommon.js?
https://github.com/w3c/web-platform-tests/blob/master/shadow-dom/testcommon.js

Once the file is included, you don't have to use element.webkitCreateShadowRoot() (webkit-prefixed).
You can use element.createShadowRoot().