webcomponents / webcomponents/polyfills

[scoped-custom-element-registry] `importNode is not a function` on latest Chromium

Open
#570 3 comments 7 reactions 0 assignees View on GitHub
Focus Area: Standards & Polyfills Type: Bug
Dominant language
HTML
Stars
1.2k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

### Description

The latest version of Chromium (120) supports `ShadowRoot.prototype.createElement`.
However, it does not support `ShadowRoot.prototype.importNode`.

Since the polyfill uses the existence of `ShadowRoot.prototype.createElement` as a check for polyfill application, we get a console error `importNode is not a function` during lit render (or whenever importNode would have been called).

### Example


Open this in latest Chromium (~120):
https://4hrpnd-5000.csb.app/index.html

### Steps to reproduce

See https://codesandbox.io/p/devbox/4hrpnd?file=%2Findex.html%3A11%2C5

1. import the polyfill
2. create a custom element with a scoped registry (we do this with the help of ScopedElementsMixin [in this example]( https://codesandbox.io/p/devbox/4hrpnd?file=%2Findex.html%3A11%2C5) )
3. bootstrap the element in html via its tag name.

#### Expected behavior

The polyfill discriminates between different features that make up the scoped registries spec, (so that the demo works)

#### Actual behavior

Prototype of ShadowRoot is not patched for `importNode`

### Version

0.0.9

### Browsers affected

- [ x ] Chrome
- [ x ] Edge
- [ ] Safari
- [ ] Firefox
- [ ] IE 11

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.