Re: [whatwg] A link rel=stylesheet scoped usecase

2012-11-29 Thread Ian Hickson
On Fri, 8 Jun 2012, Kang-Hao (Kenny) Lu wrote:
 (12/06/08 7:28), Ian Hickson wrote:
  It still seems like a bit of an edge case, so I think it's ok for us 
  to continue to rely on @import for this for now. But we should keep an 
  eye out for how often people use this technique; if it is indeed 
  something that comes up a lot, then introducing scoped= on link 
  rel=stylesheet would make sense.
 
 (12/03/03 2:03), Kang-Hao (Kenny) Lu wrote:
  A reader of html5doctor had the same problem too[1] and I can 
  certainly image other people being confused by this.
 
  [1] http://html5doctor.com/the-scoped-attribute/#link
 
 which I mentioned, Googling the string html5 scoped @import gives me 
 the following sites which mention this technique, even if there's only 
 one browser supporting the 'scoped' attribute at the moment: [2][3][4]
 
 [2] http://www.codingforums.com/showthread.php?t=242411#postcount1154993
 [3] 
 http://www.webdirections.org/blog/on-the-abominable-proposed-html5-scoped-attribute-for-style-elements/#comment-222761
 [4] 
 http://www.peterrknight.com/loading-javascript-and-css-mid-page-html5-wordpress-passing-validation-part-1/

Yeah, that's fair enough.

Righ now I can't find any browsers that implement style scoped. Unless 
link scoped is preferred by vendors than style scoped, I'd rather get 
one implemented and proven to work before we add more, so I still haven't 
added link scoped. To make sure I don't forget about this, though, I've 
filed it as a bug and will mark it LATER.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20166

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] A link rel=stylesheet scoped usecase

2012-06-07 Thread Ian Hickson
On Fri, 2 Mar 2012, Gray Zhang wrote:
 
 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:
 http://lists.w3.org/Archives/Public/www-archive/2012Mar/att-0003/code-editor-theme-panel
 
 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=keywordfunction/spanspan
 class=identifiertest/span...
 /div
 
 By now, for the reason that there is not link[scoped] and style[scoped] is
 not supported for any browser, my solution is add a data-theme attribute on
 wrapper element, and the theme .css file should add some extra selector:
 
 .visual-root[data-theme=fireworks] {
 background-color: #404040;
 color: #addede;
 }
 
 The addition of [data-theme=foo] selector is a really bad smell for me,
 in such case I also provided theme author a script to auto generate a theme
 structure, but all these could be solved with the support of link[scoped]
 element.

This is the first time I've seen a good use case for this!

It still seems like a bit of an edge case, so I think it's ok for us to 
continue to rely on @import for this for now. But we should keep an eye 
out for how often people use this technique; if it is indeed something 
that comes up a lot, then introducing scoped= on link rel=stylesheet 
would make sense.


On Fri, 2 Mar 2012, Tab Atkins Jr. wrote:
 
 Do this instead:
 
 div
   style scoped
 @import 3rd-party-theme/user-published-20120302133702.css;
   /style
   span class=keywordfunction/spanspan 
 class=identifiertest/span...
 /div

That's a good workaround, but if the use case is something we want to 
actually address, I think supporting link here makes sense too.


On Fri, 2 Mar 2012, Tab Atkins Jr. wrote:
 On Fri, Mar 2, 2012 at 10:03 AM, Kang-Hao (Kenny) Lu
 kennyl...@csail.mit.edu wrote:
  
  I talked to Hixie on IRC[1] and he seems to think that there's no use
  case for style@import/style either.
 
 Hixie has odd views sometimes.  ^_^ 

For the record, I meant specifically a style scoped @import. Obviously 
@import in general has plenty of uses -- the same ones as link, mostly.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] A link rel=stylesheet scoped usecase

2012-06-07 Thread Kang-Hao (Kenny) Lu
(12/06/08 7:28), Ian Hickson wrote:
 It still seems like a bit of an edge case, so I think it's ok for us
 to continue to rely on @import for this for now. But we should keep
 an eye out for how often people use this technique; if it is indeed
 something  that comes up a lot, then introducing scoped= on
 link rel=stylesheet would make sense.

I don't know if this counts as a lot or not, but besides

(12/03/03 2:03), Kang-Hao (Kenny) Lu wrote:
 A reader of html5doctor had the same problem too[1] and I can
 certainly image other people being confused by this.

 [1] http://html5doctor.com/the-scoped-attribute/#link

which I mentioned, Googling the string html5 scoped @import gives me
the following sites which mention this technique, even if there's only
one browser supporting the 'scoped' attribute at the moment: [2][3][4]

I haven't examine these use cases to see if they are counted valid or
not, but I think it's unfair to say this is an edge case.

[2] http://www.codingforums.com/showthread.php?t=242411#postcount1154993
[3]
http://www.webdirections.org/blog/on-the-abominable-proposed-html5-scoped-attribute-for-style-elements/#comment-222761
[4]
http://www.peterrknight.com/loading-javascript-and-css-mid-page-html5-wordpress-passing-validation-part-1/

 On Fri, 2 Mar 2012, Tab Atkins Jr. wrote:

 Do this instead:

 div
   style scoped
 @import 3rd-party-theme/user-published-20120302133702.css;
   /style
   span class=keywordfunction/spanspan 
 class=identifiertest/span...
 /div
 
 That's a good workaround, but if the use case is something we want to 
 actually address, I think supporting link here makes sense too.

A good portion of the use of style scoped would just be something like
this, and I still don't see good reasons why

  style scoped@import
3rd-party-theme/user-published-20120302133702.css;/style

is preferable to

  link scoped rel=stylesheet
href=3rd-party-theme/user-published-20120302133702.css

when the later is clearly easier to think of (or otherwise Gray or the
the reader of html5doctor wouldn't have asked this).


Tab mentioned

(12/03/03 2:13), Tab Atkins Jr. wrote:
 As well, right now the *only* purpose of a link in the body is to
 function as a hidden source of url-flavored data for Microdata, if you
 find empty as distasteful.

but given that Microdata already breaks this tradition, I don't see how
it is still relevant.


Cheers,
Kenny