W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2012

[whatwg] A link[scoped] usecase

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 2 Mar 2012 07:35:57 -0800
Message-ID: <CAAWBYDAgmD7Jb=vEO+kD3QVX+jX+-Ruu5jObeFneMZXivLb7dQ@mail.gmail.com>
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:

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

~TJ
Received on Friday, 2 March 2012 07:35:57 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:40 UTC