Browser and self closed script tag...

I keep on doing that thing for every new project. i simply make script tag self closing, like on the example below:

<script type="text/javascript" src="" />

Browsers may behave in really strange way - just for Your curiosity - try to run it common browsers. It looks like Chrome is less immune to this than IE and Firefox. And it comes with explanation:

XML self-closing tag syntax used on . The tag will be closed by WebKit, but not all browsers do this. Change to instead for best cross-browser compatibility.

So - for Your own safety, do not use self closing on script tag. Thus anyone of You know why not all major browsers just ignore this? I know that it is ‘my’ bug cause according to html specification i shouldn’t selft close it. But we are all humans, making mistakes is in our nature…

comments powered by Disqus