metafizzy / isotope

:revolving_hearts: Filter & sort magical layouts
https://isotope.metafizzy.co
11.03k stars 1.42k forks source link

error in docs example #1654

Open ghost opened 1 year ago

ghost commented 1 year ago

Here is an example from the docs, but this seem wrong as I`m getting an error when running on my local. This example: https://codepen.io/desandro/pen/LYpbOL

When click on "number > 50" or "name ends with –ium" getting this error. error: "index.js:13 Uncaught TypeError: itemElem.querySelector is not a function "

I`m using villana js...

CDN`s:

thesublimeobject commented 1 year ago

@Mateen-Aslam — I assume you copied the example directly to some local instance? Without a reduced test case it's going to be hard to tell exactly what is going on since the example does work in the CodePen. That said, I do know that there's a known issue with some of the filter/sort functions returning arguments that don't correspond directly to the documentation. Unfortunately, I can't recall off the top of my head what the issue was (nor can I find the issue at this moment).

I would debug/console.log() out the arguments for the sorting function and see what you get back. If I remember correctly, it's something like the function actually returns two arguments, and the first one is null but the second argument is actually the element that is needed to query for the sorting function. It might be slightly different, but if you mess with it you should be able to see what I'm talking about.

If this doesn't help, please follow up and I should be able to dig into it a bit more when I get some more time.