You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works great when a page has elements that match that query selector. But for a page that doesn't match the query selector, I get the following exception.
Uncaught TypeError: node.getAttribute is not a function
Uncaught TypeError: node.getAttribute is not a function
at getDateAttribute (dom.ts?670d:9)
at eval (realtime.ts?6dbd:63)
at Array.forEach ()
at Module.render (realtime.ts?6dbd:62)
This assumes that if there's no length property, then it's a node and not a node list. However, if a node list is empty, the nodes.length returns 0 which is interpreted as false, which then falls back to the [nodes] clause, thus creating an array consisting of one empty node list.
I think the correct behavior would be to change this to:
Thanks for this great library! I found a potential bug with it though.
Suppose I have the following script that loads on every page.
It works great when a page has elements that match that query selector. But for a page that doesn't match the query selector, I get the following exception.
Uncaught TypeError: node.getAttribute is not a function
The bug seems to be this line:
This assumes that if there's no
length
property, then it's a node and not a node list. However, if a node list is empty, thenodes.length
returns0
which is interpreted as false, which then falls back to the[nodes]
clause, thus creating an array consisting of one empty node list.I think the correct behavior would be to change this to:
The text was updated successfully, but these errors were encountered: