question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

node is not instanceof HTMLElement when imported from uhtml v3

See original GitHub issue

I upgraded uhtml to v3 in my package.json and then build the library using esbuild.

I import uhtml like so but nodes from tagged html.node are not instanceof HTMLElement. This printed true when I install uhtml@2.8

import {render, html, svg} from 'uhtml'

let node = html.node`<div>Foo`

console.log(node instanceof HTMLElement) //false

Oddly though I tried to test this in a codepen and everything worked as expected.

uhtm@2.8 as well as 3.0 both return the node as instanceof HTMLElement.

// import { html } from "https://unpkg.com/uhtml@2.8.0/esm/index.js?module";

import { html } from "https://unpkg.com/uhtml@3.0.0/esm/index.js?module";

let node = html.node`<div>Foo`

console.log(node instanceof HTMLElement) //true

Not really sure what I am doing wrong or how to better decribe the issue.

Anyways. Not a biggie since we are super happy with uhtml@2.8 but maybe something we can look into at our side.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
WebReflectioncommented, May 9, 2022

It was a uparser issue which has now been fixed (and covered).

Apologies for the inconvenient.

1reaction
vimtaaicommented, May 9, 2022

Thanks for the quick fix, @WebReflection ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross browser solution for checking if a Javascript object is an ...
I use to check the nodeType property, it should be 1 for all HTML element objects. I used it in my crossbrowser library...
Read more >
instanceof - JavaScript - MDN Web Docs
The instanceof operator tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object.
Read more >
Issue with instanceof HTMLElement #4062 - artf/grapesjs
I am trying to integrate https://splidejs.com/ into a custom component type. When initialising Splide it complains about not finding required elements.
Read more >
instanceof Keyword in Java - GeeksforGeeks
instanceof is a keyword that is used for checking if a reference variable is containing a given type of object reference or not....
Read more >
Documentation - DOM Manipulation - TypeScript
The children list does not contain this Node because it is not considered an HTMLElement . The querySelector and querySelectorAll methods. Both of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found