Commit 79baebc1 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

Setup onclick handlers when attaching to DOM

When the connectedCallback is called on the panel item custom
element, set any button onclick handlers since they could have
been null'ed out if the panel item was removed from the DOM.

Bug: 1009318
Change-Id: I621bf1bcda85c877c1c52a182474e6ec294c63ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832188
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701450}
parent fb5bcba1
...@@ -369,6 +369,16 @@ class PanelItem extends HTMLElement { ...@@ -369,6 +369,16 @@ class PanelItem extends HTMLElement {
*/ */
connectedCallback() { connectedCallback() {
this.onclick = this.onClicked_.bind(this); this.onclick = this.onClicked_.bind(this);
// Set click event handler references.
let button = this.shadowRoot.querySelector('#primary-action');
if (button) {
button.onclick = this.onclick;
}
button = this.shadowRoot.querySelector('#secondary-action');
if (button) {
button.onclick = this.onclick;
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment