Hacker Newsnew | comments | ask | jobs | submitlogin
Announcing the jQuery Foundation (jquery.com)
111 points by wycats 779 days ago | comments


dugmartin 778 days ago | link

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?

-----

xxiao 778 days ago | link

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.

-----

wavephorm 778 days ago | link

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.

-----

artursapek 778 days ago | link

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:

    $('#element').click(function(){
      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');
    x.

-----

wavephorm 778 days ago | link

  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.

$('DIV').click(..).color()...border()...

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 = ..
     div.style....
  });
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.

-----




Lists | RSS | Bookmarklet | Guidelines | FAQ | DMCA | News News | Feature Requests | Bugs | Y Combinator | Apply | Library

Search: