通常在HTML中编写视图模板时,我的习惯是添加一些有益的注释,但这会导致测试过程中耗费大量时间。
考虑以下代码...
<!-- Here starts the sidebar -->
<div id="sidebar">
....
</div>
<!-- Here starts the main contents pane -->
<div id="main-contents">
...
</div>
<!-- Here starts the footer -->
<div id="footer">
...
</div>
现在,如果我需要隐藏视图模板的某部分,在php中,我只需选择所需的代码并放置单行注释(大多数情况下使用快捷键)。
然而,在仅支持块级注释的HTML代码中,我最终会将所有关闭注释标记(-->)删除到我想要进行注释的位置 - 就像这样...
<!-- Here starts the sidebar
<div id="sidebar">
....
</div>
<!-- Here starts the main contents pane
<div id="main-contents">
...
</div>
<!-- Here starts the footer
<div id="footer">
...
</div>-->
测试完成后,我必须经历痛苦的过程,重新添加那些闭合标签。
在HTML中是否有更好且节省时间的块注释方法?