shadow-dom

Shadow DOM CSS Styling from outside is not working in Google Chrome

北慕城南 提交于 2020-01-24 08:53:46
问题 I am using polymer 's paper-action-dialog and paper-button in my web page. There are two paper-buttons in a paper-action-dialog. I want to style those paper-buttons from outside (main html). I have written CSS styles in shadow DOM notation. These styles are working fine in Firefox browser but not behaving correctly in Google-chrome browser. What should I do in order to get that work in chrome.? Mark up <paper-action-dialog class="ask" backdrop autoCloseDisabled=true heading="Heading!"> <p

Customize TestCafe Selector in TypeScript for Shadow root Element

ぐ巨炮叔叔 提交于 2020-01-21 14:38:10
问题 Please help me to define Selector part in TypeScript import { Selector, t } from 'testcafe' fixture `Scenario Name : Validation` .page `https://chrisbateman.github.io/guide-to-web-components/demos/shadow-dom.htm`; const demoPage = Selector('#demo1'); const paragraph = Selector(() => { return demoPageSelector().shadowRoot.querySelectorAll('p'); }, { dependencies: { demoPageSelector: demoPage } }); test('Test ShadowDom', async t => { await t .expect(paragraph.value).eql('Some text'); }); 回答1:

Attaching shadow DOM to a custom element removes error, but why?

两盒软妹~` 提交于 2020-01-15 11:25:50
问题 Per the custom element specification, The element must not gain any attributes or children, as this violates the expectations of consumers who use the createElement or createElementNS methods. Both Firefox and Chrome correctly throw an error in this situation. However, when attaching a shadow DOM, no error is present (in either browser). Firefox: NotSupportedError: Operation is not supported Chrome: Uncaught DOMException: Failed to construct 'CustomElement': The result must not have children

how do I traverse elements within a shadow DOM

前提是你 提交于 2020-01-15 09:09:09
问题 I have div id=outer #shadowRoot div id=inner button In the click handler of the button, I want to reference the div "inner". In a non shadowDom world, this would be document.getElementById('inner') , but what is the equivalent in a shadow DOM world? NB. This is accessing from within the custom-element. I am not trying to pierce the shadow DOM from outside. 回答1: You could use the absolute path: use shadowRoot to get the Shadow DOM content. document.querySelector( 'div#outer' ).shadowRoot

how do I traverse elements within a shadow DOM

﹥>﹥吖頭↗ 提交于 2020-01-15 09:09:04
问题 I have div id=outer #shadowRoot div id=inner button In the click handler of the button, I want to reference the div "inner". In a non shadowDom world, this would be document.getElementById('inner') , but what is the equivalent in a shadow DOM world? NB. This is accessing from within the custom-element. I am not trying to pierce the shadow DOM from outside. 回答1: You could use the absolute path: use shadowRoot to get the Shadow DOM content. document.querySelector( 'div#outer' ).shadowRoot

Shadow DOM and ReactJS

安稳与你 提交于 2020-01-15 06:14:45
问题 I am using web components in my application. And in a web component, I need to insert a react component. Web Component has Shadow DOM. When I try to render the react component using following I get the error. comp = React.createElement(ReactElem, { config: config, onRender: handleRender }); ReactDOM.render(comp , self.shadowRoot.querySelector('#app1')); Error target container is not a dom element I tried to use content of Web component API but then it gets rendered on top rather inside

How to style inner elements of custom Polymer element using external styles?

雨燕双飞 提交于 2020-01-11 09:32:31
问题 Unable to style an element using Shadow DOM with Polymer 1.x or 2.x. Consider the following custom element in Polymer 2.0: <link rel="import" href="../polymer/polymer.html"> <!-- `semantic-ui-button` @demo demo/index.html --> <dom-module id="polymer-button"> <template> <div class$="button {{size}}">{{label}}</div> </template> <script> class MyElement extends Polymer.Element { static get is() { return 'polymer-button'; } static get properties() { return { label: { type: String, value: 'polymer

How to style inner elements of custom Polymer element using external styles?

我们两清 提交于 2020-01-11 09:32:09
问题 Unable to style an element using Shadow DOM with Polymer 1.x or 2.x. Consider the following custom element in Polymer 2.0: <link rel="import" href="../polymer/polymer.html"> <!-- `semantic-ui-button` @demo demo/index.html --> <dom-module id="polymer-button"> <template> <div class$="button {{size}}">{{label}}</div> </template> <script> class MyElement extends Polymer.Element { static get is() { return 'polymer-button'; } static get properties() { return { label: { type: String, value: 'polymer

Using Shadow DOM with polyfills, platform.js and webcomponents.js

雨燕双飞 提交于 2020-01-06 04:11:46
问题 Currently Shadow DOM is supported by only Chrome and Opera (only webkit) and can be optionally enabled in Firefox, it can how ever be used in all browsers using webcomponents.js (https://www.polymer-project.org/0.5/docs/start/platform.html). Is someone already using this? Is it 100% compatible with other non-supported browsers, any help would be appreciated. (Ref link about shadow dom and webcompanents.js: http://webcomponents.org/articles/introduction-to-shadow-dom/) 回答1: After a bit or

Using Shadow DOM with polyfills, platform.js and webcomponents.js

家住魔仙堡 提交于 2020-01-06 04:10:06
问题 Currently Shadow DOM is supported by only Chrome and Opera (only webkit) and can be optionally enabled in Firefox, it can how ever be used in all browsers using webcomponents.js (https://www.polymer-project.org/0.5/docs/start/platform.html). Is someone already using this? Is it 100% compatible with other non-supported browsers, any help would be appreciated. (Ref link about shadow dom and webcompanents.js: http://webcomponents.org/articles/introduction-to-shadow-dom/) 回答1: After a bit or