3 ms·
I've been burned before by using <script src="..." /> and assuming it would work in all browsers. Instead, it subsumed later tags in a horrible way. I've neve
by ghayes 13y ago
I've been burned before by using <script src="..." /> and assuming it would work in all browsers. Instead, it subsumed later tags in a horrible way. I've never used empty-elements in HTML since.
- mathias 13y ago`<script src="foo" />` only works the way you’d expect it to in XHTML. Proper XHTML, that is — served with the correct `Content-Type` header. http://mathiasbynens.be/notes/xhtml5 http://mathiasbynens.be/notes/xhtml5
- bsimpson 13y agoChrome explicitly stopped supporting void syntax on the script tag to encourage people to use </script> so IE wouldn't die when it saw a <script />.
- pbhjpbhj 13y agoThat's messed up - really? Chrome covering up IE's mistakes??
- gpvos 13y agoI think it's awesome, actually. Good neighbourship. Not that they should do this all the time (there would be no end to it), but for the most egregious problems, yes, why not?
- dmethvin 13y agoRead the article, there's no way to specify "optional closing tag depending on whether a `src` property is present" so therefore it's manditory. You can, of course, write the parser to do it, but there isn't a way to express it in the HTML grammar. I always have wished that the script inside the tag would be executed if the `src` couldn't be loaded, which is something John Resig suggested years ago [1]. [1] http://ejohn.org/blog/degrading-script-tags/ http://ejohn.org/blog/degrading-script-tags/