shadow-dom

Render content between the component tags

自古美人都是妖i 提交于 2019-12-17 09:18:14
问题 When a component is rendered, content inside it is ignored, for example: import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: '<div>{{title}}</div>', }) export class AppComponent { title = 'app works!'; } Using it like: <app-root>Ignored content</app-root> Renders: <div>app works!</div> But looking at PrimeNg dialog, they use components like this: <p-dialog [(visible)]="display"> <p-header> Header content here </p-header> Content <p-footer> Footer content

Is Shadow DOM fast like Virtual DOM in React.js?

白昼怎懂夜的黑 提交于 2019-12-17 07:00:10
问题 Does implementing Shadow DOM in my projects will make them faster like virtual DOM that's used by React? 回答1: Virtual DOM Virtual DOM is about avoiding unnecessary changes to the DOM, which are expensive performance-wise, because changes to the DOM usually cause re-rendering of the page. Virtual DOM also allows to collect several changes to be applied at once, so not every single change causes a re-render, but instead re-rendering only happens once after a set of changes was applied to the

Is it possible to access Shadow DOM elements through the parent document?

二次信任 提交于 2019-12-17 03:37:52
问题 This question is more aimed at user-created shadow DOM elements, but for accessibility I'll use the date input type for this question: Say for example I have a date input on my page. With a couple of bits edited out, the shadow DOM markup for this (using Chrome) looks something like: <input type="date"> #document-fragment <div pseudo="-webkit-datetime-edit"> <div pseudo="-webkit-datetime-edit-fields-wrapper"> <span role="spinbutton">dd</span> <div pseudo="-webkit-datetime-edit-text">/</div>

Nested element (web component) can't get its template

主宰稳场 提交于 2019-12-17 03:18:43
问题 I made a simple example using Web Components with two custom elements (v1) where one is nested in another. index.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Example</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="import" href="app-container.html"> </head> <body> <app-container></app-container> </body> </html> app-container.html: <link rel="import" href="toolbar.html"> <template id="app-container

Shadow Root getElementsByClassName

蹲街弑〆低调 提交于 2019-12-14 03:45:18
问题 I am using LitElement to create custom Web Components. I am fairly new at it and decided to try making image slideshow. I used W3Schools slideshow as reference while modifying it to work as LitElement. The problem is, that when I am trying to use document.getElementByClassName I am not getting anything. I am familiar with this issue since I am working with Shadow DOM so I changed it to this.shadowRoot.getElementsByClassName. Unfortunately, I get told that what I am trying to use is not a

Getting a node list by querySelectorAll()

徘徊边缘 提交于 2019-12-13 17:27:31
问题 Given the following sample code: import { LitElement, html, css } from 'lit-element'; class ItemsDisplay extends LitElement { static get styles() {...} static get properties {...} constructor () { super(); ... } render { return html` ${this.items.map((item, index, array) => html` <div class="name"> ... </div> `)} `; } } What is the appropriate way to select all nodes with class "name"? I have tried the following ways, but failed ; all times nodesList was undefined : Inside constructor : this

Rust WebAssembly Custom Elements Memory Deallocation Error

梦想的初衷 提交于 2019-12-13 15:08:06
问题 My first Rust-produced WASM is producing the following error, I have no idea how to go about it debugging. wasm-000650c2-23:340 Uncaught RuntimeError: memory access out of bounds at dlmalloc::dlmalloc::Dlmalloc::free::h36961b6fbcc40c05 (wasm-function[23]:670) at __rdl_dealloc (wasm-function[367]:8) at __rust_dealloc (wasm-function[360]:7) at alloc::alloc::dealloc::h90df92e1f727e726 (wasm-function[146]:100) at <alloc::alloc::Global as core::alloc::Alloc>::dealloc::h7f22ab187c7f5835 (wasm

HTML5 Video - Shadow DOM - Change CSS styles

蓝咒 提交于 2019-12-13 08:09:53
问题 I want to style the slider thumb of video control in Chrome. The css path video::-webkit-media-slider-thumb doesn't work. Playground: http://jsfiddle.net/holden321/27fUR/ 回答1: Here you go :) video::-webkit-media-controls-timeline::-webkit-media-slider-thumb { background:red; /* works */ } That's because slider-thumb is "child" of timeline :) 来源: https://stackoverflow.com/questions/24610177/html5-video-shadow-dom-change-css-styles

Accessing a div inside of a Polymer element template

送分小仙女□ 提交于 2019-12-12 23:07:35
问题 I'm trying to use core-animation on a div, to animate its position. To do that, i have to select it with document.getElementById(). The problem is, i have a rather complex structure in my index.html file and i can't find a way to select that div. Here's index.html structure (i need to select #el): http://i.imgur.com/phWyArO.jpg My index.html file: <template is="auto-binding" id="t"> <!-- Route controller. --> <flatiron-director route="{{route}}" autoHash></flatiron-director> <!-- Keyboard nav

Is there a way to use scripts in Shadow DOM with strict Content Security Policy?

a 夏天 提交于 2019-12-12 12:38:27
问题 Part of the new Web Components spec is Shadow DOM - a way of embedding <style> and <script> resources with the component HTML itself. As I understand the spec the Shadow DOM mimics how many existing controls already exist in most of the browsers - for instance a browser's native video player will have buttons and styles internally that are part of the control's DOM. However, this appears to clash with Content Security Policy which disables eval and inline scripting. A simple example (which