Side navigation
#10614 closed bug (wontfix)
Opened October 29, 2011 11:23AM UTC
Closed October 29, 2011 10:39PM UTC
Last modified October 30, 2011 08:14PM UTC
Commenting style
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | misc | Version: | 1.7b2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
From 1.7rc1:
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
This type of commenting goes against the code style guidelines (http://docs.jquery.com/JQuery_Core_Style_Guidelines)
Attachments (0)
Change History (6)
Changed October 29, 2011 01:31PM UTC by comment:1
Changed October 29, 2011 10:39PM UTC by comment:2
_comment0: | Although our style guide doesn't explicitly cover comments of this nature, please remember that comment formats may deviate where it's absolutely necessary. Take for example the code you cited, albeit in a simpler form with the other comment format used: \ \ {{{ \ function on(a , b , c //comments){ console.log('hello world'); } \ }}} \ \ If you paste this into your console, you'll get a syntax error as the comment is being used inline but expects the rest of the line to also be a comment. Contrast this with: \ \ {{{ \ function on(a , b , c /*comments*/){ console.log('hello world'); } \ }}} \ \ which preserves the comment but doesn't result in any syntax errors because we've implicitly stated where the comment block ends (this is why '//' style comments are generally used on either a dedicated line or at the end of a line and '/**/' style comments can be used anywhere). I hope that clears it up! \ → 1319928020162236 |
---|---|
component: | unfiled → misc |
priority: | undecided → low |
resolution: | → wontfix |
status: | new → closed |
Although our style guide doesn't explicitly cover comments of this nature, please remember that comment formats may deviate where it's absolutely necessary. Take for example the code you cited, albeit in a simpler form with the other comment format used:
function on(a , b , c //comments){ console.log('hello world'); }
If you paste this into your console, you'll get a syntax error as the comment is being used inline but expects the rest of the line to also be a comment. Contrast this with:
function on(a , b , c /*comments*/){ console.log('hello world'); }
which preserves the comment but doesn't result in any syntax errors because we've implicitly stated where the comment block ends (this is why '//' style comments are generally used on either a dedicated line or at the end of a line and the other style of comments can be used anywhere). I hope that clears it up!
Changed October 30, 2011 10:48AM UTC by comment:3
That's not my point Addy. I think it should be:
// The third argument c is special function on(a, b, c) { console.log('hello world'); }
As the style guide says (http://docs.jquery.com/JQuery_Core_Style_Guidelines#Comments)
Single line comments should always be on their own line
Changed October 30, 2011 06:17PM UTC by comment:4
The /* internal */ comment is used for internal arguments in several places. I think we all prefer that because it's easy-to-read and makes sense. I'd be ok with adding this exception to the styleguide.
Changed October 30, 2011 08:11PM UTC by comment:5
+1 timmywil
Same goes with