I have a custom element that contains a <paper-card> element. I want to listen for clicks on the header of that element, i.e. the <div class="header"> element.
My current solution looks like this
<paper-card heading="[[title]]" on-tap="onCardClick">
...
</paper-card>
onCardClick(e){
if( e.path[0].classList.contains('header') || e.path[0].classList.contains('title-text') ){
// Header was clicked
}
}
but it feels hacky.
Is there a better way of doing this?
I would suggest separating the header element like
with the original CSS:
It has exactly the same effect as you use the
headingattribute but is more flexible.