3 ms·
For those interested in jQuery alternatives- I've been waiting for jQuery 4.0 soooo long I ended up making my own jQuery with some key differences: * Animati
by geenat 2y ago
For those interested in jQuery alternatives- I've been waiting for jQuery 4.0 soooo long I ended up making my own jQuery with some key differences:
* Animations, tweens, timelines use pure CSS, instead of jQuery's custom system.
* Use one element or lists transparently.
* Inline <script> Locality of Behavior. No more inventing unique "one time" names.
* Vanilla first. Zero dependencies. 1 file. Under 340 lines.
https://github.com/gnat/surreal https://github.com/gnat/surreal
- hu3 2y agoThis is great! Locality of Behaviour is of special interest to me. How is your experience with currentScript.parentElement? Last month I did a quick research and my impression is that it wasn't reliable in some probably niche case but I can't remember when. But I didn't investigate much and I'm glad you made it work! If I load 3 consecutive scripts currentScript.parentElement should still work in all browsers right? As long as it is not async or module, which is fine with me. SvelteKit had this conversation and they ended up implementing random ids for elements to set their targets: https://github.com/sveltejs/kit/issues/2221 https://github.com/sveltejs/kit/issues/2221
- Izkata 2y agoConflicting documentation: me() is guaranteed to return 1 element (or first found, or null). any() is guaranteed to return an array (or empty array). Array methods any('button')?.forEach(...) any('button')?.map(...) So does any() always return an array as described near the top, or can it return null as implied by the example below?