开发者

Are there any good reasons NOT to use jQuery instead of plain old JavaScript? [closed]

开发者 https://www.devze.com 2022-12-12 18:26 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can b开发者_StackOverflow社区e improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

I recently discovered jQuery, and I can immediately see how useful and elegant it is.

I'm curious, though - are there any reasons NOT to use it (and just use plain old JavaScript instead)? If there aren't any reasons, should it not be integrated fully into the JavaScript language?


If you don't actually use any of the features of jQuery, there's no reason to introduce the page weight to your site. If you do use any of the features, there's probably not a good reason to roll your own version except for learning purposes.


are there any reasons NOT to use it

  • There are better libraries.
  • It adds page weight (and for small projects that weight is often more costly then the benefits)

should it not be integrated fully into the Javascript language?

Most of what jQuery does is related more to DOM than JavaScript.


One reason - to actually learn javascript.

It is a truly beautiful language that is often overlooked, because when people say "I know javascript", what they actually mean is "I know how to copy&paste $('#content').hide(200) to make my app look cool".

This is a bit sad.

That being said (no pun intended), I use jquery all the time for mundane tasks like xhr, DOM manipulation and such. Unfortunately, there is absolutely no reason to reinvent the wheel (more than one time, anyway), especially taking into consideration the fact, that, at times, you have to invent a separate wheel for every major browser.


I love JQuery too - so don't get me wrong... but as Devil's Advocate:

  • Not everyone on your team knows JQuery, thus they'd be in a pickle if they inherited your work
  • Not everybody feels that JQuery is the best JavaScript library (more of an argument against making JQuery synonymous with JavaScript)

That said, I personally feel that you should use a JavaScript library (presumably JQuery) rather than recreating equivalent behavior with JavaScript. It's the most popular library and it might be more readable/maintainable than hand-rolled JavaScript.


Lots of bad reasons. Two good ones:

  1. You don't need it. There are plenty of things you might want to do with JavaScript that don't require or particularly benefit from jQuery.
  2. You don't want it. Personally, I think jQuery is fantastic. Sets, function chaining, concise syntax... it all makes me happy. But, some folks have different tastes.


jQuery is built on javascript and encapsulates a particular style of programming and a set of supported features. Not everyone wants to use this style of programming or prefers the set of features in jQuery over those in other frameworks. jQuery is certainly an improvement over coding the same features yourself in plain javascript, but not necessarily a substitute for all javascript as the feature set is finite. You'll still need to write some plain javascript when using jQuery (or any other framework).


I can say it in one word: overhead. It adds another 19K to your page.

Don't get me wrong, this is a sick library - I use it all the time.


I think choosing a JS & DOM & AJAX library you like is important, and it will almost always be appropriate to use said library, but don't let that stop you for learning important JavaScript features, idioms & techniques, as well as some browser and DOM API.

Being afraid to leave your library's boundaries is very limiting.


I've used Jquery a few times, and it's just so damn easy compared to using dom. It also seems like it has more accessability than old fashioned DOM.

In the words of Martha Stewart, "It's a good thing."


Javascript is a great beginner's language if you want to progress to .net languages or java. It's less complicated than other programming languages, but it still has those basic, invaluable principles. jquery takes that similarity away. Javascript doesn't neccesarily need to be used for web design, for example, unity 3d, a game engine, uses Unityscript, which is almost identical to javascript. I learnt to use it by creating websites that use javascript.

I know it's not much, but I think a good reason to go the javascript route is to learnt how to program. It's not necessary to know javascript in order to build a site, but it's nice to know the code that goes into it on a basic level.


jQuery is developed and is still being developed for the very entry level developer. Actually it is almost built for non-developers so it makes some things very easy BUT with a performance trade.

It does many things right and it does many things wrong for various reasons like:

  • The above mentioned "stupid-proof" structure
  • Taste of jQuery team
  • Extensive(but a bit overkill) cross-browser capabilities

So I personally prefer some other library written for JS Ninjas for better performance. I actually went as far as creating my own library but that's another issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号