W3C home > Mailing lists > Public > public-html-comments@w3.org > July 2011

Re: HTML5 suggestion: Elements of HTML section: Scripting and Document Metadata subsections

From: T.J. Crowder <tj@crowdersoftware.com>
Date: Sun, 24 Jul 2011 07:56:52 +0100
Message-ID: <CAH65x-ze8pt-JtUH3ho76uzWO2PG0AFoE6eH1zNYGpNsqCQTdQ@mail.gmail.com>
To: Andrew Martin <andrew@martinone.co.uk>
Cc: public-html-comments@w3.org
Rather than using a separate library tag, which causes
backward-compatibility issues, if something like this were to be done I'd
recommend doing it with attributes on the script tag, perhaps:

   - library - The case-insensitive name of the library ("jquery", "dojo",
   "prototype", "YUI", etc.). This is the key attribute that triggers the "use
   bundled" behavior; it explicitly declares that it's acceptable for the
   browser to use its bundled version rather than fetching the given resource
   (and, of course, tells it which library to use).
   - modules - (Optional) If the library is modular, the modules required.
   - minver - (Optional) The minimum acceptable version.
   - maxver - (Optional) The maximum acceptable version.

The browser must always supply the latest version of the given library it
has within the given range.

So for example:

<script library="jquery" minver="1.5" src="jquery-1.5.2.min.js"></script>

If the browser's latest is 1.*6*.2 (note the 6), it supplies that, because
no maxver was given.

Completely backward-compatible, but has the necessary information if browser
vendors start pre-bundling libraries.
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On 21 July 2011 00:12, Andrew Martin <andrew@martinone.co.uk> wrote:

> When using JavaScript libraries such as jQuery or MooTools, they currently
> need to be called from another file using an empty <script></script>
> element. It is not currently possible, however, for a browser to have such
> libraries pre-installed.
> I would like to suggest the introduction of an empty <library> (<library />
> in XHTML) containing the attributes:
> name (required) - the library's name. Case insensitive.
> minvers - the minimum version required
> maxvers - the maximum version required
> src - the URL of the library, if a suitable version isn't pre-installed,
> similar to <script>
> type - just like <script>, the MIME type of the library. Defaults to
> "text/javascript".
> For example, jQuery (at least 1.4) could be called using:
> <library name="jquery" minvers="1.4" src="jquery-1.6.2.min.js" />
> Thanks,
> Andrew Martin
Received on Sunday, 24 July 2011 06:57:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:26:27 UTC