Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
Failed to execute 'createNodeIterator' on 'Document': parameter 1 is not of type 'Node'. - lwc

I'm working with lightning web components (lwc) from Salesforce.

I'm trying to load this library as Static Resource to use it in one of my components, in order to sanitize some data -> DOMPurify . I'm using just the min js file.

import { loadStyle, loadScript } from 'lightning/platformResourceLoader';
import DOMPURIFY from '@salesforce/resourceUrl/DOMPurifyMin'

export default class classNameHere extends LightningElement {

DOMPurifyInitialized = false

renderedCallback() {
        if (this.DOMPurifyInitialized) {
            return;
        }
        this.DOMPurifyInitialized = true;
        Promise.all([
            loadScript(this, DOMPURIFY)
        ])
            .then(() => {
                this.initDOMPurify()
            })
            .catch((error) => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error loading this',
                        message: error.message,
                        variant: 'error'
                    })
                );
            });
    }

    initDOMPurify() {
        console.log('inside initDom')
        console.log(DOMPurify.sanitize(`<img src=x onerror=alert(1)//>`))
    }

}

I can reach initDOMPurify, but then it fails in that second console.log() that uses DOMPurify.

Error message in catch block: Failed to execute 'createNodeIterator' on 'Document': parameter 1 is not of type 'Node'.

Any ideas? I haven't found much information about this kind of error.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda