W3C home > Mailing lists > Public > public-html@w3.org > May 2007

Re: Unscoped <style> found outside the <head>

From: Preston L. Bannister <preston@bannister.us>
Date: Sun, 27 May 2007 16:24:31 -0700
Message-ID: <7e91ba7e0705271624l68220bb7q7951be5c272c6692@mail.gmail.com>
To: "Anne van Kesteren" <annevk@opera.com>
Cc: "Daniel Glazman" <daniel.glazman@disruptive-innovations.com>, "Brad Fults" <bfults@neatbox.com>, "Bruce Boughton" <bruce@bruceboughton.me.uk>, "David Hyatt" <hyatt@apple.com>, "Dan Connolly" <connolly@w3.org>, "public-html@w3.org WG" <public-html@w3.org>
Funny thing is, while this discussion was going on in email (with which I
just caught up), I was once again running into an instance where I really
wish HTML/CSS had a concept of scope.  Not the same specifics are discussed
here, but a similar underlying notion.  In fact, this is one of the lacks I
found astonishing when first coming fully acquainted with HTML 4 and CSS
(hint: document. formName.elementName should strike you as wrong).

When a page is built from inclusions gathered from multiple sources, there
is (so far as I can tell) no notion of scope.  This bound to be a problem as
mashups become increasingly common.  The notion of scope is not exactly new
in computer science.

The proposal in the WHATWG spec is not exactly what I was hoping to find.
What I was hoping to find was named scopes.  By way of a hypothetical

<link scope="com.google.maps" rel="stylesheet" href="
http://maps.google.com/styles.css" type="text/css">
<style scope="com.google.maps">
... my local enhancements to Google Maps styles ...

<p>Map of somewhere</p>
<div scope="com.google.maps">
... inclusion from Google Maps ...

<p>Map of somewhere else</p>
<div scope="com.google.maps">
... inclusion from Google Maps ...

The styles from the external site could be efficiently and minimally
included once.  (Where in the WHATWG proposal they may be fetched more than
once?)  The use of <div scope=""> makes that scope the current scope.  Class
names resolved within the scoped DIV will look first in the scope namespace
(the usual rules for scopes).

Oddly enough the scoped=boolean attribute triggers the same
candidate-for-refactoring rule as function calls with boolean parameters. :)
Received on Sunday, 27 May 2007 23:24:42 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 16:25:06 UTC