You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have JSBin example (http://jsbin.com/wahapu/3/edit?html,console,output) where there are 3 custom elements. When they are declared declaratively I can catch the event as expected from the parent elements, but when I declare an element imperatively and force the event to fire the parent elements do not pick it up.
Although this example is useless it self, I found this problem with one of my projects where I had a "sign-out" event fired from an custom ajax element when the token expired. I like to use the ajax element imperatively rather then declaratively since nothing is rendered on the screen and I can read those elements that render easier in the template section.
The text was updated successfully, but these errors were encountered:
You need to add the created element to the DOM for its events to bubble. Just calling new elementThree() doesn't automatically append the element to the DOM. In your jsbin sample, add the line document.body.appendChild(target); right after the line var target = new elementThree();
Just a thought: if you're creating and using Polymer elements that in anyway interact with the UI, like for example firing custom events meant to bubble up the DOM that result in the UI changing, I would highly recommend using them declaratively. Otherwise, don't create a custom Polymer element, rather just use a function or class. One of the greatest things about Polymer is that anything that effects or is effected by UI can be declared with HTML.
I have JSBin example (http://jsbin.com/wahapu/3/edit?html,console,output) where there are 3 custom elements. When they are declared declaratively I can catch the event as expected from the parent elements, but when I declare an element imperatively and force the event to fire the parent elements do not pick it up.
Although this example is useless it self, I found this problem with one of my projects where I had a "sign-out" event fired from an custom ajax element when the token expired. I like to use the ajax element imperatively rather then declaratively since nothing is rendered on the screen and I can read those elements that render easier in the template section.
The text was updated successfully, but these errors were encountered: