If you are interested in server side rendering, then both and LinkeDOM are better choices. If you are trying to run code in a “virtual” browser that needs to be standards based, then it is possible that jsdom is suitable for you.
While jsdom works under the Deno CLI, it does not type check. This means you have to use the option on the command line to avoid diagnostics stopping the execution of your programme.
This means if you want strong typing and intelligent auto-completion in your editor while using the Deno language server, you have to perform some extra steps.
Defining an
You need to map the bare specifier to the imported version of jsdom. This allows Deno to correctly apply the types to the import in the way they were specified.
Setting up a configuration file
This example will take a test string and parse it as HTML and generate a DOM structure based on it. It will then query that DOM structure, picking out the first heading it encounters and print out the text content of that heading: