Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

geany - JavaScript comment starting with /*!

My editor (Geany) changes the colour of a comment when a comment starts with /*!. What's the difference between /* ... */ and /*! ... */?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The ! prevents YUI compressor from removing the comment when it compresses. (It just removes 1 ! instead. Multiple !'s mean you can compress multiple times without loss of the comment.) It's just an extension, but not part of javascript itself.

Documentation is here. Search for 'C-style comments'.

also, I'm not aware of any other compressors that respect the !. Packer, closure compiler, shrinksafe, and jsmin do not respect it at least.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...