Sublime Forum

Remove type attribute in script tag in JavaScript

#1

When we type ‘script’, the auto-completion would be <script type="text/javascript"></script>.

But JavaScript became the default language for HTML5 and modern browsers. So, now adding text/javascript isn’t required in <script> tag.

See also this answer from Stack Overflow.

0 Likes

#2

Still scripts can be of different type, especially in template languages such as vue.js. text/javascript is just a sane default value for the snippet which could easily be replaced by something else.

You can easily hit tab twice, followed by del to remove it, just right after the snippet was commited.

0 Likes

#3

In my opinion, the default should not include anything, just like we go to McDonald’s and the staff adds some tomato sauce in the burger even though we didn’t ask to, and then we need to manually remove the tomato sauce.

Also, I don’t think the users of template languages are larger than the users who are using vanilla/plain JavaScript.

I wish it makes sense to you :slight_smile:

0 Likes

#4

Imagine all the people who would then have to add ketchup back to the burger. I think the former outweighs the latter.

More people prefer ketchup than not

0 Likes

#6

The fact is that McDonald’s has a sauce dispenser for people to get the sauces if they would love to. Opps…So, the default still should not assume everyone needs it. And the latter outweights the former.

0 Likes

#7

I love threads like this. Everybody’s so weighted down with analogies they can’t carry any evidence.

4 Likes

#9

Evidence?

Let me talk something that is a bit out of topic but it is related:
Presumption of innocence in the legal system, which is the person is considered innocent until proven guilty.

Now you guys are also doing the so-called guessing that the community prefer to have type="text/javascript by default. But already made a judgement ( type="text/javascript" is already implemented ) without any evidence.

So instead of asking the people who don’t need it ( defendants ) by default to give the evidence, the ones who wish to have it ( prosecutors ) by default must give the evidence it is not the minority want to have it by default.

Now you’re doing the exact opposite and against the fundamental principle.

3 Likes