Skip to content Skip to sidebar Skip to footer

Why Doesn't Element Catch Event When Using DispatchEvent From Sibling Polymer Element?

I have the following polymer element in my UI which has two polymer elements, baseline-policy-create and baseline-policy-domain-ajax.

Solution 1:

as Mishu said in comment, events travel up in the hierarchy. So in your baseline-policies-tab you need to catch that event and pass it to baseline-policy-domain-ajax manually.

Some example:

<dom-module id="baseline-policies-tab">
<template>
<style include="dfw-styles">
  :host {
    display: block;
  }
</style>
<baseline-policy-create on-domain-ajax="_onDomainAjax"></baseline-policy-create>
<baseline-policy-domain-ajax></baseline-policy-domain-ajax>
</template>

<script>

class BaselinePoliciesTab extends Polymer.Element {
  static get is() {
    return 'baseline-policies-tab';
  }

  static get properties() {
  }

  _onDomainAjax(e) {
    this.shadowRoot.querySelector("baseline-policy-domain-ajax")._editPage(e);
  }
}
customElements.define(BaselinePoliciesTab.is, BaselinePoliciesTab);

</script>
</dom-module>

Post a Comment for "Why Doesn't Element Catch Event When Using DispatchEvent From Sibling Polymer Element?"