jQuery Selectors Quiz - Test Your Knowledge

Discussion in 'Javascript' started by Garrett Smith, Jun 1, 2010.

  1. Test your jQuery selectors knowledge with the jQuery Quiz!

    10 questions long.

    Read the instructions carefully and how many tries it takes you to get
    it right.

    When you've successfully answered all 10 questions correctly, you'll get
    to see the demo of them in action, linked from the bottom of the quiz.

    http://dhtmlkitchen.com/jstest/jquery/quiz.jsp

    Garrett
    Garrett Smith, Jun 1, 2010
    #1
    1. Advertising

  2. Garrett Smith

    nick Guest

    On Jun 1, 5:48 pm, Andrew Poulos <> wrote:
    >
    > Service Temporarily Unavailable


    It's back.
    nick, Jun 1, 2010
    #2
    1. Advertising

  3. On 6/1/2010 2:48 PM, Andrew Poulos wrote:
    > On 2/06/2010 7:34 AM, Garrett Smith wrote:


    [...]
    >> http://dhtmlkitchen.com/jstest/jquery/quiz.jsp
    >>
    >> Garrett

    >
    > The URL gives
    >
    >
    > Service Temporarily Unavailable
    >


    Try it again.

    I'm working out issues with the configuration of Tomcat where JSPs are
    not reloaded.
    Garrett Smith, Jun 1, 2010
    #3
  4. Garrett Smith

    nick Guest

    On Jun 1, 5:34 pm, Garrett Smith <> wrote:
    >
    > When you've successfully answered all 10 questions correctly, you'll get
    > to see the demo of them in action, linked from the bottom of the quiz.


    Got some issues with the scoring...

    "Good job! After just 1 try, you got all 10 questions right!"

    ...but I only got two right (7 and 9). Now I'm really curious what the
    right answers were? I'm guessing the non-strings are allowed, and the
    image inputs are getting treated as img tags or vice versa?
    nick, Jun 1, 2010
    #4
  5. Garrett Smith

    David Mark Guest

    On Jun 1, 5:52 pm, Garrett Smith <> wrote:
    > On 6/1/2010 2:48 PM, Andrew Poulos wrote:
    >
    > > On 2/06/2010 7:34 AM, Garrett Smith wrote:

    >
    > [...]
    >
    > >>http://dhtmlkitchen.com/jstest/jquery/quiz.jsp

    >
    > >> Garrett

    >
    > > The URL gives

    >
    > > Service Temporarily Unavailable

    >
    > Try it again.
    >
    > I'm working out issues with the configuration of Tomcat where JSPs are
    > not reloaded.


    You might want to work on the tallying as well. It counts about as
    well as jQuery (and the rest of them, most of which are now
    "standardizing" on jQuery's engine).

    http://www.cinsoft.net/slickspeed.html

    Oh, the humanity! :)

    Took me three fairly disinterested tries to get them all (first after
    misreading the instructions) and that goes to show the futility of
    trying to predict even one version of jQuery (the latest in this case)
    across multiple browsers (particularly if attribute-related queries
    are involved).

    The presence of QSA and non-QSA enabled browsers, as well as broken
    MSHTML implementations would make for some long-winded explanations of
    the results. Life's too short, so one should just realize that jQuery
    is god-awful at the one thing it is supposedly proficient at and dump
    it.

    The retorts from jQuery-land (assuming they are even paying attention)
    will range from:-

    1. Nobody's perfect.
    2. jQuery rulez d00d!!!!!!
    3. Those are all "edge cases".
    4. You're just trying to break it.
    5. Where's your cool query engine?
    6. Aw, UR just jealous coz nobody uses your query engine.
    7. They'll get it eventually! :)
    David Mark, Jun 1, 2010
    #5
  6. Garrett Smith

    RobG Guest

    On Jun 2, 7:34 am, Garrett Smith <> wrote:
    > Test your jQuery selectors knowledge with the jQuery Quiz!
    >
    > 10 questions long.
    >
    > Read the instructions carefully and how many tries it takes you to get
    > it right.
    >
    > When you've successfully answered all 10 questions correctly, you'll get
    > to see the demo of them in action, linked from the bottom of the quiz.
    >
    > http://dhtmlkitchen.com/jstest/jquery/quiz.jsp


    The explanation for the sample error is wrong, where it says:

    "In Firefox 3.6, nothing will happen, making "c" correct..."

    it should say:

    "...making "b" correct...".

    I kept trying until #10 was marked correct - apparently "e" is the
    answer. The explanation:

    "Result is 1 in Firefox 3.6, IE8, Safari 4, Opera 10, IE8 (standards),
    and Chrome; and 0 in IE6 and IE7 (either mode), and IE8 in quirks
    mode. "

    But that would make "d" the correct choice, not "e". I think more work
    is needed.

    If the intention is to point out inconsistencies in the Sizzle
    selector engine, you're at risk of failing because of simple errors
    that affect the credibility of the exercise.


    --
    Rob
    RobG, Jun 2, 2010
    #6
  7. On 6/1/2010 4:28 PM, RobG wrote:
    > On Jun 2, 7:34 am, Garrett Smith<> wrote:
    >> Test your jQuery selectors knowledge with the jQuery Quiz!
    >>
    >> 10 questions long.
    >>
    >> Read the instructions carefully and how many tries it takes you to get
    >> it right.
    >>
    >> When you've successfully answered all 10 questions correctly, you'll get
    >> to see the demo of them in action, linked from the bottom of the quiz.
    >>
    >> http://dhtmlkitchen.com/jstest/jquery/quiz.jsp

    >
    > The explanation for the sample error is wrong, where it says:
    >
    > "In Firefox 3.6, nothing will happen, making "c" correct..."
    >


    Yes, I know and that has been fixed. Thanks.

    The example question was changed to include a third correct answer,
    introducing a mistake in the process. I fixed that but the change was
    not picked up by Tomcat. I had to leave, and could not fix it at that time.


    > I kept trying until #10 was marked correct - apparently "e" is the
    > answer. The explanation:
    >
    > "Result is 1 in Firefox 3.6, IE8, Safari 4, Opera 10, IE8 (standards),
    > and Chrome; and 0 in IE6 and IE7 (either mode), and IE8 in quirks
    > mode. "
    >


    That explanation is right and "d" is the most correct answer. I've fixed
    the test.

    The trick is that jQuery does not support the universal selector and so
    when that is used, then the other imgs won't be matched, resulting in 0
    0 is a wrong answer, which is unintersting; how jQuery gets that wrong
    answer is.

    Unquoted, $("html > body input[width=600]").length results

    `4` in any version of IE in quirks mode (IE6 and above; IE5.5 just
    throws errors with jQuery).

    `1` in Firefox 3.6.

    `0` in IE6 and IE7 in standards mode.

    SO, unquoted, the answer would have been e.

    > But that would make "d" the correct choice, not "e". I think more work
    > is needed.
    >


    "e" would be the most correct answer because it does not include

    > If the intention is to point out inconsistencies in the Sizzle
    > selector engine, you're at risk of failing because of simple errors
    > that affect the credibility of the exercise.
    >


    Indubitably stupefied by my own quiz and point taken.

    Valuable feedback. Thanks, Rob.

    Anyone else find this stuff confusing, BTW?
    Garrett Smith, Jun 2, 2010
    #7
  8. On 6/1/2010 6:14 PM, Garrett Smith wrote:
    > On 6/1/2010 4:28 PM, RobG wrote:
    >> On Jun 2, 7:34 am, Garrett Smith<> wrote:
    >>> Test your jQuery selectors knowledge with the jQuery Quiz!
    >>>


    [...]

    >
    > "e" would be the most correct answer because it does not include
    >

    Strike that.
    Garrett Smith, Jun 2, 2010
    #8
  9. Garrett Smith

    RobG Guest

    On Jun 2, 11:14 am, Garrett Smith <> wrote:
    > On 6/1/2010 4:28 PM, RobG wrote:

    [...]
    > > If the intention is to point out inconsistencies in the Sizzle
    > > selector engine, you're at risk of failing because of simple errors
    > > that affect the credibility of the exercise.

    >
    > Indubitably stupefied by my own quiz and point taken.


    I wonder whether it might be better to just state the expected
    (technically correct) result, then the actual (jQuery) result and why
    jQuery fails on the first attempt regardless of which answers are
    given. Requiring visitors to "pass" the test to get to the interesting
    part may distract from the valuable point being made.


    --
    Rob
    RobG, Jun 2, 2010
    #9
  10. Garrett Smith

    Joe Nine Guest

    David Mark wrote:
    > The presence of QSA and non-QSA enabled browsers, as well as broken


    What's this QSA I see mentioned occasionally here? Google was no help
    http://www.google.com/search?q=qsa
    Joe Nine, Jun 2, 2010
    #10
  11. On 6/1/2010 9:36 PM, Joe Nine wrote:
    > David Mark wrote:
    >> The presence of QSA and non-QSA enabled browsers, as well as broken

    >
    > What's this QSA I see mentioned occasionally here? Google was no help
    > http://www.google.com/search?q=qsa


    QSA - document.querySelectorAll. Handy lingo when you need to say
    something in < 140 characters.
    Garrett Smith, Jun 2, 2010
    #11
  12. On 6/1/2010 6:53 PM, RobG wrote:
    > On Jun 2, 11:14 am, Garrett Smith<> wrote:
    >> On 6/1/2010 4:28 PM, RobG wrote:

    > [...]
    >>> If the intention is to point out inconsistencies in the Sizzle
    >>> selector engine, you're at risk of failing because of simple errors
    >>> that affect the credibility of the exercise.

    >>
    >> Indubitably stupefied by my own quiz and point taken.

    >
    > I wonder whether it might be better to just state the expected
    > (technically correct) result, then the actual (jQuery) result and why
    > jQuery fails on the first attempt regardless of which answers are
    > given. Requiring visitors to "pass" the test to get to the interesting
    > part may distract from the valuable point being made.
    >
    >

    The visitor at least gets the information that shows each browser doing
    different things. That should give a clue that something isn't quite right.

    I also showed the example links at the bottom -- let them cheat if
    they're impatient. That way they can see what it really does and for the
    reader who really wants to test his jQuery knowledge, he can just not
    click on the link until he's done -- leave it up to the reader.

    The expected technically correct result? Based on what? Selectors API
    draft that I linked there?

    Most of those examples should raise a SYNTAX_ERR exception.

    The Selectors API[1] states:

    | If the given group of selectors is invalid ([SELECT], section 13),
    | the implementation must raise a SYNTAX_ERR exception

    The Selector's API does not specify a context param, either.

    I'm exhausted and worreid that my message may end up reflecting that in
    the form of gibberish, so I'll leave it at that.

    [1]<http://www.w3.org/TR/selectors-api/#security>
    Garrett Smith, Jun 2, 2010
    #12
  13. On Tue, 1 Jun 2010 at 22:00:50, in comp.lang.javascript, Garrett Smith
    wrote:
    >On 6/1/2010 9:36 PM, Joe Nine wrote:
    >> David Mark wrote:
    >>> The presence of QSA and non-QSA enabled browsers, as well as broken

    >>
    >> What's this QSA I see mentioned occasionally here? Google was no help
    >> http://www.google.com/search?q=qsa

    >
    >QSA - document.querySelectorAll. Handy lingo when you need to say
    >something in < 140 characters.


    According to Wikipedia it stands for Qt Script for Applications, which
    is a recently superseded ECMAScript engine.

    It's better if the less common abbreviations are expanded at least once
    in the threads using them.

    John
    --
    John Harris
    John G Harris, Jun 2, 2010
    #13
  14. Garrett Smith

    David Mark Guest

    On Jun 2, 12:36 am, Joe Nine <> wrote:
    > David Mark wrote:
    > > The presence of QSA and non-QSA enabled browsers, as well as broken

    >
    > What's this QSA I see mentioned occasionally here? Google was no helphttp://www.google.com/search?q=qsa


    Basically, a little while back, browsers developed the ability to do
    queries, without the help of dubious scripts. Unfortunately, they are
    not compatible with the popular scripts. Somehow it was decided that
    the best way for such scripts to proceed was to call QSA first and on
    failures use the old incompatible code. The spin was that now the old
    scripts were now faster than ever (e.g. "Sizzle" was born). The
    reality is evidenced here:-

    http://www.cinsoft.net/slickspeed.html

    ....which clearly demonstrates the differences between the non-QSA and
    QSA versions of several popular scripts. This caused quite the public
    outcry when I published it. Though much of it was directed at me
    rather than the scripts. :) After all, why would I test the old
    versions? Because the new ones use QSA for 90% of the tested queries
    and AFAIK offer no way to turn it off. And as we have rehashed with
    this quiz, testing in older browsers is quite revealing as well. Why
    does this matter? Because it demonstrates the effects of time on
    sniffy multi-browser scripts. In a year, today's browsers will be on
    the scrap heap too and that's just silly.
    David Mark, Jun 2, 2010
    #14
  15. Garrett Smith

    David Mark Guest

    On Jun 2, 6:25 am, David Mark <> wrote:
    > On Jun 2, 12:36 am, Joe Nine <> wrote:
    >
    > > David Mark wrote:
    > > > The presence of QSA and non-QSA enabled browsers, as well as broken

    >
    > > What's this QSA I see mentioned occasionally here? Google was no helphttp://www.google.com/search?q=qsa

    >
    > Basically, a little while back, browsers developed the ability to do
    > queries, without the help of dubious scripts.  Unfortunately, they are
    > not compatible with the popular scripts.  Somehow it was decided that
    > the best way for such scripts to proceed was to call QSA first and on
    > failures use the old incompatible code.  The spin was that now the old
    > scripts were now faster than ever (e.g. "Sizzle" was born).  The
    > reality is evidenced here:-
    >
    > http://www.cinsoft.net/slickspeed.html
    >
    > ...which clearly demonstrates the differences between the non-QSA and
    > QSA versions of several popular scripts.  This caused quite the public
    > outcry when I published it.  Though much of it was directed at me
    > rather than the scripts.  :)  After all, why would I test the old
    > versions?  Because the new ones use QSA for 90% of the tested queries
    > and AFAIK offer no way to turn it off.  And as we have rehashed with
    > this quiz, testing in older browsers is quite revealing as well.  Why
    > does this matter?  Because it demonstrates the effects of time on
    > sniffy multi-browser scripts.  In a year, today's browsers will be on
    > the scrap heap too and that's just silly.


    Forgot to mention. Now roughly 98% of Sizzle's code exists to
    "support" non-QSA browsers. Quotes indicate that could only be IE < 8
    (and its Compatibility View), which they seem bound and determined to
    stop "supporting" (and as we've seen that's a pretty strong word for
    its performance in those browsers). So, if all of the supported
    browsers have QSA then all you need are the roughly six lines used to
    call QSA. Wouldn't it make a lot more sense to detect QSA, use it
    when possible and degrade for everything else? Why use something that
    is known to have tons of issues in some of the worst browsers ever
    produced (e.g. IE7). Doesn't make a lot of sense, does it? Why are
    all of the "major" projects dropping in 70K of outmoded (not to
    mention irretrievably broken) code at this point to "support" browsers
    they are all just itching to declare dead? Perhaps they haven't
    thought this thing through. But then, they didn't need to as I've
    explained and demonstrated these concepts ad nauseam. :)

    The answer should be quite clear. If the scripts are reduced to six
    lines, the associated cottage industries are out of business.
    Granted, jQuery as a whole has more than just Sizzle. It's got some
    element measurement methods that don't work and some very primitive
    special effects (which also have issues in older versions of IE,
    quirks mode, etc.) And don't forget "Live", which is a terrible way
    to do basic event delegation (without learning anything of course),
    relying on (you guessed it) queries. Hard to see those features as
    beneficial for beginners.
    David Mark, Jun 2, 2010
    #15
  16. John G Harris wrote:

    > Garrett Smith wrote:
    >> Joe Nine wrote:
    >>> David Mark wrote:
    >>>> The presence of QSA and non-QSA enabled browsers, as well as broken
    >>> What's this QSA I see mentioned occasionally here? Google was no help
    >>> http://www.google.com/search?q=qsa

    >> QSA - document.querySelectorAll. Handy lingo when you need to say
    >> something in < 140 characters.

    >
    > According to Wikipedia it stands for Qt Script for Applications, which
    > is a recently superseded ECMAScript engine.


    "qSA", then?

    > It's better if the less common abbreviations are expanded at least once
    > in the threads using them.


    ACK


    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
    Thomas 'PointedEars' Lahn, Jun 2, 2010
    #16
  17. Garrett Smith

    9.co.uk Guest

    On Jun 2, 2:53 am, RobG <> wrote:
    > On Jun 2, 11:14 am, Garrett Smith <> wrote:
    >
    > > On 6/1/2010 4:28 PM, RobG wrote:

    > [...]
    > > > If the intention is to point out inconsistencies in the Sizzle
    > > > selector engine, you're at risk of failing because of simple errors
    > > > that affect the credibility of the exercise.

    >
    > > Indubitably stupefied by my own quiz and point taken.

    >
    > I wonder whether it might be better to just state the expected
    > (technically correct) result, then the actual (jQuery) result and why
    > jQuery fails on the first attempt regardless of which answers are
    > given. Requiring visitors to "pass" the test to get to the interesting
    > part may distract from the valuable point being made.
    >


    I agree - out of sheer nerdiness, I kept trying till I got them all
    "right", but to be honest it was an effort.

    Slightly hampered by your referring to the answers as a, b, c, d etc,
    but on my browser at least, them being labelled 1, 2, 3, 4 etc.

    You'd make more of a point just scoring people's answers once - show
    the explanation of the correct answer regardless whether they got it
    right or not. The point you are making is clear ONLY when you can see
    the correct answers. The people you are trying to make that point to
    won't get the answers right (in fact I don't think anyone can without
    the research you did), so will wander away just as confused.
    9.co.uk, Jun 2, 2010
    #17
  18. Garrett Smith

    Matt Kruse Guest

    On Jun 1, 8:53 pm, RobG <> wrote:
    > I wonder whether it might be better to just state the expected
    > (technically correct) result, then the actual (jQuery) result and why
    > jQuery fails on the first attempt regardless of which answers are
    > given. Requiring visitors to "pass" the test to get to the interesting
    > part may distract from the valuable point being made.


    Agreed. Obviously the point of this is to highlight the failings of
    jQuery, but doing it in such a "sarcastic" way is annoying. I'd like
    to see a page that just lists what jQuery gets wrong, rather than
    making me study a test and pick answers. I don't have time for that,
    and I don't think most people who might actually benefit from the
    knowledge will take the time to actually do it.

    Matt Kruse
    Matt Kruse, Jun 2, 2010
    #18
  19. Am 2010-06-02 00:05, nick meinte:

    > Got some issues with the scoring...
    >
    > "Good job! After just 1 try, you got all 10 questions right!"
    >
    > ..but I only got two right (7 and 9). Now I'm really curious what the
    > right answers were? I'm guessing the non-strings are allowed, and the
    > image inputs are getting treated as img tags or vice versa?


    I was congratulated with the same message and had one out of ten right.
    I'm somewhat puzzled what this quiz is all about...

    Gregor


    --
    http://www.gregorkofler.com
    Gregor Kofler, Jun 2, 2010
    #19
  20. Garrett Smith

    David Mark Guest

    On Jun 2, 8:42 am, Matt Kruse <> wrote:
    > On Jun 1, 8:53 pm, RobG <> wrote:
    >
    > > I wonder whether it might be better to just state the expected
    > > (technically correct) result, then the actual (jQuery) result and why
    > > jQuery fails on the first attempt regardless of which answers are
    > > given. Requiring visitors to "pass" the test to get to the interesting
    > > part may distract from the valuable point being made.

    >
    > Agreed. Obviously the point of this is to highlight the failings of
    > jQuery, but doing it in such a "sarcastic" way is annoying. I'd like
    > to see a page that just lists what jQuery gets wrong, rather than
    > making me study a test and pick answers.


    As you well know, such a list would be quite voluminous and would vary
    from one browser/configuration (as well as jQuery version) to the
    next. Running this in multiple browsers (and reading my previous
    posts in this thread) should be enough:-

    http://www.cinsoft.net/slickspeed.html
    David Mark, Jun 2, 2010
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cutebravo
    Replies:
    2
    Views:
    290
  2. cutebravo

    Enhance your knowledge and boost your mind

    cutebravo, Jun 6, 2007, in forum: C Programming
    Replies:
    1
    Views:
    262
    Richard Heathfield
    Jun 6, 2007
  3. marss

    JavaScript knowledge test

    marss, Jul 31, 2007, in forum: Javascript
    Replies:
    84
    Views:
    1,166
    Richard Cornford
    Aug 5, 2007
  4. Aaron Gray
    Replies:
    20
    Views:
    392
    Lasse Reichstein Nielsen
    Jul 27, 2008
  5. lorlarz
    Replies:
    6
    Views:
    211
    David Mark
    Mar 25, 2010
Loading...

Share This Page