David Mark's Javascript Tip of the Day

Discussion in 'Javascript' started by David Mark, Nov 7, 2011.

  1. David Mark

    David Mark Guest

    David Mark's Javascript Tip of the Day

    Volume 1 - Tip 3A

    For God's sake, don't use jQuery under any circumstances.


    Not fast, not concise, just creates a whole lot of confusion for no
    good reason. Google combinations of: "jQuery", "attr", "prop",
    "removeAttr", and now "removeProp" (!) and find lots of similar tales.
    The "attr" variety is old news, the others were recently added to try
    to fix the problems it created.

    The client above just needed code like this:-

    el.readOnly = b; // That's all

    ....instead they spent what appears to be hours slogging through
    jQuery's muck.

    The common recurring theme is that nobody associated with the project
    seems to understand what these functions do or how to design
    alternatives that make sense. Meanwhile, entire books and blogs about
    jQuery are "right" one day and "wrong" the next as jQuery fiddles
    endlessly with their core DOM code. Virtually every jQuery example
    ever written makes at least one call to "attr".

    David Mark, Nov 7, 2011
    1. Advertisements

  2. David Mark

    RobG Guest

    It is helpful to include some relevant quotes from such links as they
    may not last as long as this post and some readers are blocked from
    accessing "social media" sites because their boss/supervisor/spouse/
    whatever fears they'll spend their day socialising.
    RobG, Nov 8, 2011
    1. Advertisements

  3. I thought that what followed the URL in David Mark's post _was_ a
    quotation or paraphrase of its key contents. I still think it was meant
    to be a paraphrase, but this is not quite clear. In any case, when
    mentioning a URL, it is usually a good idea to quote its heading or
    title, such as
    "A Bug in JQuery Latest Release(v1.6.2)"
    It's not a good heading, but it's what the page has. Quite often, when a
    URL has been killed (by a reorganization of a site, or by moving a
    resource to another server), googling for the exact title helps to find
    the new address of the resource fast.
    Jukka K. Korpela, Nov 8, 2011
  4. David Mark

    David Mark Guest

    Yes, but not a lot of salient quotes there though. Even though the
    author is clearly confused about... well, almost everything, that
    wasn't really my point.
    David Mark, Nov 8, 2011
  5. David Mark

    David Mark Guest

    Yes. It was a high altitude view, but more of the general
    implications than the specific outcome. In short, there's no way that
    all of those jQuery users out there having problems with attr/prop/
    etc. are saving time or learning anything useful.
    David Mark, Nov 8, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.