home.social

#domparser — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #domparser, aggregated by home.social.

  1. RE: lascapi.fr/blog/2026/03/02/cre

    Hi! A big #question for #webdev

    // Context: a #Tauri application written in plain #JavaScript.

    I used the #DOMParser to read an HTML file and display it as #Markdown.
    For unit testing, I use #MochaJs, and I wanted to run the tests in the command line interface (CLI) with #nodejs.
    However, Node.js does not have the DOMParser library. :/

    I then used jsdom to develop the function in a behaviour-driven development style, but this cannot be run in a browser.

    I now realise that trying to test this functionality in this way is not a good idea.

    What can I use instead? ??

    You're welcome to #boost or ask for clarifications. :)

  2. #JavaScript, such a lovely programming environment

    Writing some unit tests for a **browser** app which must parse historic XML (WebDAV result) I stumble upon

    ReferenceError: DOMParser is not defined

    It would be no problem in the browser itself, but the tests were supposed to run without browser. And node has no DOMParser, I just learned.

    No problem, jsdom seems to be the library to go with. But then: npm.anvaka.com/#/view/2d/jsdom

    45 dependencies😱

    #jsdom #unittest #domparser #node #browser