3 ms·
I love the approach. I would love to see a good quality "You don't need jQuery" out there; people talk about that, but I never found something to tell what to u
by AdrianB1 5y ago
I love the approach. I would love to see a good quality "You don't need jQuery" out there; people talk about that, but I never found something to tell what to use instead and why, just generic "use JavaScript for DOM manipulation" (fair) and "use one of the alternatives for AJAX" (which one?).
Is there anything like this planned for "You don't need"?
- ptx 5y agoThe post-jQuery native browser APIs that were added to support those use-cases are querySelector for querying the DOM and fetch for AJAX (assuming you don't need the X part).
- runarberg 5y ago> assuming you don't need the X part I have never actually had to deal with XML from the backend but if I had to, I guess I would await on `response.text()` from `fetch()` and then with an instance of `DOMParser()` call `parseFromString(xml, "application/xml")` and then query the resulting XML tree with `querySelector` et.al.
- steve_adams_86 5y agoThe Ajax alternative is fetch, the native browser API which has excellent polyfills for the server which enable JavaScript to be isomorphic and dynamic to users and search engines. Basically your code will run as expected on the client or server, so fully rendered pages can be served - even if it needs to call an API to populate content. https://youmightnotneedjquery.com/ https://youmightnotneedjquery.com/ Is this the kind of thing you were mentioning? Maybe it’s been a while, but if you Google “you don’t need jquery” you’ll find plenty like this and it seems to explain well enough.