shadow-dom

Accessing the parent context of a web component being either DOM or Shadow DOM

喜你入骨 提交于 2019-12-05 14:05:36
Context: I am carrying out tests about web component composition in different contexts. Particularly I am trying to relate several web component by getting access to one of them from another one by a searching process within the DOM / Shadow DOM of the involved components. Problem: Let's suppose we have a web component named x-foo requiring to access another one x-randgen . The latter component exposes business methods used by the former. In order to avoid a tightly coupled communication between both components I would like to use a discovery mechanism in x-foo to access x-randgen through a

anchor tag <a id=“jump”> with hash inside shadow dom

拥有回忆 提交于 2019-12-05 12:20:47
I would like to use an anchor-element with a hash-URL inside of a custom element that uses shadow DOM. I would expect, that the browser scrolls down to that anchor, but it does not do it (at least Chrome). Detail: I have an index.html like this: ... <a href="#destinationInsideShadowDOM">Jump</a> ... <my-custom-element></my-custom-element> ... And another html-file for the custom-element, which contains the anchor: <template id="my-custom-element"> ... <a id="destinationInsideShadowDOM"></a> ... </template> I want the browser to scroll down to that anchor when I click on the link in index.html.

What does Shadow DOM let us achieve?

青春壹個敷衍的年華 提交于 2019-12-05 08:50:35
I think shadow DOM lets us achieve style encapsulation and also hiding HTML implementation of the component. But when I inspect shadow root in chrome I can see the HTML of the component. So what exactly does it help us to achieve? Is it only style encapsulation? Sure, the DevTools allow you to investigate the shadow DOM but if you get the HTML for index.html querySelector('body').innerHTML the shadow DOM of the elements is not included. You explicitly need to switch to the shadow DOM of a custom element to get access to that HTML. Shadow DOM is not about hiding your elements implementation

Access shadow DOM properties (polymer) with javascript/jquery?

前提是你 提交于 2019-12-05 03:00:39
I'm currently using polymer's core-scaffold & co. to create an header/sidebar with a content area. I'm currently having the problem that I cannot access certain properties of the content element, such as scrollTop. (since the actual scrollTop property that I need to access is defined in the shadow DOM.) This conflicts with a lazyload jquery plugin I'm using. The plugin is checking the window.scrollTop but changing the plugin to check the scrollTop of my content (that scrolls instead of the window) won't have any affect, since the scrollTop is "hidden" in the shadow DOM. Is there a way to

Light DOM style leaking into Shadow DOM

牧云@^-^@ 提交于 2019-12-05 01:20:43
问题 I am trying to create a Chrome extension with a floating widget. To do that, I have to isolate my element from the rest of the page. Shadow DOM looks like a perfect fit for that, but it isn't doing what I expected. Here is my content script: content.js var lightDom = document.createElement('style'); lightDom.innerText = 'div { color: red }'; document.body.appendChild(lightDom); var shadowDom = document.createElement('div'); document.body.appendChild(shadowDom); var shadowRoot = shadowDom

Inspect HTML5 date picker shadow DOM

自闭症网瘾萝莉.ら 提交于 2019-12-04 22:28:26
I'm trying to inspect the shadow DOM for certain HTML5 controls, like the date picker for the input type="date" and the actual suggestion dropdown list for inputs bound to a datalist . Preferably in Chrome, but other browsers will do too. I've found that by enabling the Shadow DOM setting in Chrome's inspector options allows me to inspect the shadow DOM for the actual input (which includes the ::-webkit-calendar-picker-indicator arrow to show the datepicker) but not the datepicker itself: The same goes for the datalist . It appears as these controls are not part of the input, but I also can't

Does IOS Safari support Shadow DOM?

拈花ヽ惹草 提交于 2019-12-04 20:41:17
问题 My application is able to render the Shadow DOM, but the inspector cannot display the shadow root. Can anyone help me out on this? 回答1: It depends on which Shadow DOM you mean—Shadow DOM v0 or Shadow DOM v1. See http://caniuse.com/#feat=shadowdomv1 and http://caniuse.com/#feat=shadowdom No version of Safari supports Shadow DOM v0. But as far as iOS Safari, version 10.2+ support Shadow DOM v1 with the following limitation: Certain CSS selectors do not work ( :host > .local-child ) and styling

Selenium Webdriver with Shadow DOM

独自空忆成欢 提交于 2019-12-04 19:43:41
While using Selenium Webdriver in C#, I get an exception when trying to select an element that exists under Shadow DOM. The exception I am getting is: NoSuchElementException How would you suggest to use Selenium with Shadow DOM? Thanks, Michal Try to locate your element like this: driver.FindElement(By.CssSelector('selector_otside_shadow_root /deep/ selector_inside_shadow_root')); in your case it would be: driver.FindElement(By.CssSelector('app-home /deep/ #itemName1')); You can test this approach in chrome://downloads/ link with this css_selector : downloads-manager /deep/ downloads-item

Why doesn't Font Awesome work in my Shadow DOM?

非 Y 不嫁゛ 提交于 2019-12-04 15:39:33
Font Awesome is not working in my shadow DOM since I have the following in it to prevent styles from leaking in and out: :host { all: initial; /* 1st rule so subsequent properties are reset. */ display: block; contain: content; /* Boom. CSS containment FTW. */ } I'm able to use other stylesheets by just inlining them within the :host property, but that doesn't work with Font Awesome since it uses relative paths in its stylesheet. I found this post and tried it with the scoped CSS I implement, but the icons show as squares, as can be seen in my example . I had the same issue with StencilJS.

Extending <option>

偶尔善良 提交于 2019-12-04 12:53:45
I'm trying to extend the HTMLOptionElement , <template id="cOptionTemplate"> <content></content> </template> <select> <option is="custom-option">Test</option> </select> var cOption = document.registerElement('custom-option', { prototype: Object.create(HTMLOptionElement.prototype, { createdCallback: { value: function() { var template = document.getElementById("cOptionTemplate") var clone = document.importNode(template.content, true); this.createShadowRoot().appendChild(clone); } }, attributeChangedCallback: { value: function (attrName, oldVal, newVal){ switch(attrName){ case "attr1": console