SeaMonkey:MailNews:CodingStyle: Difference between revisions

Jump to navigation Jump to search
(Created page with '<div style="color:red">This is just a draft and may change!</div> Basically, the [https://developer.mozilla.org/En/Developer_Guide/Coding_Style Mozilla C++ coding style guide r…')
 
Line 57: Line 57:
   }
   }
  }
  }
=== XML/XUL ===
==== Indent is two spaces per nesting level ====
&lt;element>
  &lt;element>
    &lt;element/>
  &lt;/element>
&lt;/element>
==== Sort XUL attributes ====
XUL attributes should come in this rough order:
&lt;element id="menu_showMessagePane"
          label="&showMessagePaneCmd.label;"
          accesskey="&showMessagePaneCmd.accesskey;"
          key="key_toggleMessagePane"
          random_other_attributes="put 'em here!"
          oncommand="MsgToggleMessagePane(true);"/>
Especially, id should be first, label/accesskey/key should go together and handlers should be last.
==== One attribute per line when folding ====
If the XML element definition (vastly) exceeds the 80 columns limit, it should be wrapped. In this case, put each attribute onto its own line and align them vertically:
&lt;!-- Fine! -->
&lt;element id="menu_showMessagePane" type="checkbox"/>
&lt;!-- Bad! Don't do this! -->
&lt;element id="menu_showMessagePane" type="checkbox" random_other_attribute1="1" random_other_attribute2="1" random_other_attribute3="1"/>
&lt;!-- Fine! -->
&lt;element id="menu_showMessagePane"
          type="checkbox"
          random_other_attribute1="1"
          random_other_attribute2="1"
          random_other_attribute3="1"/>






<div style="text-align: right">''This page is maintained by [mailto:mnyromyr@tprac.de Karsten "Mnyromyr" Düsterloh].''</div>
<div style="text-align: right">''This page is maintained by [mailto:mnyromyr@tprac.de Karsten "Mnyromyr" Düsterloh].''</div>
235

edits

Navigation menu