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 14491 - 'script' and 'style' are not consistent. 'script' have a 'src' attribute, but 'style' does not have a 'src' attribute. If the 'script' element is the cousin of 'style', then why doesn't both none of them have the src attribute? 'link' is used to load styl
Summary: 'script' and 'style' are not consistent. 'script' have a 'src' attribute, but...
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-18 12:45 UTC by contributor
Modified: 2011-10-24 14:41 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2011-10-18 12:45:08 UTC
Specification: http://dev.w3.org/html5/spec/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
'script' and 'style' are not consistent.
'script' have a 'src' attribute, but 'style' does not have a 'src' attribute.
If the 'script' element is the cousin of 'style', then why doesn't both none
of them have the src attribute?

'link' is used to load style sheets, but not scripts.

Why is that you load CSS with link, but not JavaScript with link?
Both JavaScript and CSS are external resources and should be loaded in the
same way.

If scripts are loaded with the 'script' element, then why are not style sheets
loaded with the 'style' element?

== Consistent (Good) ==
<script src="script.js">
<style src="style.css">

== Consistent (Good) ==
<link src="script.js">
<link src="style.css">

== Inconsistent (Bad) ==
<link src="script.js">
<style src="style.css">

Posted from: 212.247.162.243
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Comment 1 Simon Pieters 2011-10-18 13:43:01 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: We can't change this now because deployed content depends on this being as it is.
Comment 2 Cameron Jones 2011-10-18 13:57:07 UTC
Do you mean that there is deployed content that depends on style not having a 'src' attribute? This addition provides the consistency which the bug author intends and is a new attribute so shouldn't affect currently deployed content.
Comment 3 Lars Gunther 2011-10-22 18:50:17 UTC
(In reply to comment #2)
> Do you mean that there is deployed content that depends on style not having a
> 'src' attribute? This addition provides the consistency which the bug author
> intends and is a new attribute so shouldn't affect currently deployed content.

There is a lot more to it than that. Where would such content fit in the cascade? 
And how would src-attribute provided content relate to styles provided within the HTML between the tags? Legacy browsers would ignore the src attribute an use thos rules, but that's very inconsistent compared to the script element that ignores the element content if a src attribute is provided.

And then there is the issue of polyfills. To write the in a way that ensures a propwer cascading order is nigh impossible.

This is actually a quite large addition to browser parsing algotithms for no benefit except purity of style, which is not really that valuable.

We can link to external stylesheets already. Use case solved and it is not THAT hard to learn how to do it. Trust me, I teach this to newbies for a living.
Comment 4 Cameron Jones 2011-10-24 14:41:25 UTC
(In reply to comment #3)
> There is a lot more to it than that. Where would such content fit in the
> cascade? 
> And how would src-attribute provided content relate to styles provided within
> the HTML between the tags? Legacy browsers would ignore the src attribute an
> use thos rules, but that's very inconsistent compared to the script element
> that ignores the element content if a src attribute is provided.
> 
> And then there is the issue of polyfills. To write the in a way that ensures a
> propwer cascading order is nigh impossible.
> 
> This is actually a quite large addition to browser parsing algotithms for no
> benefit except purity of style, which is not really that valuable.
> 
> We can link to external stylesheets already. Use case solved and it is not THAT
> hard to learn how to do it. Trust me, I teach this to newbies for a living.

Thanks for the clarity, i thought there might be some complexity in implementing this and with the addition of legacy browsers ignoring src references makes it practically impossible.

In a pie-in-the-sky world, i would love to see for style & scripts to use the src attribute to reference an external document but the contents of the tags to be use for over-riding the imported context, ie:

<style src="external-stylesheet.css">
    h1 { color: red; } <!-- over-ridden attribute -->
</style>


OR 

<script src="external-script.js">
    config.initParamA = "1000";
    config.initParamB = "yellow";
</script>

So that you can almost have template imports and their configuration in the same place....ahh the pie in the sky!