Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Error while using customElements.define in content script of a chrome extension

I'm developing a chrome extenion for which I need to implement a shadowDOM into the web page. Here is the code I use inside the content script:

class MyWebComponent extends HTMLElement {
  constructor() {
      super();
      this.attachShadow({ mode: "open" });
  }
  connectedCallback() {
      this.shadowRoot.innerHTML = `
          <p>I'm in the Shadow Root!</p>
      `;
  }
}

window.customElements.define("my-web-component", MyWebComponent);

But it is throwing the following error: Cannot read properties of null (reading 'define')

What is the issue here? how to overcome this error?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!