Is jQuery worth a second look?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RobG

    Is jQuery worth a second look?

    Do some of the regulars here need to re-think their (sometimes
    strident) opposition to libraries? Both Microsoft and Nokia have
    announced support for jQuery.

    It seems to have gained quite a bit of momentum, can it be considered
    a reasonable choice for those who want to use a full-featured, well
    supported library?

    <URL: http://jquery.com/blog/2008/09/28/jq...crosoft-nokia/ >


    --
    Rob
  • Joost Diepenmaat

    #2
    Re: Is jQuery worth a second look?

    RobG <rgqld@iinet.ne t.auwrites:
    Do some of the regulars here need to re-think their (sometimes
    strident) opposition to libraries? Both Microsoft and Nokia have
    announced support for jQuery.
    Why would they need to "support" it? It ought to be cross-platform
    already. Right?

    Oh, I see... MS and Nokia are talking about *using* it. Not sure if
    that's much of an endorsement.
    It seems to have gained quite a bit of momentum, can it be considered
    a reasonable choice for those who want to use a full-featured, well
    supported library?
    FTR: I'm not against libraries at all. It's just that most I've looked
    at solve the wrong problems and/or solve a small subset of interesting
    problems in quite a convoluted and ugly way (I'm looking at you,
    Prototype.js)

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

    Comment

    • RobG

      #3
      Re: Is jQuery worth a second look?

      On Sep 29, 8:36 am, Joost Diepenmaat <jo...@zeekat.n lwrote:
      RobG <rg...@iinet.ne t.auwrites:
      Do some of the regulars here need to re-think their (sometimes
      strident) opposition to libraries?  Both Microsoft and Nokia have
      announced support for jQuery.
      >
      Why would they need to "support" it? It ought to be cross-platform
      already. Right?
      "Support" as in encourage developers on their platforms to use it.

      Oh, I see... MS and Nokia are talking about *using* it. Not sure if
      that's much of an endorsement.
      They've gone a bit further than that, they are supporting it with
      their development tools. Microsoft is including an intellisense-
      annotated version in Visual Studio and not developing competing
      components, Nokia are putting in in their "Web Run-Time" for their
      WebKit-based browser running on Symbian and basing their built-in
      widgets on it.

      It seems to have gained quite a bit of momentum, can it be considered
      a reasonable choice for those who want to use a full-featured, well
      supported library?
      >
      FTR: I'm not against libraries at all. It's just that most I've looked
      at solve the wrong problems and/or solve a small subset of interesting
      problems in quite a convoluted and ugly way (I'm looking at you,
      Prototype.js)
      Prototype.js supporters seem a bit intimidated by the success of
      jQuery. It's strategy of extending a native object rather
      Prototype.js's extension of host objects seems to be a better choice.


      --
      Rob

      Comment

      • dhtml

        #4
        Re: Is jQuery worth a second look?

        RobG wrote:
        On Sep 29, 8:36 am, Joost Diepenmaat <jo...@zeekat.n lwrote:
        >RobG <rg...@iinet.ne t.auwrites:
        >>Do some of the regulars here need to re-think their (sometimes
        >>strident) opposition to libraries? Both Microsoft and Nokia have
        >>announced support for jQuery.
        >Why would they need to "support" it? It ought to be cross-platform
        >already. Right?
        >
        "Support" as in encourage developers on their platforms to use it.
        >
        >
        >Oh, I see... MS and Nokia are talking about *using* it. Not sure if
        >that's much of an endorsement.
        >
        They've gone a bit further than that, they are supporting it with
        their development tools. Microsoft is including an intellisense-
        annotated version in Visual Studio and not developing competing
        components, Nokia are putting in in their "Web Run-Time" for their
        WebKit-based browser running on Symbian and basing their built-in
        widgets on it.
        >
        >
        Absolutely worth taking a look at objectively. The code is taken quite
        seriously by the industry, so it's a good idea to understand it and to
        do that, it should be objectively reviewed.
        >>It seems to have gained quite a bit of momentum, can it be considered
        >>a reasonable choice for those who want to use a full-featured, well
        >>supported library?
        Good question. I think it's time for a code review.
        >
        >
        --
        Rob

        Comment

        • Conrad Lender

          #5
          Re: Is jQuery worth a second look?

          On 2008-09-29 08:09, dhtml wrote:
          Absolutely worth taking a look at objectively. The code is taken quite
          seriously by the industry, so it's a good idea to understand it and to
          do that, it should be objectively reviewed.
          >
          >>>It seems to have gained quite a bit of momentum, can it be considered
          >>>a reasonable choice for those who want to use a full-featured, well
          >>>supported library?
          >
          Good question. I think it's time for a code review.
          Just what I've been thinking. JQuery has often been summarily
          disqualified as "bad" in this group, but looking back the issues mostly
          seemed to center around how it's implemented, not how it's designed or
          what it's meant to be doing. At the moment, my experience with JQuery is
          pretty much limited to fixing bugs in other people's code (like Drupal
          modules, for example), and it may be time to take a closer look again.
          I'm sure that much of the criticism is justified. There were a couple of
          postings highlighting inefficient or incomplete or plain buggy passages
          in the JQuery core, and it seems to me that submitting patches may be
          more productive in the long term than cultivating our negative opinion
          of this library, and dismissing all JQuery related questions in this
          group with short "bad idea" replies.

          Some things may be impossible to fix at this point, like the naming of
          the "$" constructor. Personally, I don't have a problem with $(), even
          though it's not what the $-prefix for identifiers was originally meant
          for, but then I've always been more interested in pragmatic solutions.


          - Conrad

          Comment

          • sasuke

            #6
            Re: Is jQuery worth a second look?

            Another toolkit/library worth looking at is extJS. Though it has a
            large memory footprint and considerable size, it is good choice for
            developing extreme JS dependent eye candy applications which require
            you to have a toolkit which provides almost every conceivable way you
            can use Javascript out of the box. A real good choice for intranet UI
            intensive web based applications.

            On the other hand, if one is looking for an extremely lightweight
            library which though doesn't provide everything but still allows you
            to build up on itself and drastically cut down boiler plate code,
            DOMAssistant is a nice toolkit to look at.

            <http://extjs.com/>
            <http://www.domassistan t.com/>

            /sasuke

            Comment

            • dhtml

              #7
              Re: Is jQuery worth a second look?

              Conrad Lender wrote:
              On 2008-09-29 08:09, dhtml wrote:
              >Absolutely worth taking a look at objectively. The code is taken quite
              >seriously by the industry, so it's a good idea to understand it and to
              >do that, it should be objectively reviewed.
              >>
              >>>>It seems to have gained quite a bit of momentum, can it be considered
              >>>>a reasonable choice for those who want to use a full-featured, well
              >>>>supported library?
              >Good question. I think it's time for a code review.
              >
              Just what I've been thinking. JQuery has often been summarily
              disqualified as "bad" in this group, but looking back the issues mostly
              seemed to center around how it's implemented, not how it's designed or
              what it's meant to be doing. At the moment, my experience with JQuery is
              pretty much limited to fixing bugs in other people's code (like Drupal
              modules, for example), and it may be time to take a closer look again.
              I'm sure that much of the criticism is justified. There were a couple of
              postings highlighting inefficient or incomplete or plain buggy passages
              in the JQuery core, and it seems to me that submitting patches may be
              more productive in the long term than cultivating our negative opinion
              of this library, and dismissing all JQuery related questions in this
              group with short "bad idea" replies.
              >

              What is this?

              else {
              var fn = jQuery.expr[ m[1] ];
              if ( typeof fn == "object" )
              fn = fn[ m[2] ];

              if ( typeof fn == "string" )
              fn = eval("false||fu nction(a,i){ret urn " + fn + ";}");

              // Execute it against the current filter
              r = jQuery.grep( r, function(elem, i){
              return fn(elem, i, m, r);
              }, not );
              }

              This is apparently so a string can be passed in for evaluation in the
              'grep' function. Passing in a function would seem to be a better solution.

              isFunction - still uses function decompilation. Kangax posted on
              es-discuss that that was changed but I still see the isFunction in the
              latest 1.2.6.

              The jQuery offsets function still uses with() to augment scope with
              jQuery.browser, uses an add() and border() functions inside two loops.
              That will be slow and I've tested it to be slow, so it's not just
              conjecture.

              The |clean| function is a little strange.

              The jQuery library uses tabs for indentation, has few comments, uses
              very short names (e.g. from that function I excerpted, there are all of:
              m, r, t, a, z, variables). Despite this, the uncompressed source still
              comes in at nearly 100k. Just for the base library.

              I would, given a problem, try to use the most appropriate strategy to
              solve it.

              That is the answer I provide when asked which library I like best. The
              person asking will sometimes react incredulously. I have been asked (as
              a follow-up question) why I would use such a non-standard approach
              instead of using a library.

              Garrett
              >
              - Conrad

              Comment

              • kangax

                #8
                Re: Is jQuery worth a second look?

                On Sep 30, 12:13 am, dhtml <dhtmlkitc...@g mail.comwrote:
                Conrad Lender wrote:
                On 2008-09-29 08:09, dhtml wrote:
                Absolutely worth taking a look at objectively. The code is taken quite
                seriously by the industry, so it's a good idea to understand it and to
                do that, it should be objectively reviewed.
                >
                >>>It seems to have gained quite a bit of momentum, can it be considered
                >>>a reasonable choice for those who want to use a full-featured, well
                >>>supported library?
                Good question. I think it's time for a code review.
                >
                Just what I've been thinking. JQuery has often been summarily
                disqualified as "bad" in this group, but looking back the issues mostly
                seemed to center around how it's implemented, not how it's designed or
                what it's meant to be doing. At the moment, my experience with JQuery is
                pretty much limited to fixing bugs in other people's code (like Drupal
                modules, for example), and it may be time to take a closer look again.
                I'm sure that much of the criticism is justified. There were a couple of
                postings highlighting inefficient or incomplete or plain buggy passages
                in the JQuery core, and it seems to me that submitting patches may be
                more productive in the long term than cultivating our negative opinion
                of this library, and dismissing all JQuery related questions in this
                group with short "bad idea" replies.
                >
                What is this?
                >
                       else {
                         var fn = jQuery.expr[ m[1] ];
                         if ( typeof fn == "object" )
                           fn = fn[ m[2] ];
                >
                         if ( typeof fn == "string" )
                           fn = eval("false||fu nction(a,i){ret urn " + fn + ";}");
                >
                         // Execute it against the current filter
                         r = jQuery.grep( r, function(elem, i){
                           return fn(elem, i, m, r);
                         }, not );
                       }
                >
                This is apparently so a string can be passed in for evaluation in the
                'grep' function.  Passing in a function would seem to be a better solution.
                >
                isFunction - still uses function decompilation. Kangax posted on
                es-discuss that that was changed but I still see the isFunction in the
                latest 1.2.6.
                >
                Garrett,
                their trunk is using `instanceof` [1]. Wrapping a single operator into
                a method seems like an overkill, but... whatever works for them. We,
                in prototype.js, are more inclined to get rid of is* methods at all.
                Having such "helpers" seems to solve very few (if any) problems.
                The jQuery offsets function still uses with() to augment scope with
                jQuery.browser, uses an add() and border() functions inside two loops.
                  That will be slow and I've tested it to be slow, so it's not just
                conjecture.
                >
                The |clean| function is a little strange.
                >
                The jQuery library uses tabs for indentation, has few comments, uses
                very short names (e.g. from that function I excerpted, there are all of:
                m, r, t, a, z, variables). Despite this, the uncompressed source still
                comes in at nearly 100k. Just for the base library.
                >
                I would, given a problem, try to use the most appropriate strategy to
                solve it.
                >
                That is the answer I provide when asked which library I like best.  The
                person asking will sometimes react incredulously.  I have been asked (as
                a follow-up question) why I would use such a non-standard approach
                instead of using a library.
                >
                Garrett

                [1] http://dev.jquery.com/browser/trunk/...c/core.js#L617

                --
                kangax

                Comment

                • Henry

                  #9
                  Re: Is jQuery worth a second look?

                  On Sep 30, 6:23 am, kangax wrote:
                  On Sep 30, 12:13 am, dhtml wrote:
                  <snip>
                  >isFunction - still uses function decompilation. Kangax
                  >posted on es-discuss that that was changed but I still
                  >see the isFunction in the latest 1.2.6.
                  >
                  Garrett,
                  their trunk is using `instanceof` [1].
                  <snip>

                  Unreleased development code is irrelevant. Nobody in their right mind
                  will be using it on public web sites and where it differs from
                  previously released code there is no way to tell whether changes won't
                  need to be reversed (say, in the event that they turn out not to be
                  back-compatible and/or effective when (and if) fully tested). It is
                  the code that is released that should be judged (and so if the authors
                  want to be judged as having corrected some of their mistakes then they
                  should release a new version).

                  Comment

                  • Bruno Desthuilliers

                    #10
                    Re: Is jQuery worth a second look?

                    Henry a écrit :
                    On Sep 30, 6:23 am, kangax wrote:
                    >On Sep 30, 12:13 am, dhtml wrote:
                    <snip>
                    >>isFunction - still uses function decompilation. Kangax
                    >>posted on es-discuss that that was changed but I still
                    >>see the isFunction in the latest 1.2.6.
                    >Garrett,
                    >their trunk is using `instanceof` [1].
                    <snip>
                    >
                    Unreleased development code is irrelevant.
                    I beg to somewhat disagree. It at least gives indications about the
                    current direction.

                    (snip)

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #11
                      Re: Is jQuery worth a second look?

                      kangax wrote:
                      dhtml wrote:
                      isFunction - still uses function decompilation. Kangax posted on
                      es-discuss that that was changed but I still see the isFunction in the
                      latest 1.2.6.
                      >
                      Garrett,
                      their trunk is using `instanceof` [1].
                      Irrelevant, except that it shows their cluelessness.


                      PointedEars

                      Comment

                      • Matt Kruse

                        #12
                        Re: Is jQuery worth a second look?

                        On Sep 28, 5:24 pm, RobG <rg...@iinet.ne t.auwrote:
                        Do some of the regulars here need to re-think their (sometimes
                        strident) opposition to libraries?  Both Microsoft and Nokia have
                        announced support for jQuery.
                        I think it is warranted, and I thought so a year ago :)

                        I realized quite some time ago that jQuery was gaining momentum and
                        would soon be one of the de-facto standards for Javascript
                        development. It's not perfect. It has some design flaws. Its internals
                        could use some cleaning up. But what general-purpose technology
                        doesn't?

                        HTML is seriously bastardized and has been abused for over a decade.
                        CSS is far from perfect and has some seriously questionable design
                        decisions. Javascript as a language itself has some drawbacks, quirks,
                        and missing features that would make life better. So here comes
                        jQuery, which is not perfect by any means, but is ridiculously useful
                        and has made interactive javascript more accessible to the mainstream.
                        I'm in favor of it. And I'm in favor of improving it, because it is
                        quickly becoming a tool that is used by many people.

                        Some important points for me:

                        1) It works. I know it has some internal problems like browser
                        sniffing and code that isn't as accurate as it should be. But in every
                        case where I have decided to use it, it has worked and worked well in
                        most cases. Argue all you want about it being 1px off or slow or how
                        it _could_ work in browser X if it just didn't browser sniff... but in
                        reality, in many cases, it works and works well.

                        2) It's supported. The discussion lists are very active and there is a
                        huge community around it. It's under constant development. Momentum is
                        in its favor. That's a good thing.

                        3) It encourages unobtrusive scripting. Sometimes too much, IMO. But
                        by its nature it encourages people to put classes on their HTML tags
                        and add the behavior after the page is ready. It doesn't encourage all
                        the best practices, but it's a step in the right direction.

                        4) Plugins are questionable. The base jQuery library has a lot of
                        fundamentals, but if you want "controls" then you need to venture into
                        the plugin territory. And sometimes this is bad news. The quality of
                        the plugins is, generally, much lower than jQuery itself, IMO. Be
                        careful what you use. In some cases, I have been writing my own
                        because the ones that exist aren't good enough.

                        I don't think jQuery (or any general-purpose lib) is the right tool
                        for everyone. If you have the skill, time, and money to build all your
                        components from scratch, then go for it. For everyone else, I think
                        jQuery is the best possible route to go right now and the foreseeable
                        future.

                        Matt Kruse

                        Comment

                        • Matt Kruse

                          #13
                          Re: Is jQuery worth a second look?

                          On Sep 29, 11:13 pm, dhtml <dhtmlkitc...@g mail.comwrote:
                          isFunction - still uses function decompilation. Kangax posted on
                          es-discuss that that was changed but I still see the isFunction in the
                          latest 1.2.6.
                          I'm not sure why this hasn't been updated. I posted a more reliable
                          fix for isFunction quite some time ago but it seemed to be ignored. I
                          think perhaps because the existing code really only fails in odd,
                          isolated cases.
                          The jQuery library uses tabs for indentation, has few comments, uses
                          very short names (e.g. from that function I excerpted, there are all of:
                          m, r, t, a, z, variables). Despite this, the uncompressed source still
                          comes in at nearly 100k. Just for the base library.
                          True, it has grown quite a bit larger than its original intent. I use
                          the minified version in production, which is just about 50k. I've
                          never been in a situation where that was a problem.

                          Matt Kruse

                          Comment

                          • Oltmans

                            #14
                            Re: Is jQuery worth a second look?

                            On Sep 30, 6:38 pm, "Thomas 'PointedEars' Lahn" <PointedE...@we b.de>
                            wrote:
                            kangax wrote:
                            dhtml wrote:
                            isFunction - still uses function decompilation. Kangax posted on
                            es-discuss that that was changed but I still see the isFunction in the
                            latest 1.2.6.
                            >
                            Garrett,
                            their trunk is using `instanceof` [1].
                            >
                            Irrelevant, except that it shows their cluelessness.
                            >
                            Why using "instanceof " considered to be not so good? Can you please
                            explain it to me with a few examples? That will be highly appreciated.

                            Thanks in advance.
                            PointedEars

                            Comment

                            • dhtml

                              #15
                              Re: Is jQuery worth a second look?

                              Oltmans wrote:
                              On Sep 30, 6:38 pm, "Thomas 'PointedEars' Lahn" <PointedE...@we b.de>
                              wrote:
                              >kangax wrote:
                              >>dhtml wrote:
                              >>>isFunction - still uses function decompilation. Kangax posted on
                              >>>es-discuss that that was changed but I still see the isFunction in the
                              >>>latest 1.2.6.
                              >>Garrett,
                              >>their trunk is using `instanceof` [1].
                              >Irrelevant, except that it shows their cluelessness.
                              >>
                              >
                              Why using "instanceof " considered to be not so good? Can you please
                              explain it to me with a few examples? That will be highly appreciated.
                              >
                              Instanceof won't work like you want it to across frames. This is because
                              self.Function != frames[0].Function.

                              frames[0].fun instanceof Function will return false across frames.
                              Two documents example:
                              document1.html
                              myframe.html:


                              document1.html:
                              <body>
                              <iframe src="myframe.ht ml"></iframe>

                              <script>
                              onload = function() {
                              var f = frames[0].fun;
                              document.write(['<pre>',f instanceof Function, f].join('\n'));
                              document.close( );
                              };
                              </script>

                              </body>


                              myframe.html:
                              <script>
                              function fun() {}
                              </script>

                              Result:
                              false
                              function fun() {
                              }

                              So we can see that instanceof won't work across frames like you'd want
                              it to, and the isFunction uses instance of.

                              Garrett

                              Comment

                              Working...