Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
This is just so clever - instant JavaScript comment/un-comment (ajaxian.com)
2 points by bdfh42 on Feb 28, 2008 | hide | past | favorite | 1 comment



In files that ignore unknown or unused definitions (like CSS and HTML), my preference is just to misspell keywords and identifiers by adding an "x" prefix.

For example, if you have a block: .mystyle { font-size: smaller; . . . }

You can virtually comment-out the whole thing with one extra character: .xmystyle { font-size: smaller; . . . }

This also works to kill just one property: .mystyle { xfont-size: smaller; . . . }

It applies to HTML attributes too, e.g. <mytag class="abc"> could be disabled with <mytag class="xabc">, which is much simpler than any hack to comment-out the HTML tags or delete the class attribute.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: