Comments (2)
This comment seems to be relevant for DocumentFragment
, fwiw
Yes, DocumentFragment has only getElementById(), querySelector() and querySelectorAll().
from wcc.
It seems at least somewhat trivial to at least support no-ops for some of the basic DOM querying methods though?
For example, being able to do something like this with querySelectorAll
would be nice without having to worry about it
https://github.com/thescientist13/greenwood-full-stack-web-modules/
import sheet from './hero.css' with { type: "css" };
const template = '...';
export default class HeroBanner extends HTMLElement {
clickButton(el) {
console.log('clicked button =>', el.textContent);
}
connectedCallback() {
if (!this.shadowRoot) {
this.attachShadow({ mode: 'open' });
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
this.shadowRoot.adoptedStyleSheets = [sheet];
this.shadowRoot.querySelectorAll('button')
.forEach(button => {
button.addEventListener('click', () => this.clickButton(button))
});
}
}
customElements.define('app-hero', HeroBanner);
What else does a ShadowRoot support? 🤔
from wcc.
Related Issues (20)
- gracefully and accurately handle "empty" entry points and dependency files that don't `export` a custom element
- support `shadowrootmode` attribute for declarative shadow DOM
- JSX components not rendering into a declarative shadow root (e.g. `<template>` tag)
- browser warning about "declarative Shadow DOM has not been enabled by includeShadowRoots" HOT 2
- drop support for CommonJS distribution
- `<style>` tag support in JSX
- Fragment (empty) tag support
- optimize how initial HTML is set on initial render for JSX usage
- adopt a bundle friendly and ESM compatible fork of escodegen
- adopt a bundle friendly and ESM compatible version of acorn-jsx
- registration of a custom element is being assumed when initializing a custom element
- duplicate loads of the DOM shim leads to an infinite rendering issue
- error for missing acorn-jsx package
- Support Constructable Stylesheets (CSS Modules) in DOM Shim
- Import Attributes syntax parsing
- Light DOM children / slots (aka HTML Web Components) HOT 4
- WCC dropping query params when loading module URLs
- rename experimental test scripts to jsx
- TypeScript parsing support
- support tsx parsing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wcc.