Skip to content

Commit

Permalink
use getRootNode API for this reference in click handler (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jan 6, 2024
1 parent b303c94 commit 222efaa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class Card extends HTMLElement {
<div>
<h3>${title}</h3>
<img src="${thumbnail}" alt="${title}" loading="lazy" width="100%">
<button onclick="this.parentNode.parentNode.host.selectItem()">View Item Details</button>
<button onclick="this.getRootNode().host.selectItem()">View Item Details</button>
</div>
`;
this.attachShadow({ mode: 'open' });
Expand Down

1 comment on commit 222efaa

@vercel
Copy link

@vercel vercel bot commented on 222efaa Jan 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.