node is not instanceof HTMLElement when imported from uhtml v3
See original GitHub issueI 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:
- Created a year ago
- Comments:7 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It was a uparser issue which has now been fixed (and covered).
Apologies for the inconvenient.
Thanks for the quick fix, @WebReflection ❤️