weavejester / clojure-toolbox.com

Source to clojure-toolbox.com
http://www.clojure-toolbox.com
179 stars 194 forks source link

Add really fast search #422

Open SevereOverfl0w opened 3 years ago

SevereOverfl0w commented 3 years ago

This rewrite removes jQuery, and instead relies on modern browser APIs to implement the same functionality. This makes search fast enough that it's able to run without the need of debounce.

I followed https://w3bits.com/css-grid-masonry/ to create the masonry without jQuery. Leaning into the browser like this allows the re-masonry on search to be really fast (this was one of the slowdown causes I was noticing before)

I suspect IE11 will need some careful work to get grid working there, but we could simply disable it when grid is not available via @supports.

I've tried to keep the browser APIs to ones widely supported. For example querySelector is available in IE8 (which has global usage of 0.03%). I haven't verified that claim though.

There's a few minor style tweaks here too, but the original style should be easy enough to get working with grid, I just haven't invested the time yet.

These changes will also reduce the JS footprint of the size dramatically.

Marking as draft as this is so experimental, and I'm not sure yet whether I should invest time into IE support or not.