This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25399 - Has it been considered or discussed to add a src-attribute to the style-element? It has always puzzled me why external stylesheets are loaded using link and not style. In comparison, scripts use the s [...]
Summary: Has it been considered or discussed to add a src-attribute to the style-eleme...
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-21 14:36 UTC by contributor
Modified: 2014-05-08 22:51 UTC (History)
2 users (show)

See Also:


Attachments

Description contributor 2014-04-21 14:36:45 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html
Multipage: http://www.whatwg.org/C#the-style-element
Complete: http://www.whatwg.org/c#the-style-element
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
Has it been considered or discussed to add a src-attribute to the
style-element? It has always puzzled me why external stylesheets are loaded
using link and not style. In comparison, scripts use the script-element
regardless is they are inline or external. Adding this attribute creates more
flexibility without breaking backward compatibility. The advanteges are:
easier to detect styles (no confusion with other link-types), can combine
inline with external in same element (for overrides), scoped styles can be
external (there is no scoped attribute on link). The biggest problem it will
solve in the future is use of scoped styles in Web Components (which are now
either forced to be inline or declared using @scope in the global external
stylesheet)

Posted from: 81.207.54.65
User agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Comment 1 Ian 'Hixie' Hickson 2014-04-22 18:27:47 UTC
It's mostly legacy. There's so many ways of importing scripts already, that adding more seems like unnecessary pain.

We might add scoping to <link>, as in <link rel=stylesheet scoped src="...">, if there's enough demand. So far, even <style scoped> hasn't been implemented much, so I haven't followed up on this.

In the meantime you can do:

   <style scoped>@import ...;</style>

See bug 20166.
Comment 2 Ian 'Hixie' Hickson 2014-05-08 22:51:16 UTC
Closing per comment 1; if you disagree, please reopen.