diff --git a/packages/common/src/utils.js b/packages/common/src/utils.js index 7d4b7b9b8ebdeac4df140055cbb9db56a6161786..6dff2a91e6d171738e176143b4224328deb1fe76 100644 --- a/packages/common/src/utils.js +++ b/packages/common/src/utils.js @@ -14,24 +14,4 @@ export const combineURLs = (baseURL, addedURL) => { baseURL += '/'; } return new URL(addedURL.replace(/^\/+/, ''), baseURL).href; -}; - -/** - * Returns a Document like thing that can be used to create elements. - * - * It provides createElement()/createElementNS()/importNode(). - * The Document type annotation, while not correct, is used here for simplicity. - * - * https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Scoped-Custom-Element-Registries.md#scoped-element-creation-apis - * - * @param {HTMLElement} element - * @returns {Document|null} - */ -export function getShadowRootDocument(element) { - // In case the polyfill is loaded return the shadowRoot - // otherwise fall back to the global document - if (ShadowRoot.prototype.createElement !== undefined) { - return element.shadowRoot; - } - return document; -} +}; \ No newline at end of file diff --git a/packages/common/test/unit.js b/packages/common/test/unit.js index 64c44c270fcb40817f3dd4be38b3eb3b42b4c1dc..7bf4ac4d4e1926cbb8cf727e25edecafb3712543 100644 --- a/packages/common/test/unit.js +++ b/packages/common/test/unit.js @@ -1,7 +1,7 @@ import {expect, assert} from '@esm-bundle/chai'; import * as utils from '../utils'; import * as styles from '../styles'; -import {combineURLs, getShadowRootDocument} from '../'; +import {combineURLs} from '../'; import '../jsonld.js'; suite('utils', () => { @@ -34,16 +34,6 @@ suite('utils', () => { assert.isTrue(res); }); - test('getShadowRootDocument', () => { - class SomeElement3 extends HTMLElement {} - let res = utils.defineCustomElement('test-some-element-3', SomeElement3); - assert.isTrue(res); - let elm = new SomeElement3(); - elm.attachShadow({mode: 'open'}); - let doc = getShadowRootDocument(elm); - assert.isFunction(doc.createElement); - }); - test('getAssetURL', () => { // Backwards compat assert.equal(new URL(utils.getAssetURL('foo/bar')).pathname, '/foo/bar');