Are Type Attributes on SCRIPT, STYLE, and LINK elements still needed?

前端 未结 4 462
时光取名叫无心
时光取名叫无心 2021-01-12 02:41

You will see many sites with the following type of code:

Script elements:



        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-12 03:24

    They are currently not required. Because all browsers assume the default that you would expect.

    But they may become important in the future.

    For example, when Google Dart becomes fully integrated in the browsers, and we then finally have an alternative to JavaScript. Similarly, once someone proposes a nice replacement for CSS, we will need this. And it may well be that Dart becomes "JavaScript 2.0". And the bastard language that JavaScript is surely needs a more sane replacement. I guess we are all only using it, because there is no alternative that works cross-browser (and in fact, not even one that works in a single browser, I guess ...).

    So if you plan your site to live for a year: don't bother. If you plan to have the site running for 10 years, try to be verbose about your content types, formats and versions.

提交回复
热议问题