jQuery takes down the Guardian

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

  1. David Mark

    David Mark Guest

    David Mark, Nov 3, 2011
    #1
    1. Advertisements

  2. David Mark

    RobG Guest

    The article itself seems somewhat clueless. The markup examples use
    XHTML, yet The Guardian web site uses <!DOCTYPE html>[1].

    They seem to be under the illusion that javascript changes the markup.

    There is also:

    | In jQuery 1.6, this method now returns "undefined",
    | which Javascript gurus will know is not the same
    | as false (unless you use === comparison).

    Really?

    Anyhow, a design "feature" to wait for the user to start typing before
    enabling the submit button is plain dumb.

    But kudos for being honest.


    1. http://www.guardian.co.uk/
     
    RobG, Nov 3, 2011
    #2
    1. Advertisements

  3. No, merely the illusion that setting a boolean attribute *value* to an
    empty string removes it (it doesn't). It still yields a DOM property of
    *true*, which clearly baffled them. Blame the software, not the
    implementer, right? *dunce*

    Coincidentally, jQuery 1.7 hit the internet today. They sure have
    impeccable timing.
     
    Matt McDonald, Nov 3, 2011
    #3
  4. They are completely delusional as they actually believe in "Javascript
    upgrade" (sic!) (when they mean jQuery upgrade instead). After reading its
    title I already knew I did not have to waste more time on that article.
    ACK


    PointedEars
     
    Thomas 'PointedEars' Lahn, Nov 3, 2011
    #4
  5. David Mark

    RobG Guest

    I have no idea what the attr method actually does in either version of
    jQuery in this case, so I don't know what the actual effect on the DOM
    is.

    However, the HTML disabled attribute doesn't have a value at all, its
    presence or absence changes the value of the related boolean DOM
    property (something that is maintained in HTML5[1]), which is what the
    document claimed to be). Attempting to explain the effect of jQuery's
    attr using XHTML markup for an HTML document is an indicator that they
    still don't know what is going on.

    Interestingly, if they'd actually the latest HTML5 draft, they'd have
    seen that this exact case is pointed out in section 1.9.3 under
    "Errors that indicate a likely misunderstanding of the
    specification"[2]:

    | For example, setting the disabled attribute to the value
    | "false" is disallowed, because despite the appearance of
    | meaning that the element is enabled, it in fact means that
    | the element is disabled (what matters for implementations
    | is the presence of the attribute, not its value).

    The authors of HTML5 seem to delight in confusion since they
    constantly refer to "attributes" in the context of both HTML
    attributes and DOM properties.

    It may set the related DOM "disabled" property to true.
    Clearly they had no idea what the method actually does, and even if
    they did, they don't seem to understand HTML DOMs anyway.

    I guess it will roll out in their regular second Tuesday update.


    1. http://dev.w3.org/html5/spec/Overview.html#attr-fe-disabled
    2. http://dev.w3.org/html5/spec/Overview.html#restrictions-on-content-models-and-on-attribute-values
     
    RobG, Nov 3, 2011
    #5
  6. David Mark

    J.R. Guest

    The page 3 site of "The Sun" uses JQuery too, but it seems that no one
    cares about it...

    Cheers,
    JR
     
    J.R., Nov 4, 2011
    #6
  7. It all depends on the doctype, really.
    HTML 4.01[0] and HTML 5[1] validate both the minimized and maximized
    forms, so (psuedocode):

    * boolean
    * boolean=""
    * boolean="boolean"

    XHTML 1.0 only validates the maximized form[2], so (pseudocode):

    * boolean="boolean"
    Yes, the usage of "IDL attribute" as an alias for "DOM property" is
    quite confusing upon first glance. It seems it's because "idl" is the
    filetype in which these properties are defined as "attributes". Here's a
    look at one:

    http://www.w3.org/TR/DOM-Level-2-HTML/idl/html2.idl

    Clear as mud, right? ;)
    Ha, good catch. I was in a hurry this afternoon, so forgive the lack of
    elaboration.

    Not to be a stickler, but I'd suggest linking to the HTML 5 spec via the
    multipaged version[3]. The full spec is a real hog. :)

    [0]: http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3.4.2
    [1]:
    http://dev.w3.org/html5/spec/common-microsyntaxes.html#boolean-attributes
    [2]: http://www.w3.org/TR/xhtml1/#h-4.5
    [3]: http://dev.w3.org/html5/spec/spec.html
     
    Matt McDonald, Nov 4, 2011
    #7
  8. XHTML in general.
    The statement "$markup_language validates only …" does not make sense. A
    *validator* validates code supposedly written in $markup_language against
    the formal specification of $markup_language. Therefore, a proper
    expression would be "… is valid in $markup_language" or "$markup_language
    requires …".
    No, the Object Management Group (OMG) Interface Definition Language (IDL), a
    C++-like interface description language which has been developed for CORBA,
    is the preferred form of specifying language-independent (W3C) DOM
    interfaces. The filename suffix (which you misname "filetype") is only
    evidence of that.
    It is very clear. Problems arise when one fails to differentiate between
    language-independent IDL attributes, properties that implement them in a
    specific programming language, and markup attributes of a specific related
    SGML-rooted markup language like HTML or XHTML.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Nov 4, 2011
    #8
  9. David Mark

    David Mark Guest

    Sort of. The problem is that Web developers abdicate responsibility to
    "lead developers" that they don't know. Their only documentation is
    the jQuery documentation, which is rubbish. For years, the "attr"
    function has been documented to get/set attributes, but it never did
    that at all (except when it "detected" an XML DOM). The well-
    documented boondoggle with jQuery 1.6 was the result of changing the
    method to match the name/documentation (and never mind that it broke
    thousands of extant apps). Then they put it back the way it used to be
    on the next release. They are just going around in circles.
    What they did is the standard mystical incantation: rearranging
    patterns of code until they seem to work. Ultimately, they settled on
    using the "removeAttr" method, which was the centerpiece of my last
    jQuery review. For those who missed it, that method is confused
    nonsense as well (and changes periodically as their "test-driven"
    knowledge gathering reveals more cracks in their assumptions). If only
    they would RTFM, they wouldn't be causing so much confusion among
    beginners who rely on their "expertise" to keep them out of trouble.
     
    David Mark, Nov 4, 2011
    #9
  10. David Mark

    Eric Bednarz Guest

    That is obviously *not* valid in HTML 4. You can omit the attribute
    name, not the value.
     
    Eric Bednarz, Nov 4, 2011
    #10
  11. Indeed, testing the following on the w3 validator:

    <input type="checkbox" checked>
    <input type="checkbox" checked=>
    <input type="checkbox" checked="">
    <input type="checkbox" checked="fred">
    <input type="checkbox" checked="checked">

    Only two are valid:

    <input type="checkbox" checked="checked">
    <input type="checkbox" checked>

    Rgds

    Denis McMahon
     
    Denis McMahon, Nov 4, 2011
    #11
  12. Michael Haufe (TNO), Nov 5, 2011
    #12
    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.