[whatwg] HTML 5 Script Tag

On Thu, 6 Aug 2009, Cready, James wrote:
>
> Is there any good reason why a <script> tag with the src attribute 
> specified can?t be self-closing?

No elements in text/html can be self-closing. In the case of <script> in 
particular, allowing it would be a compatibility problem at best and a 
security risk at worst due to differing handling in legacy UAs.


On Thu, 6 Aug 2009, Cready, James wrote:
>
> I'm also curious as to why you're even allowed to specify an external 
> src on a <script> tag.

At this point, because that's what pages depend on and what browsers do. 
It was years too late to change that before we started HTML5.


On Thu, 6 Aug 2009, Aryeh Gregor wrote:
> 
> This logic says we shouldn't remove existing features that current 
> websites depend on, but it doesn't prevent us from introducing new 
> features to improve consistency in the long term.  Authors shouldn't use 
> the features (e.g., src= on <style>) as long as there are some browsers 
> that don't support them, of course, but eventually they should be 
> usable.  It wouldn't really allow you to do anything you couldn't do 
> already, but the same is true for plenty of HTML 5 features.

Generally speaking I think we should avoid making the platform have too 
many redundant features, however illogical some of them might be.


On Thu, 6 Aug 2009, Greg Houston wrote:
> 
> This makes sense to me as well. Last week a user of my framework posted 
> to the forums asking for help. The JavaScript was not loading, and it 
> turned out he was trying to self-close the script tags in the header. So 
> for at least some percentage of people the intuited expectation is that 
> the script tag can be self-closing like the link tag.

I agree that some people expect this. I don't think that making it work 
with exactly one element and dependent on the presence of an attribute is 
the way to improve this situation, however.

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

Received on Thursday, 13 August 2009 22:11:15 UTC