5 ms·
Honestly, if I were still a web developer, I would still use a library. The libraries greatly simplify things for the standard use cases. If I could not use a
by InfiniteRand 12y ago
Honestly, if I were still a web developer, I would still use a library. The libraries greatly simplify things for the standard use cases.
If I could not use a library, I would look for the unminified code of a library and copy and paste it the relevant section.
Because ultimately, unless things go wrong and I need to dig deep, I have better things to do than mastering yet another complex web api.
- Someone1234 12y agoNothing you said is incorrect, nor do I behave differently (who doesn't utilise JQuery?). That being said; it seems like a copout to ignore glaring issues while waving our collective hands in the air and saying "just use a library to abstract it!" One of the reasons libraries are as popular as they are (particularly JQuery which does "nothing" except provide an abstraction) is because the standards are so weak and cross browser support so incomplete. A lot of people think we're currently in a great place in terms of web-development. I actually disagree. We're still in a bad place, it just so happens that were were in an even worse place previously (e.g. IE6 era). Is there any real motive in the standardisation community or web community in general to make the spec' good enough so JQuery is no longer required by 9/10 websites? Why isn't $('#something').click(); built in yet?
- untog 12y agodocument.getElementById('something').addEventListener('click',function() {}) works on all browsers these days. But we're stuck in our habits. I don't deny that web development is kind of crappy, but it's just in the nature of it - the reason why iOS and Android are easier to develop for is because there's really only one client for them. Personally, I'll take the multiple, open client approach over the closed one any day, warts and all.
- bshimmin 12y agoOne key difference is the jQuery version will gracefully do nothing if "#something" doesn't exist, while yours will throw "TypeError: Cannot read property 'addEventListener' of null".
- wbkang 12y agoThe first half is possible now with document.querySelector[All]("#something")
- panzi 12y agoIt's possible with document.getElementById("something") even for very old browsers.