Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda