web-components-examples icon indicating copy to clipboard operation
web-components-examples copied to clipboard

this.shadowRoot is not defined

Open SakshiShreya opened this issue 1 year ago • 3 comments

https://github.com/mdn/web-components-examples/blob/712ce27cd5b3c894ebc9b9958ec0973e3e86157b/slotchange/main.js#L40

this.shadowRoot Remove this. as this.shadowRoot is null and shadowRoot is already defined

SakshiShreya avatar Jan 31 '24 08:01 SakshiShreya

Can I please work on this.

SakshiShreya avatar Jan 31 '24 08:01 SakshiShreya

Thanks for reporting. @pepelsbey worked on this one recently, and I believe it worked then. Could you share some info about the browser version you're trying this on?

bsmth avatar Feb 22 '24 12:02 bsmth

@SakshiShreya I checked the demo (source, live) and it works the same way and with no errors in both cases:

  1. this.shadowRoot.querySelectorAll('slot')
  2. shadowRoot.querySelectorAll('slot')

Could you show the steps to reproduce the error? Otherwise, it would be a stylistic preference and not that important to the example. I’d rather replace <li>s with <button>s to make the demo more accessible :) But that’s another story.

pepelsbey avatar Feb 27 '24 12:02 pepelsbey