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

Set host element to a block its Shadow DOM #72

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"clean": "rm -rf dist",
"lint": "eslint . --ext .js,.ts && tsc --noEmit",
"prebuild": "npm run clean && npm run lint && mkdir dist",
"build": "tsc && cp src/index.css dist/index.css",
"build": "tsc",
"pretest": "npm run build",
"test": "karma start ./test/karma.config.cjs",
"prepublishOnly": "npm run build",
Expand Down
4 changes: 0 additions & 4 deletions src/index.css

This file was deleted.

11 changes: 11 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,17 @@ export default class IncludeFragmentElement extends HTMLElement {
}
}

constructor() {
super()
this.attachShadow({mode: 'open'}).innerHTML = `
<style>
:host {
display: block;
}
</style>
<slot></slot>`
}

connectedCallback(): void {
if (this.src && this.loading === 'eager') {
handleData(this)
Expand Down