Loading ...
Sorry, an error occurred while loading the content.

Re: [jslint] script tag 'type' attribute

Expand Messages
  • Jakob Kruse
    This is true. JSLint is all about code quality, not standards. I understand that completely. But requiring that users of the tool make their html files
    Message 1 of 7 , Oct 16, 2008
    • 0 Attachment
      This is true. JSLint is all about code quality, not standards. I understand that completely. But requiring that users of the tool make their html files non-compliant with W3C specs seems to me like a bad idea, especially when the "error" preventing a seal of approval from JSLint reads "type is unnecessary". Yes, it's unnecessary. It doesn't do anything at all. But it is also required, so could JSLint please stop complaining about it so I can get on with improving the quality of my code? :-)

      JSLint could be improved, IMHO, by either a) not flagging this as an error (a warning/recommendation concept might be useful?) or b) including an option to remove this check altogether.

      /Jakob


      ----- Original Message -----
      From: mnewton32@...
      To: jslint_com@yahoogroups.com
      Sent: Thursday, October 16, 2008 7:13 PM
      Subject: Re: [jslint] script tag 'type' attribute


      Many of the "features" in JSLint have nothing to do with standards or even widely-used practices. It's a tool written by one guy to make sure things are the way he likes them. As long as you keep that in the back of your head while using it, it's a fantastic tool.

      Sent from my BlackBerry device on the Rogers Wireless Network

      -----Original Message-----
      From: "Jakob Kruse" <kruse@...>

      Date: Thu, 16 Oct 2008 16:39:32
      To: <jslint_com@yahoogroups.com>
      Subject: Re: [jslint] script tag 'type' attribute


      That doesn't seem helpful. Stricly speaking, "text/javascript" *is* a
      valid MIME type. It is listed by IANA. It is listed as "obsolete"
      though, with a reference to use "application/javascript" instead.

      Using "application/javascript" does not prevent JSLint from
      complaining that "type is unnecessary".

      I also disagree with the statement that "4.01 is in error". 4.01 is a
      standard. *The* standard even, and as such can not be "in error".
      Omitting the "type" attribute from a script tag *should* cause a 100%
      standards compliant browser (I know that such a thing doesn't exist)
      to reject at least the script tag, and probably the entire document.
      Who would want that?

      Wouldn't it be more helpful for JSLint to suggest using
      "application/javascript" instead, or including an option to turn of
      this "feature"? Using JSLint on an HTML file should not incite people
      to write broken (as in "non-valid") HTML.

      /Jakob


      --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
      >
      > 4.01 in in error. "text/javascript" is not a valid MIME type.
      >
      > Jakob Kruse wrote:
      > > Why does JSLint complain that "type is unnecessary" when it sees a
      > > script element with a type attribute in an html file?
      > >
      > > Is there any way to turn this behaviour off?
      > >
      > > The HTML 4.01 specification reads:
      > >
      > > type = content-type [CI]
      > > This attribute specifies the scripting language of the element's
      > > contents and overrides the default scripting language. The scripting
      > > language is specified as a content type (e.g., "text/javascript").
      > > Authors must supply a value for this attribute. There is no default
      > > value for this attribute.
      > >
      (http://www.w3.org/TR/1999/REC-html401-19991224/interact/scripts.html#adef-type-SCRIPT)
      > >
      > > Note that valid HTML 4.01 -MUST- include the type attribute. So must
      > > valid XHTML 1.0 and 1.1 (those specifications refer to the 4.01 spec).
      > >
      > > /Jakob
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      >




      [Non-text portions of this message have been removed]





      [Non-text portions of this message have been removed]
    • Andy Stevens
      If you re writing an HTML & javascript based application for Adobe AIR, type= application/x-shockwave-flash is also a valid value (when linking in a .swf
      Message 2 of 7 , Oct 16, 2008
      • 0 Attachment
        If you're writing an HTML & javascript based application for Adobe
        AIR, type="application/x-shockwave-flash" is also a valid value (when
        linking in a .swf compiled actionscript library), in which case the
        attribute *is* necessary...
        An option to disable the check sounds useful to me.


        Andy.

        2008/10/16 Jakob Kruse <kruse@...>:
        > This is true. JSLint is all about code quality, not standards. I understand that completely. But requiring that users of the tool make their html files non-compliant with W3C specs seems to me like a bad idea, especially when the "error" preventing a seal of approval from JSLint reads "type is unnecessary". Yes, it's unnecessary. It doesn't do anything at all. But it is also required, so could JSLint please stop complaining about it so I can get on with improving the quality of my code? :-)
        >
        > JSLint could be improved, IMHO, by either a) not flagging this as an error (a warning/recommendation concept might be useful?) or b) including an option to remove this check altogether.
        >
        > /Jakob
        >
        >
        > ----- Original Message -----
        > From: mnewton32@...
        > To: jslint_com@yahoogroups.com
        > Sent: Thursday, October 16, 2008 7:13 PM
        > Subject: Re: [jslint] script tag 'type' attribute
        >
        >
        > Many of the "features" in JSLint have nothing to do with standards or even widely-used practices. It's a tool written by one guy to make sure things are the way he likes them. As long as you keep that in the back of your head while using it, it's a fantastic tool.
        >
        > Sent from my BlackBerry device on the Rogers Wireless Network
        >
        > -----Original Message-----
        > From: "Jakob Kruse" <kruse@...>
        >
        > Date: Thu, 16 Oct 2008 16:39:32
        > To: <jslint_com@yahoogroups.com>
        > Subject: Re: [jslint] script tag 'type' attribute
        >
        >
        > That doesn't seem helpful. Stricly speaking, "text/javascript" *is* a
        > valid MIME type. It is listed by IANA. It is listed as "obsolete"
        > though, with a reference to use "application/javascript" instead.
        >
        > Using "application/javascript" does not prevent JSLint from
        > complaining that "type is unnecessary".
        >
        > I also disagree with the statement that "4.01 is in error". 4.01 is a
        > standard. *The* standard even, and as such can not be "in error".
        > Omitting the "type" attribute from a script tag *should* cause a 100%
        > standards compliant browser (I know that such a thing doesn't exist)
        > to reject at least the script tag, and probably the entire document.
        > Who would want that?
        >
        > Wouldn't it be more helpful for JSLint to suggest using
        > "application/javascript" instead, or including an option to turn of
        > this "feature"? Using JSLint on an HTML file should not incite people
        > to write broken (as in "non-valid") HTML.
        >
        > /Jakob
        >
        >
        > --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
        >>
        >> 4.01 in in error. "text/javascript" is not a valid MIME type.
        >>
        >> Jakob Kruse wrote:
        >> > Why does JSLint complain that "type is unnecessary" when it sees a
        >> > script element with a type attribute in an html file?
        >> >
        >> > Is there any way to turn this behaviour off?
        >> >
        >> > The HTML 4.01 specification reads:
        >> >
        >> > type = content-type [CI]
        >> > This attribute specifies the scripting language of the element's
        >> > contents and overrides the default scripting language. The scripting
        >> > language is specified as a content type (e.g., "text/javascript").
        >> > Authors must supply a value for this attribute. There is no default
        >> > value for this attribute.
        >> >
        > (http://www.w3.org/TR/1999/REC-html401-19991224/interact/scripts.html#adef-type-SCRIPT)
        >> >
        >> > Note that valid HTML 4.01 -MUST- include the type attribute. So must
        >> > valid XHTML 1.0 and 1.1 (those specifications refer to the 4.01 spec).
        >> >
        >> > /Jakob
        --
        http://pseudoq.sourceforge.net/ Open source java sudoku application
      Your message has been successfully submitted and would be delivered to recipients shortly.