custom-element

:host:defined doesn't work, :host(:defined) works [duplicate]

六月ゝ 毕业季﹏ 提交于 2020-01-30 07:00:15
问题 This question already has answers here : Why do pseudoclasses on the host element have to be inside of the host function? (2 answers) Closed 5 months ago . Is it not possible, or not allowed, to combine :host and :defined in CSS, while combining the latter with the :host() pseudoclass works? As you can see in below example, the following :host:defined { display: block; } does not work, while :host(:defined) { display: block; } works. class CustomElement extends HTMLElement { constructor() {

:host:defined doesn't work, :host(:defined) works [duplicate]

懵懂的女人 提交于 2020-01-30 06:59:04
问题 This question already has answers here : Why do pseudoclasses on the host element have to be inside of the host function? (2 answers) Closed 5 months ago . Is it not possible, or not allowed, to combine :host and :defined in CSS, while combining the latter with the :host() pseudoclass works? As you can see in below example, the following :host:defined { display: block; } does not work, while :host(:defined) { display: block; } works. class CustomElement extends HTMLElement { constructor() {

CSS Selector for a partial CustomElement nodename

我们两清 提交于 2020-01-24 20:40:48
问题 Update: Went for a different solution: <img is=queen-of-hearts> Live at: https://card-ts.github.io/playingcardts this question is about working around CSS Selector limitations So my Custom Elements now make true symantic HTML: Displaying: no external SVG files, all 500KB SVG is (manually) slimmed and LZMA packed to 70KB into ONE Custom Element all 52 cards (Custom Elements) are then created with Supersharps class factory code Next problem arises... What selectors to use? I can do : Queen-of

Access class function in Web Component from inline Element

女生的网名这么多〃 提交于 2020-01-24 12:54:08
问题 I want to execute a defined class function from an Element inside my Web Component: customElements.define('first-component', class FirstComponent extends HTMLElement { constructor() { super(); } log() { console.log('Well Done!') } connectedCallback() { this.innerHTML = '<button onclick="log()">Do it</button>' } }); State right now: ReferenceError: log is not defined 回答1: With parentElement, or closest() In order to call the log() method of the custom element, you'll have to get a reference on

How can I dynamically change the shape of a clr-icon custom element?

耗尽温柔 提交于 2020-01-23 09:21:25
问题 In the Clarity Icon docs they show that you can use the shape attribute to set the icons shape like this: <clr-icon shape="info-circle" size="16"></clr-icon> In my angular template I am using a clr-icon element like this: <clr-icon [shape]="myShape"></clr-icon> And use my component to set the string value of the shape bound to myShape : export class MyComponent { public myShape = 'volume-up'; changeShape() { if(this.myShape === 'volume-up') { this.myShape = 'volume-mute'; return; } this

HTML Import webcomponents polyfill not working in firefox

ⅰ亾dé卋堺 提交于 2020-01-22 03:13:15
问题 I am trying webcomponents in a sample app. Since some of the specs are not included in some browsers, i tried using polyfill for those. In Mozilla firefox, i tried by enabling the key dom.webcomponents.enabled and adding some polyfills (that are not in browser). I have used HTML Import polyfill from webcomponents.js polyfill. Still HTMLImport is not working in firefox, internet explorer (even with polyfill). (https://github.com/webcomponents/webcomponentsjs) I also tried customElements v1

Attaching shadow DOM to a custom element removes error, but why?

两盒软妹~` 提交于 2020-01-15 11:25:50
问题 Per the custom element specification, The element must not gain any attributes or children, as this violates the expectations of consumers who use the createElement or createElementNS methods. Both Firefox and Chrome correctly throw an error in this situation. However, when attaching a shadow DOM, no error is present (in either browser). Firefox: NotSupportedError: Operation is not supported Chrome: Uncaught DOMException: Failed to construct 'CustomElement': The result must not have children

paper-dropdown-menu not working in a lit-element

▼魔方 西西 提交于 2020-01-15 09:13:49
问题 Edit : Turns out, it helps if you import paper-listbox before using it in another element. For some reason I thought it was being imported as a dependency on another element I was importing, but no. As soon as I added the explicit import, it began working correctly. Original question follows. To start, this problem only happens when using paper-dropdown-menu (with paper-listbox inside) in a lit-element . We're using the component in almost the exact same way in multiple PolymerElement (s)

Cannot access attributes of a custom element from its constructor

删除回忆录丶 提交于 2020-01-09 11:39:13
问题 I'm trying to create a polyfill of sorts using the Custom Elements API for custom elements used by an in-game browser engine to display buttons and similar. However, I can't seem to access the element's attributes (eg. src, href ...) from within the constructor. Here is an example: class KWButton extends HTMLElement { constructor() { super(); var attributes = this.attributes; var shadow = this.attachShadow({ mode: 'open' }); var img = document.createElement('img'); img.alt = this.getAttribute

Angular Elements Output not working in IE11

戏子无情 提交于 2020-01-01 10:16:30
问题 I try to get Angular Elements working in IE11. My custom element (simple button) is already displayed and the input binding is working as expected, but the output binding doesn't. A click on my custom element button in IE 11 results in the error: The object doesn't support this action What I have done so far: Remove polyfill for custom elements that was added with ng add @angular/elements (didn't work properly with IE) Update all Angular packages to 7.2.1 Add the following polyfillls to