[whatwg] A link[scoped] usecase

Tab Atkins Jr. jackalmage at gmail.com
Fri Mar 2 07:35:57 PST 2012

On Fri, Mar 2, 2012 at 2:59 AM, Gray Zhang <otakustay at gmail.com> wrote:
> Hi all:
> I've noticed a scoped attribute for link element has been previously
> discussed, I'm currently working with some new HTML features and find a
> case where the scoped attribute is required on link element.
> I'm working on an code editor and building up a scalable theme system, as I
> designed, it should satisfy a list of requirements:
> 1. user (3rd party) can publish their theme to my system
> 2. user can preview themes and choose one for their editor
> 3. there is no server side support such as providing a snapshot image for
> skin
> 4. a theme is simply a .css file without anything else
> The preview-and-choose panel may look like this:
> [image: Inline image 1]
> Each preview pane is constructed with pure DOM, if link[scoped] is
> supported, I could have some elements and text in a wapper, then apply an
> external css on this wrapper so that color/background effect could be
> rendered:
> <div>
>    <!-- This link element only works for it's containing div -->
>    <link rel="stylesheet"
> href="3rd-party-theme/user-published-20120302133702.css" scoped="scoped" />
>    <span class="keyword">function</span><span
> class="identifier">test</span>...
> </div>

Do this instead:

  <style scoped>
    @import "3rd-party-theme/user-published-20120302133702.css";
  <span class="keyword">function</span><span> class="identifier">test</span>...


More information about the whatwg mailing list