shadow-dom

Need help understanding the Shadow DOM

元气小坏坏 提交于 2019-11-28 00:12:44
问题 Reading through articles and tutorials about the Shadow DOM, I came across a description which confused me a bit: "Shadow DOM refers to the ability of the browser to include a subtree of DOM elements into the rendering of a document, but not into the main document DOM tree." So a Shadow tree is not part of the DOM tree? But the browser will still see it and render its contents? 回答1: From the Shadow DOM spec, A document tree is a node tree whose root node is a document. Any element can host

Style html,body from web component (Angular 2)

与世无争的帅哥 提交于 2019-11-27 19:59:15
I'm working on a LoginComponent in Angular 2 that should "restyle" the html and body tags, so I can put in a background image specific for the login page. But just adding a style for the html, body in my login.css doesn't seem to work. Is there a way to override the style on the html, body from a component? Or any element for that matter. I've tried things like: :host(.btn) { ... } :host(.btn:host) { ... } .btn:host { ... } to style an element from outside the Login component. But nothing seems to work. You could try body { /* body styles here */ } but styles in components are not supposed to

What do /deep/ and ::shadow mean in a CSS selector?

依然范特西╮ 提交于 2019-11-27 18:39:46
In looking at Polymer, I see the following CSS selector in the Styles tab of Chrome 37's developer tools: I've also seen a selector with pseudo selector ::shadow . So, what do /deep/ and ::shadow in a CSS selector mean? Drew Noakes As Joel H. points out in the comments, Chrome has since deprecated the /deep/ combinator, and it gives a syntax error in IE. HTML5 Web Components offer full encapsulation of CSS styles. This means that: styles defined within a component cannot leak out and effect the rest of the page styles defined at the page level do not modify the component's own styles However

Share style across web components “of the same type”

拜拜、爱过 提交于 2019-11-27 15:20:52
If I understand it correctly, creating an instance of a web component can be summed up as creating a shadow root and copying the markup, e.g. from a template into it: var Template = document.querySelector('#myTemplate'); var TemplateClone = document.importNode(Template.content,true); TargetElement.appendChild(TemplateClone); Of course, if the template contains css rules in a style-tag, those will be copied as well. Thus we can have scoped styles which belong to the internal markup of a web component. Questions: Does it have any performance implications when I create tons of instances of the

Data-binding between nested polymer elements

人盡茶涼 提交于 2019-11-27 14:07:08
问题 Suppose I have two distinct polymer-elements One should be embedded inside the other using the content placeholder. Is it possible to do data-binding between these two nested polymer-elements ? I tried, but I can't get it to work: http://jsbin.com/IVodePuS/11/ According to http://www.polymer-project.org/articles/communication.html#binding data-binding between polymer-elements should work (in those examples they were done inside the template tag without using a content placeholder). Update:

Render content between the component tags

浪尽此生 提交于 2019-11-27 12:04:35
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 here </p-footer> </p-dialog> As Header content here , Content and Footer content here are inside the

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

痴心易碎 提交于 2019-11-27 11:38:46
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"; } 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-button { opacity: 1; } As stated above, this will likely only work in Chrome. So be careful using this code

How can I tell if an element is in a shadow DOM?

前提是你 提交于 2019-11-27 11:10:14
问题 I have a project where I'm using the shadow DOM natively (not through a polyfill). I'd like to detect if a given element is contained within a shadow DOM or a light DOM. I've looked through all of the properties on the elements, but there don't seem to be any which vary based on the type of DOM an element is in. How can I determine if an element is part of a shadow DOM or a light DOM? Here is an example of what is considered "shadow DOM" and "light DOM" for the purpose of this question.

Accessing elements in the shadow DOM

六月ゝ 毕业季﹏ 提交于 2019-11-27 09:06:32
Is it possible to find elements inside the Shadow DOM with python-selenium? Example use case: I have this input with type="date" : <input type="date"> And I'd like to click the date picker button on the right and choose a date from the calendar. If you would inspect the element in Chrome Developer Tools and expand the shadow-root node of the date input, you would see the button is appearing as: <div pseudo="-webkit-calendar-picker-indicator" id="picker"></div> Screenshot demonstrating how it looks in Chrome: Finding the "picker" button by id results into NoSuchElementException : >>> date_input

selenium webdriver (chromedriver) and accessing shadow dom

心不动则不痛 提交于 2019-11-27 08:28:44
问题 I'm testing out a new application that uses shadow dom like so: #shadow-root (open) <div class="th_filePicker"> <div class="th_fp_header"> <div class="th_fp_title" role="heading" aria-level="1" data-l10n-id="th_fp_title">Select Image</div> <div class="th_fp_Close"><button class="close-popup" data-l10n-id="close_popup" title="Close"></button></div> </div> </div> Does anyone have any idea on how I can access the elements in the file picker control - specifically, the close icon? 回答1: One way