shadow-dom

How to interact with the elements within #shadow-root (open) while Clearing Browsing Data of Chrome Browser using cssSelector

旧城冷巷雨未停 提交于 2019-12-02 09:07:14
I had been following the discussion How to automate shadow DOM elements using selenium? to work with #shadow-root (open) elements. While in the process of locating the Clear data button within the Clear browsing data popup, which appears while accessing the url chrome://settings/clearBrowserData through Selenium I am unable to locate the following element: #shadow-root (open) <settings-privacy-page> Snapshot: Using Selenium following are my code trials and the associated errors encountered: Attempt 1: WebElement root5 = shadow_root4.findElement(By.tagName("settings-privacy-page")); Error:

Custom Element getRootNode.closest() function crossing multiple (parent) shadowDOM boundaries

▼魔方 西西 提交于 2019-12-02 08:28:10
问题 I spent some time searching but have only seen too many regular "walk the DOM" blogs or answers that only go one level UP with getRootnode() Pseudo code: HTML <element-x> //# shadow-root <element-y> <element-z> //# shadow-root let container = this.closest('element-x'); </element-z> </element-y> </element-x> The standard element.closest() function does not pierce shadow boundaries; So this.closest('element-x') returns null because there is no <element-x> within <element-z> shadowDom Goal: Find

webcomponents - hide dropdown menu on window.onclick

泄露秘密 提交于 2019-12-02 08:01:52
dropdown menu is created in shadowDOM almost perfect, but the problem is how to hide the dropdown menu when click on any where else in window class NavComponent extends HTMLElement { constructor() { super(); let template = document.currentScript.ownerDocument.querySelector('template'); let clone = document.importNode(template.content, true); let root = this.attachShadow({ mode: 'open' }); root.appendChild(clone); } connectedCallback() { let ddc = this.shadowRoot.querySelectorAll('.dropdowncontainer') let dd = this.shadowRoot.querySelectorAll('.dropdown'); let ddc_length = ddc.length for (let

CSS selector for shadow root or all top level elements in shadow root

柔情痞子 提交于 2019-12-02 06:22:37
I need a selector for usage in css inside a shadow root, which selects all children (but not grand children) of the shadow root, no matter what tag they are and without giving them an ID. In the example below, SPAN,A,P and DIV should get a red border, but SPAN IN DIV not. <my-element> #shadow-root <span>SPAN</span> <a>A</a> <p>P</p> <div> DIV <span>SPAN IN DIV</span> </div> <style> :root>*{border:1px red solid;} </style> </my-element> I hoped, the :root -Selector would do the job inside of a shadow dom, but thats not the case. It would also be a possible solution if someone shows how to set an

Why do pseudoclasses on the host element have to be inside of the host function?

自作多情 提交于 2019-12-02 05:01:44
问题 I do not understand why pseudo classes like :focus-within need to be within the :host() function brackets when acting on the host itself. Why can it not be :host:focus-within div ? It's even more weird that it works on :host inside of another :host() . class MyElementFail extends HTMLElement { constructor(...args) { super(...args) this.attachShadow({mode: 'open'}).innerHTML = ` <style> :host{ display: block; padding: 20px; background-color: salmon; } :host div{ background-color: white; } /

styling polymer element in angular2

故事扮演 提交于 2019-12-02 04:51:12
问题 I want to include Polymer Elements into my angular2 App since Angular2 Material still doesn't provide enough elements. Additionally, I want to style the element, i.e. setting the width of it. I have <paper-dropdown-menu class="dropdown" label="Wiederholung" vertical-align="bottom" horizontal-align="right"> <paper-listbox class="dropdown-content"> <paper-item>einmalig</paper-item> <paper-item>wöchentlich</paper-item> <paper-item>monatlich</paper-item> </paper-listbox> </paper-dropdown-menu>

how to call a jquery plugin from inside an angular.dart component?

橙三吉。 提交于 2019-12-02 01:41:42
I am learning about angular.dart components by trying to make one that will access an existing jquery plugin. I am trying something like the following: library mylib; import 'dart:html'; // querySelector import 'package:js/js.dart'; // javascript import 'package:angular/angular.dart'; @NgComponent( selector: 'aSelector', templateUrl: 'partial.html', cssUrl: 'style.css', publishAs: 'ctrl', map: const { 'param': '=>param' } ) class myComponent extends NgShadowRootAware { String param; Compiler compiler; Injector injector; Scope scope; MyComponent(this.compiler, this.injector, this.scope); void

How do we detect if a shadow root was made with v0 or v1 API?

旧城冷巷雨未停 提交于 2019-12-02 01:31:59
问题 Suppose a JS module exports shadowRoot which was created with either el.createShadowRoot or el.attachShadow (we don't know which). How do we detect if the root is a v0 shadow root or a v1 shadow root (i.e. how do we detect which method was used to create the root)? f.e., What would I fill in the following conditional statements? // for argument's sake, we don't create the root, we only get a reference // to it: import shadowRoot from 'somewhere' function getShadowRootVersion(root) { if ( ...

styling polymer element in angular2

别说谁变了你拦得住时间么 提交于 2019-12-02 00:31:42
I want to include Polymer Elements into my angular2 App since Angular2 Material still doesn't provide enough elements. Additionally, I want to style the element, i.e. setting the width of it. I have <paper-dropdown-menu class="dropdown" label="Wiederholung" vertical-align="bottom" horizontal-align="right"> <paper-listbox class="dropdown-content"> <paper-item>einmalig</paper-item> <paper-item>wöchentlich</paper-item> <paper-item>monatlich</paper-item> </paper-listbox> </paper-dropdown-menu> EDIT in my index.html I have <!-- polymer components --> <script src="/node_modules/bower_components

How do we detect if a shadow root was made with v0 or v1 API?

一笑奈何 提交于 2019-12-01 21:24:04
Suppose a JS module exports shadowRoot which was created with either el.createShadowRoot or el.attachShadow (we don't know which). How do we detect if the root is a v0 shadow root or a v1 shadow root (i.e. how do we detect which method was used to create the root)? f.e., What would I fill in the following conditional statements? // for argument's sake, we don't create the root, we only get a reference // to it: import shadowRoot from 'somewhere' function getShadowRootVersion(root) { if ( ... ) return 'v0' if ( ... ) return 'v1' } console.log(getShadowRootVersion(shadowRoot)) // should output