Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/issue 147 re-use existing DOM shim globals if they exist #148

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/dom-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// https://developer.mozilla.org/en-US/docs/Web/API/Node
// EventTarget <- Node
// TODO should be an interface?

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO should be an interface?'

Check warning on line 12 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO should be an interface?'
class Node extends EventTarget {
// eslint-disable-next-line
cloneNode(deep) {
Expand Down Expand Up @@ -104,7 +104,7 @@
this.content = new DocumentFragment();
}

// TODO open vs closed shadow root

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO open vs closed shadow root'

Check warning on line 107 in src/dom-shim.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO open vs closed shadow root'
set innerHTML(html) {
if (this.content) {
this.content.innerHTML = `
Expand Down Expand Up @@ -137,7 +137,8 @@

// mock top level aliases (globalThis === window)
// https://developer.mozilla.org/en-US/docs/Web/API/Window
globalThis.addEventListener = noop;
globalThis.document = new Document();
globalThis.customElements = new CustomElementsRegistry();
globalThis.HTMLElement = HTMLElement;
// make this "idempotent" for now until a better idea comes along - https://github.com/ProjectEvergreen/wcc/discussions/145
globalThis.addEventListener = globalThis.addEventListener ?? noop;
globalThis.document = globalThis.document ?? new Document();
globalThis.customElements = globalThis.customElements ?? new CustomElementsRegistry();
globalThis.HTMLElement = globalThis.HTMLElement ?? HTMLElement;
Loading