shadow-dom

Custom elements not detecting children when instantiated in template of another custom element

放肆的年华 提交于 2019-12-08 03:31:32
I have an RPG Main HTML Element defined as follows. I'm instantiating it in the body of my index.html file. <link rel="import" href="packages/polymer/polymer.html"> <link rel="import" href="gridlayout.html"> <link rel="import" href="gridtile.html"> <polymer-element name="rpg-main" attributes=""> <template> <style> grid-tile { background: #FF00FF; width: 50px; height: 50px } :host { position: absolute; display: block; width: 500px; height: 500px; } </style> <grid-layout rows = "2" cols = "2" spacing = "50px"> <grid-tile> </grid-tile> <grid-tile> </grid-tile> <grid-tile> </grid-tile> <grid-tile>

Shadow DOM, aim of using it

本小妞迷上赌 提交于 2019-12-07 11:27:21
问题 I have studied Shadow DOM recently, and I was wondering what are the aims of using it instead of the main one. What does it gives ? Why dont we use standard DOM instead of it (except for styling scoping) ? 回答1: It allows you to encapsulate functionality, effectively putting it in a black box. It means you can create [reusable] components whose inner workings aren't exposed; this is impossible using standard DOM. As an example, take HTML input elements. So, say, the file type of input. To use

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

本秂侑毒 提交于 2019-12-07 09:35:31
问题 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

document.querySelector() returns null

偶尔善良 提交于 2019-12-06 18:34:51
问题 I'm creating a polymer element. I've made the template and am now working on the script. For some reason document.querySelector is returning null for both class and id selectors. Not sure if this doesn't work with polymer (no reason it shouldn't) or I haven't imported something or what else is wrong. event-card.html <link rel="import" href="../components/polymer/polymer.html"> <link rel="import" href="event-card-description.html"> <polymer-element name="event-card" attributes="header image

Inspect HTML5 date picker shadow DOM

拈花ヽ惹草 提交于 2019-12-06 18:29:46
问题 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

AngularDart NgComponent using event listeners in the controller

扶醉桌前 提交于 2019-12-06 12:42:25
I have an NgComponent in Angular Dart which instantiates a search box and according to the query strings it populates another div in my html template with the ng-repeat directive. More precisely, Query string update: there is a binding to the input text value with a field in my components' controller. Results population: In the attach() method I added a watcher for the local field which acts as a model to the input box, and whenever it changes I add to a local list some items which then acts as a model to the ng-repeat directive in another div. So far everything works fine. But now I want to

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

半城伤御伤魂 提交于 2019-12-06 11:45:53
问题 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,

CSS: How to target ::slotted siblings in Shadow DOM root?

蓝咒 提交于 2019-12-06 11:14:53
I know that the spec currently only allows compound selectors for ::slotted, i.e. ::slotted(my-first + my-second) is not allowed, but should something like this be working? ::slotted(x-first) + ::slotted(x-second) { /* css */ } Is there any way to target slotted siblings (other than with global css)? And if not, where would I file such a request? Thanks. Sure you can select siblings of slots / slotted . The thing you can not do is select a element which has been slotted and is not a top-level node . Select siblings: slot[name=<slotname>] ~ <selector> Select slotted top-level node ::slotted(

JavaScript within Shadow DOM best practices

て烟熏妆下的殇ゞ 提交于 2019-12-06 02:23:57
问题 I'm having trouble getting JavaScript to run properly within Shadow DOM elements I'm defining. Given the following code: <template id='testTemplate'> <div id='test'>Click to say hi</div> <script> var elem = document.querySelector('#test'); elem.addEventListener('click', function(e) { alert("Hi there"); }); </script> </template> <div id="testElement">Host text</div> <script> var shadow = document.querySelector('#testElement').createShadowRoot(); var template = document.querySelector('

How to set CKEditor 5 height

安稳与你 提交于 2019-12-05 20:50:10
Using CKeditor angular component How to set the editor height? According to the docs, it can be done by setting the editor style to: min-height: 500px !important; But it doesn't work! Maciej Bukowski If you add it to the global stylesheet the following should work: .ck-editor__editable_inline { min-height: 500px !important; } But if you want to style through the component.css you need to type this: :host ::ng-deep .ck-editor__editable_inline { min-height: 500px !important; } 来源: https://stackoverflow.com/questions/52485000/how-to-set-ckeditor-5-height