shadow-dom

Override styles in a shadow-root element

纵然是瞬间 提交于 2019-11-26 21:47:24
问题 Is there a way to change styles found in a shadow element? Specifically, extend/overwrite some properties found in a css class ? I am using a chrome-extension called Beanote which hasn't been updated since April(2017) and there's a pesky bug I'd like to fix. I found that one line of css patches it up enough for me, but I am at a loss at applying it without going inside of the shadow element itself and directly editing those styles in the dev tools. I'm looking for a way for this: /*global css

Shadow-dom support for selenium

你说的曾经没有我的故事 提交于 2019-11-26 20:48:20
问题 I am working on an automation project which uses shadow dom extensively. So every time using execute_script function to access shadow root for eg. root = driver.execute_script('return document.querySelector(".flex.vertical.layout").shadowRoot') Then use the root to access the elements within. Since we have shadow roots at many levels, this is annoying me a lot. is there any better solution exist than this to access elements within shadow root? I am using Chrome 2.20 driver. 回答1: By googling I

What is the ::content/::slotted pseudo-element and how does it work?

我只是一个虾纸丫 提交于 2019-11-26 18:23:50
This is impossible to Google for because every article talking about the :before and :after pseudo-elements seems to use the word 'content'. I heard about it in this CSS-Tricks article, explaining how to implement an image slider as an example use-case for web components. The code example it appears inside is thus: CSS #slides ::content img { width: 25%; float: left; } HTML <template> ... <div class="inner"> <content select="img"></content> </div> </template> It seems to be referring to this <content> tag, which is used to allow the user to include Web Components, but I would love to

How to get element in user-agent shadow root with JavaScript?

只愿长相守 提交于 2019-11-26 17:54:54
I need get elements from Shadow DOM and change it. How i can do it? <div> <input type="range" min="100 $" max="3000 $"> </div> Here is an example: var container = document.querySelector('#example'); //Create shadow root ! var root = container.createShadowRoot(); root.innerHTML = '<div>Root<div class="test">Element in shadow</div></div>'; //Access the element inside the shadow ! //"container.shadowRoot" represents the youngest shadow root that is hosted on the element ! console.log(container.shadowRoot.querySelector(".test").innerHTML); Demo: var container = document.querySelector('#example');

Is it possible to always show up/down arrows for input “number”?

泄露秘密 提交于 2019-11-26 15:37:07
问题 I want to always show up/down arrows for input "number" field. Is this possible? So far I haven't had any luck... http://jsfiddle.net/oneeezy/qunbnL6u/ HTML: <input type="number" /> CSS: input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: "Always Show Up/Down Arrows"; } 回答1: You can achieve this (in Chrome at least) by using the Opacity property: input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin

Nested element (web component) can&#39;t get its template

旧巷老猫 提交于 2019-11-26 15:28:44
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"> <app-toolbar></app-toolbar> </template> <script> customElements.define('app-container', class

How to add a component programmatically in Angular.Dart?

≯℡__Kan透↙ 提交于 2019-11-26 15:24:16
I would like to dynamically build a component tree basing on some information received from AJAX calls. How to programmatically add a component to the DOM from inside of other component? I have <outer-comp> and I would like, basing on some logic, insert an <inner-comp> . The following code just inserts the elements <inner-comp></inner-comp> to the DOM, and not actual <inner-comp> representation. @NgComponent( selector: 'outer-comp', templateUrl: 'view/outer_component.html', cssUrl: 'view/outer_component.css', publishAs: 'outer' ) class AppComponent extends NgShadowRootAware { void onShadowRoot

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

荒凉一梦 提交于 2019-11-26 14:43:58
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:

Accessing Shadow DOM tree with Selenium

时光怂恿深爱的人放手 提交于 2019-11-26 12:44:48
问题 Is it possible to access elements within a Shadow DOM using Selenium/Chrome webdriver? Using the normal element search methods doesn\'t work, as is to be expected. I\'ve seen references to the switchToSubTree spec on w3c, but couldn\'t locate any actual docs, examples, etc. Anyone had success with this? 回答1: Unfortunately it looks like the webdriver spec does not support this yet. My snooping uncovered : http://www.w3.org/TR/webdriver/#switching-to-hosted-shadow-doms https://groups.google.com

Polymer share styles across elements

你说的曾经没有我的故事 提交于 2019-11-26 12:33:45
问题 I need to share styles across multiple Polymer elements. Is it acceptable to create a \"styles.html\" file and then import that into my different elements or would this start to have performance implications as the app grows? I know for 0.5 there was a core-styles but it kind of seems unnecessary if imports will work just as well. styles.html <style> button { background: red; } </style> my-button.html <link rel=\"import\" href=\"../bower_components/polymer/polymer.html\"> <link rel=\"import\"