Hacker News new | comments | show | ask | jobs | submit login
Announcing the jQuery Foundation (jquery.com)
115 points by wycats on Mar 6, 2012 | hide | past | web | favorite | 5 comments

I remember sitting in a little conference room at the first Boston BarCamp in 2005 with maybe ten other people listening to this kid from RIT give a session about this new Javascript library he wrote. Who new it would get this embedded in the web?

hope they will never upgrade their server again without backup it first, i still could not upgrade my jquery due to the for-ever lost plugin site after that upgrade, the new plugin site is still not fully ready.

These guys need to get over themselves. JQuery provided a really nice way for designers to copy/paste effects onto web elements. And then they took it way, way too far, to the point where whenever I see a "new JQuery plugin to do X" I just look the other way.

JQuery just gets in the way these days.

$("#element") is an anti-pattern. That code should just return the DOM node, not some silly object with unknown attributes. We're way past the point where you need to abstract the entire document object model, and I argue you should never have done that to begin with.

Unknown attributes, what? The reason $('#element') returns a jQuery object is it lets you chain jQuery functions, which allows more efficient code. And the scope inside of anonymous functions in jQuery is the DOM element itself, not the jQuery object:

      this.id;  <- the DOM element
      $(this).attr('id');  <- rewrap required
Also, same result:

    var x = $('#element');
    x.attr('id');  <- jQuery object
    x[0].id;  <- DOM element
Your argument that it's "a silly object with unknown attributes" just means you don't know very much jQuery. And if you're ever curious what attributes it has you can let Developer Tools or Firebug tell you with the auto-suggest dropdown:

    var x = $('#element');

  it lets you chain jQuery functions, 
That's also an anti-pattern. JQuery was designed to hide iteration from designers who can't code. I'm floored that people that actually know how to program still think it's a good idea.


It might look fancy, but all it's doing is obscuring the fact that iteration might be occurring on each command which for obvious reasons would be a bad idea. A designer might not care, but a programmer who knows JavaScript will probably write something like this instead:

  var divs = document.getElementsByTagName('DIV');
  divs.forEach(function(div) {
     div.onClick = ..
JQuery provides a nice polyfill for older browsers, but the way the API works just gets in the way for people who know JavaScript and DOM.

Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact