From e9a8ee8915c390e3316cd135aaf4167d737a92d1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Sun, 18 Mar 2018 18:16:13 -0600 Subject: [PATCH 01/22] Multi-line IF statement not indented correctly --- Joomla/Sniffs/Commenting/FunctionCommentSniff.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Joomla/Sniffs/Commenting/FunctionCommentSniff.php b/Joomla/Sniffs/Commenting/FunctionCommentSniff.php index f224e2c4..1ad95e77 100644 --- a/Joomla/Sniffs/Commenting/FunctionCommentSniff.php +++ b/Joomla/Sniffs/Commenting/FunctionCommentSniff.php @@ -147,7 +147,7 @@ protected function processReturn(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $co { if ($tokens[$returnToken]['code'] === T_CLOSURE || $tokens[$returnToken]['code'] === T_ANON_CLASS - ) + ) { $returnToken = $tokens[$returnToken]['scope_closer']; continue; @@ -156,7 +156,7 @@ protected function processReturn(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $co if ($tokens[$returnToken]['code'] === T_RETURN || $tokens[$returnToken]['code'] === T_YIELD || $tokens[$returnToken]['code'] === T_YIELD_FROM - ) + ) { break; } @@ -186,7 +186,7 @@ protected function processReturn(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $co { if ($tokens[$returnToken]['code'] === T_CLOSURE || $tokens[$returnToken]['code'] === T_ANON_CLASS - ) + ) { $returnToken = $tokens[$returnToken]['scope_closer']; continue; @@ -195,7 +195,7 @@ protected function processReturn(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $co if ($tokens[$returnToken]['code'] === T_RETURN || $tokens[$returnToken]['code'] === T_YIELD || $tokens[$returnToken]['code'] === T_YIELD_FROM - ) + ) { break; } From ee2471ae4bec37a429f052cdbb8294460390fe38 Mon Sep 17 00:00:00 2001 From: Roland Dalmulder Date: Mon, 13 Aug 2018 16:00:14 +0200 Subject: [PATCH 02/22] We should use quoteName and not qn Signed-off-by: Roland Dalmulder --- manual/php.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manual/php.md b/manual/php.md index 1a060c3b..20d1f2db 100644 --- a/manual/php.md +++ b/manual/php.md @@ -522,10 +522,10 @@ $query->select($db->quoteName(array('user_id', 'profile_key', 'profile_value', ' ```php $query = $db->getQuery(true) ->select(array( - $db->qn('profile_key'), - $db->qn('profile_value'), + $db->quoteName('profile_key'), + $db->quoteName('profile_value'), )) - ->from($db->qn('#__user_profiles')) - ->where($db->qn('user_id') . ' = ' . $db->q((int) $userId)) - ->order($db->qn('ordering')); + ->from($db->quoteName('#__user_profiles')) + ->where($db->quoteName('user_id') . ' = ' . (int) $userId) + ->order($db->quoteName('ordering')); ``` From 4d5cefaa96d1ec9b60d2c0461d236d4ab0d1b5be Mon Sep 17 00:00:00 2001 From: Roland Dalmulder Date: Mon, 13 Aug 2018 16:10:06 +0200 Subject: [PATCH 03/22] Define order of namespace imports Signed-off-by: Roland Dalmulder --- manual/php.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/manual/php.md b/manual/php.md index 20d1f2db..a02b62a1 100644 --- a/manual/php.md +++ b/manual/php.md @@ -401,6 +401,31 @@ class JFooHelper } ``` +### Namespaces + +Namespaces are formatted according to this flow. First there is the file docblock followed by the namespace the file lives in. After that we get the `defined` check and after that the +imports using the `use` keyword. All namespace imports must be alphabetically ordered. + +```php +/** + * @package Joomla.Administrator + * @subpackage mod_quickicon + * + * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace Joomla\Module\Quickicon\Administrator\Helper; + +defined('_JEXEC') or die; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Router\Route; +use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent; +``` + ### Constants Constants should always be all-uppercase, with underscores to separate words. Prefix constant names with the uppercase name of the class/package they are used in. For example, the constants used by the `JError` class all begin with `JERROR_`. From 1e6f4d748aa42fc8bf96bf48dff0d1f3eb6a10dd Mon Sep 17 00:00:00 2001 From: Roland Dalmulder Date: Mon, 13 Aug 2018 16:36:18 +0200 Subject: [PATCH 04/22] Updated text Signed-off-by: Roland Dalmulder --- manual/php.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/php.md b/manual/php.md index a02b62a1..782c9da3 100644 --- a/manual/php.md +++ b/manual/php.md @@ -403,7 +403,7 @@ class JFooHelper ### Namespaces -Namespaces are formatted according to this flow. First there is the file docblock followed by the namespace the file lives in. After that we get the `defined` check and after that the +Namespaces are formatted according to this flow. First there is the file docblock followed by the namespace the file lives in. When requires we get the `defined` check and after that the imports using the `use` keyword. All namespace imports must be alphabetically ordered. ```php From a91216d2e0f83daac9f01579a5cd9bea9e29aa3b Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Mon, 13 Aug 2018 09:54:12 -0500 Subject: [PATCH 05/22] Slight tweaks. --- manual/php.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manual/php.md b/manual/php.md index 782c9da3..f6116227 100644 --- a/manual/php.md +++ b/manual/php.md @@ -403,8 +403,8 @@ class JFooHelper ### Namespaces -Namespaces are formatted according to this flow. First there is the file docblock followed by the namespace the file lives in. When requires we get the `defined` check and after that the -imports using the `use` keyword. All namespace imports must be alphabetically ordered. +Namespaces are formatted according to this flow. First there is the file docblock followed by the namespace the file lives in. When required, the namespace is followed by the `defined` check. Lastly, the +imported classes using the `use` keyword. All namespace imports must be alphabetically ordered. ```php /** From 9341c0824ab386a25e1ea5d2d8e19c1cb8d16a36 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sun, 19 Aug 2018 18:12:09 -0500 Subject: [PATCH 06/22] Optimize links for display on dev site --- manual/README.md | 10 ++++++++++ manual/introduction.md | 2 +- manual/php.md | 12 ++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 manual/README.md diff --git a/manual/README.md b/manual/README.md new file mode 100644 index 00000000..0a4d614b --- /dev/null +++ b/manual/README.md @@ -0,0 +1,10 @@ +# Joomla Coding Standards Manual +This manual documents the Joomla Coding Standards + +## Meta Information +The documentation in this repository is optimised for display in the [coding standards section](https://developer.joomla.org/coding-standards.html) of the Joomla! Developer Network. When formatting and proposing changes to this documentation, please keep the following in mind: + +- Heading levels should start at `

` +- The document title does NOT need to be included in the document, these are displayed as the page heading based on the Joomla component configuration and would result in duplicated titles if included +- Because the GitHub Markdown parser interprets line breaks as `
` tags, arbitrary line breaks to keep lines from becoming too long should not be used +- Links to documents in this manual should be formatted for use on the Joomla! Developer Network, such as `[a link to the Basic Guidelines page](/coding-standards/basic-guidelines.html)` diff --git a/manual/introduction.md b/manual/introduction.md index 4d70c8b7..fc99c6f4 100644 --- a/manual/introduction.md +++ b/manual/introduction.md @@ -12,7 +12,7 @@ This manual compiles the collective wisdom of past and present contributors to t The Joomla Coding Standards borrows heavily from the PEAR coding standard for PHP files, augmenting and diverging where it is deemed sensible to do so. -There are [tools available](appendices/analysis.md) to help your code conform to our standards. +There are [tools available](/coding-standards/analysis.html) to help your code conform to our standards. ## Contributing to this manual diff --git a/manual/php.md b/manual/php.md index f6116227..6ad2444e 100644 --- a/manual/php.md +++ b/manual/php.md @@ -228,7 +228,7 @@ For example, do not include feature submissions like: //$code = broken($fixme); ``` -More details on inline code comments can be found in the chapter on [Inline Code Comments](inline-comments.md). +More details on inline code comments can be found in the chapter on [Inline Code Comments](/coding-standards/inline-code-comments.html). ### Comment Docblocks @@ -236,7 +236,7 @@ Documentation headers for PHP and Javascript code in files, classes, class prope These "DocBlocks" borrow from the PEAR standard but have some variations specific for Joomla and the Joomla Platform. -More details on DocBlocks comments can be found in the chapter on [DocBlocks Comments](docblocks.md). +More details on DocBlocks comments can be found in the chapter on [DocBlocks Comments](/coding-standards/docblocks.html). ## Function Calls @@ -259,7 +259,7 @@ $long = bar('long'); Function definitions start on a new line with no spaces between the function name and the opening parenthesis. Additionally, the opening and closing braces are also placed on new lines. An empty line should precede lines specifying the return value. Function definitions must include a documentation comment in accordance with the Commenting section of this document. -More details on DocBlocks Function comments can be found in the chapter on [DocBlocks Comments](docblocks.md). +More details on DocBlocks Function comments can be found in the chapter on [DocBlocks Comments](/coding-standards/docblocks.html). ```php /** @@ -309,17 +309,17 @@ Class definitions start on a new line and the opening and closing braces are als Class definitions, properties and methods must each be provided with a DocBlock in accordance with the following sections. -More details on DocBlocks Class comments can be found in the chapter on [DocBlocks Comments](docblocks.md). +More details on DocBlocks Class comments can be found in the chapter on [DocBlocks Comments](/coding-standards/docblocks.html). ### Class Property DocBlocks -More details on Class Property DocBlocks can be found in the chapter on [DocBlocks Comments](docblocks.md). +More details on Class Property DocBlocks can be found in the chapter on [DocBlocks Comments](/coding-standards/docblocks.html). ### Class Method DocBlocks The DocBlock for class methods follows the same convention as for PHP functions. -More details on DocBlocks Class Method comments can be found in the chapter on [DocBlocks Comments](docblocks.md). +More details on DocBlocks Class Method comments can be found in the chapter on [DocBlocks Comments](/coding-standards/docblocks.html). ### Class Definition Example ```php From fc420f31e38d6af8ff1c895622893b129d6ebf86 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sun, 19 Aug 2018 19:05:28 -0500 Subject: [PATCH 07/22] Manual formatting --- manual/appendices/analysis.md | 22 ++-- manual/appendices/examples.md | 2 +- manual/basic-guidelines.md | 9 +- manual/css.md | 38 ++++--- manual/docblocks.md | 11 +- manual/html.md | 87 +++++++++------- manual/inline-comments.md | 23 ++-- manual/introduction.md | 6 +- manual/javascript.md | 150 ++++++++++++++------------ manual/license.md | 14 +-- manual/php.md | 174 ++++++++++++++----------------- manual/scss.md | 41 ++++---- manual/source-code-management.md | 5 +- manual/xml.md | 19 ++-- 14 files changed, 287 insertions(+), 314 deletions(-) diff --git a/manual/appendices/analysis.md b/manual/appendices/analysis.md index 6f36fe56..5391b360 100644 --- a/manual/appendices/analysis.md +++ b/manual/appendices/analysis.md @@ -1,16 +1,12 @@ -## Coding Standards Analysis - For new contributions we are going to be enforcing coding standards to ensure that the coding style in the source code is consistent. Ensuring that your code meets these standards will make the process of code contribution smoother. -## Configuring Code Analysis Tools +### Configuring Code Analysis Tools -In order to improve the consistency and readability of the source code, the Joomla project runs a coding style analysis tool, CodeSniffer, everytime changes are pushed to a Joomla project's repository. +In order to improve the consistency and readability of the source code, the Joomla project runs a coding style analysis tool, PHP_CodeSniffer, everytime changes are pushed to a Joomla project's repository. -### Running CodeSniffer +#### Running PHP_CodeSniffer -The Joomla Coding Standards sniffer rules are written to be used with a tool called PHP CodeSniffer. Please see the [PHP CodeSniffer Pear -Page](http://pear.php.net/package/PHP_CodeSniffer) for information on -installing PHP CodeSniffer on your system. +The Joomla Coding Standards sniffer rules are written to be used with a tool called PHP CodeSniffer. Please see the [PHP_CodeSniffer PEAR Page](http://pear.php.net/package/PHP_CodeSniffer) for information on installing PHP_CodeSniffer on your system. You can run the CodeSniffer by going to the CMS, Framework, or Issue Tracker's root directory and executing @@ -24,16 +20,10 @@ Alternatively, if you have Ant installed on your system, you may run the CodeSni ant phpcs ``` -#### Known Issues - -- There is currently an issue with running the Code Sniffer on the - Simplepie library. Pointing the sniffs at the libraries/joomla - directory or below will avoid the issue. - -## Other Tools +### Other Tools Here are some other tools available to developers who are planning to submit source code to the project. -### Set up the codesniffer +#### Set up PHP_CodeSniffer See in the documentation https://docs.joomla.org/Joomla_CodeSniffer#3._IDE_Integration diff --git a/manual/appendices/examples.md b/manual/appendices/examples.md index 7fda47f1..dfd54129 100644 --- a/manual/appendices/examples.md +++ b/manual/appendices/examples.md @@ -1 +1 @@ -## Code Examples \ No newline at end of file +Please contribute to this documentation page. diff --git a/manual/basic-guidelines.md b/manual/basic-guidelines.md index effbfe3d..eba6c9dd 100644 --- a/manual/basic-guidelines.md +++ b/manual/basic-guidelines.md @@ -1,5 +1,3 @@ -## Basic Guidelines - This chapter outlines the basic guidelines covering files contributed to the Joomla project. The most important rule to remember when coding for the Joomla project, **if in doubt, please ask**. ### File Format @@ -15,8 +13,7 @@ All files contributed to Joomla must be: ### Spelling -The spelling of words and terms used in code comments and in the naming of class, functions, variables and constant should generally be in accordance with British English rules (en\_GB). -Some exceptions are permitted, for example where common programming names are used that align with the PHP API or other established conventions such as for `color` where is it common practice to maintain US English spelling. +The spelling of words and terms used in code comments and in the naming of class, functions, variables and constant should generally be in accordance with British English rules (en\_GB). Some exceptions are permitted, for example where common programming names are used that align with the PHP API or other established conventions such as for `color` where is it common practice to maintain US English spelling. ### Indenting @@ -25,7 +22,3 @@ Tabs are used for indenting code (not spaces as required by the PEAR standard). ### Line Length There is no maximum limit for line lengths in files, however, a notional value of about 150 characters is recommended to achieve a good level of readability without horizontal scrolling. Longer lines are permitted if the nature of the code for individual lines requires it and line breaks would have an adverse affect on the final output (such as for mixed PHP/HTML layout files). - -## Best Practices - -TODO Any words of wisdom about PHP best practice, maybe even references for design patterns? Can/should we link out to the JRD, Doc wiki and Developer site for additional resources? diff --git a/manual/css.md b/manual/css.md index 1a7f1963..befaa5f8 100644 --- a/manual/css.md +++ b/manual/css.md @@ -1,29 +1,30 @@ -## CSS These guidelines have been assembled following an examination of emerging practices, ideas and existing styleguides, namely: 1. [OOCSS Code Standards](https://github.com/stubbornella/oocss-code-standards) 2. [Oneweb Style Guide](https://github.com/nternetinspired/OneWeb/blob/master/STYLEGUIDE.md) 3. [Idiomatic CSS](https://github.com/necolas/idiomatic-css) +### Commenting -## Commenting - -### Major sections +#### Major sections Major code sections should be named in caps and within a full comment block, eg: + ```css /* ========================================================================== PRIMARY NAVIGATION ========================================================================== */ ``` -### Sub sections +#### Sub sections Subsections should be normally cased and within an open comment block. + ```css /* Mobile navigation ========================================================================== */ ``` -### Verbose comments +#### Verbose comments + ```css /** * Short description using Doxygen-style comment format @@ -43,22 +44,24 @@ Subsections should be normally cased and within an open comment block. */ ``` -### Basic comments +#### Basic comments + ```css /* Basic comment */ ``` -### Uncompiled LESS/Scss comments +#### Uncompiled LESS/Scss comments + ```css // These are stripped on compile. ``` -## CSS selectors -Only use classes for CSS selectors, *never IDs* as they introduce unwanted specificity to the cascade. Using an ID as a css selector is like firing the first nuke; you begin a specifity war that can only escalate, with terrible consequence. +### CSS selectors +Only use classes for CSS selectors, *never IDs* as they introduce unwanted specificity to the cascade. Using an ID as a CSS selector is like firing the first nuke; you begin a specifity war that can only escalate, with terrible consequence. To put it another way; Don't use a Sith Lord when just two Storm Troopers will suffice: [CSS Specificity Wars](http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html) -### Class naming convention +#### Class naming convention Use dashes to create compound class names: ```css @@ -75,7 +78,7 @@ Use dashes to create compound class names: .compoundclassname {…} ``` -### Indentation +#### Indentation Rules should be indented one tab (equal to 4 spaces): ```css @@ -89,7 +92,7 @@ Rules should be indented one tab (equal to 4 spaces): .example {color: #000; visibility: hidden;} ``` -### Alignment +#### Alignment The opening brace must be on the same line as the last selector and preceded by a space. The closing brace must be on its own line after the last property and be indented to the same level as the opening brace. ```css @@ -109,7 +112,7 @@ The opening brace must be on the same line as the last selector and preceded by } ``` -### Property Format +#### Property Format Each property must be on its own line and indented one level. There should be no space before the colon and one space after. All properties must end with a semicolon. ```css @@ -132,8 +135,9 @@ Each property must be on its own line and indented one level. There should be no } ``` -### HEX values +#### HEX values HEX values must be declared in lowercase and shorthand: + ```css /* Good */ .example { @@ -146,7 +150,7 @@ HEX values must be declared in lowercase and shorthand: } ``` -### Attribute selectors +#### Attribute selectors Always use double quotes around attribute selectors. ```css @@ -166,7 +170,7 @@ input[type='button'] { } ``` -### Zero value units +#### Zero value units Zero values should not carry units. ```css diff --git a/manual/docblocks.md b/manual/docblocks.md index 1761479b..8661b05a 100644 --- a/manual/docblocks.md +++ b/manual/docblocks.md @@ -1,5 +1,3 @@ -## DocBlocks - Documentation headers for PHP code in: files, classes, class properties, methods and functions, called the docblocks, follow a convention similar to JavaDoc or phpDOC. These "DocBlocks" borrow from the PEAR standard but have some variations specific for Joomla and the Joomla projects. @@ -18,7 +16,7 @@ Short description (optional unless the file contains more than two classes or fu * @category (optional and rarely used) * @package (generally optional but required when files contain only procedural code. Always optional in namespaced code) * @subpackage (optional) -* @author (optional but only permitted in non-Joomla source files, for example, included third-party libraries like Geshi) +* @author (optional but only permitted in non-Joomla source files) * @copyright (required) * @license (required and must be compatible with the Joomla license) * @link (optional) @@ -39,8 +37,7 @@ Example of a DocBlock Header: ``` ### Class Definitions -Class definitions start on a new line and the opening and closing braces are also placed on new lines. Class methods must follow the guidelines for Function Definitions. Properties and methods must follow OOP standards and be declared appropriately (using public, protected, private and static as applicable). -Class definitions, properties and methods must each be provided with a DocBlock in accordance with the following sections. +Class definitions start on a new line and the opening and closing braces are also placed on new lines. Class methods must follow the guidelines for Function Definitions. Properties and methods must follow OOP standards and be declared appropriately (using public, protected, private and static as applicable). Class definitions, properties and methods must each be provided with a DocBlock in accordance with the following sections. #### Class DocBlock Headers The class Docblock consists of the following required and optional elements in the fol-lowing order. @@ -49,7 +46,7 @@ Short description (required, unless the file contains more than two classes or f * @category (optional and rarely used) * @package (optional) * @subpackage (optional) -* @author (optional but only permitted in non-Joomla source files, for example, included third-party libraries like Geshi) +* @author (optional but only permitted in non-Joomla source files) * @copyright (optional unless different from the file Docblock) * @license (optional unless different from the file Docblock) * @link (optional) @@ -88,8 +85,6 @@ Example of Class property DocBlock: protected static $userId = 0; ``` - - #### Class Method DocBlocks and Functions DocBlocks Function definitions start on a new line and the opening and closing braces are also placed on new lines. An empty line should precede lines specifying the return value. diff --git a/manual/html.md b/manual/html.md index fbd4e78c..2278e023 100644 --- a/manual/html.md +++ b/manual/html.md @@ -1,14 +1,11 @@ -## html - These guidelines have been assembled following an examination of emerging practices, ideas and existing styleguides, and include items from: -1. [Google's html styleguide](https://google.github.io/styleguide/htmlcssguide.html) -2. [JQuery's HTML Styleguide](http://contribute.jquery.org/style-guide/html/) +1. [Google's HTML styleguide](https://google.github.io/styleguide/htmlcssguide.html) +2. [jQuery's HTML Styleguide](http://contribute.jquery.org/style-guide/html/) 3. [Nicolas Ghallager's "Principles of writing consistent, idiomatic HTML"](https://github.com/necolas/idiomatic-html) 4. [Harry Robert's "My HTML/CSS coding style"](http://csswizardry.com/2012/04/my-html-css-coding-style/) 4. [The BBC's Media Standards and Guidelines](http://www.bbc.co.uk/guidelines/futuremedia/technical/semantic_markup.shtml) - ### Doctype Always use the minimal, versionless doctype. @@ -26,19 +23,17 @@ Always define which language the page is written in. ``` ### Encoding -Always define the character encoding. The encoding should be defined as early as possible. -Make sure your editor uses UTF-8 as character encoding, without a byte order mark (UTF-8, no BOM). -Do not specify the encoding of style sheets as these assume UTF-8. + +Always define the character encoding. The encoding should be defined as early as possible. Make sure your editor uses UTF-8 as character encoding, without a byte order mark (UTF-8, no BOM). Do not specify the encoding of style sheets as these assume UTF-8. ```html ``` -[More on encodings and when and how to specify them can be found in Handling character encodings in HTML and CSS](http://www.w3.org/International/tutorials/tutorial-char-enc/) - +More on encodings and when and how to specify them can be found in [Handling character encodings in HTML and CSS](http://www.w3.org/International/tutorials/tutorial-char-enc/) ### Capitalisation -All html should be lowercase; element names, attributes, attribute values (unless text/CDATA), CSS selectors, properties, and property values (with the exception of strings). Additionally, there is no need to use CDATA to escape inline JavaScript, formerly a requirement to meet XML strictness in XHTML. +All HTML should be lowercase; element names, attributes, attribute values (unless text/CDATA), CSS selectors, properties, and property values (with the exception of strings). Additionally, there is no need to use CDATA to escape inline JavaScript, formerly a requirement to meet XML strictness in XHTML. ```html @@ -76,10 +71,12 @@ This prevents mixed content issues and results in minor file size savings. ### Elements and Attributes -Always include html, head, and body tags. +Always include ``, ``, and `` tags. ### Type attributes + Do not use type or attributes for style sheets (unless not using CSS) and scripts (unless not using JavaScript). + ```html @@ -89,6 +86,7 @@ Do not use type or attributes for style sheets (unless not using CSS) and script ``` ### Language attributes + Do not use language attributes on script tags. ```html @@ -98,21 +96,24 @@ Do not use language attributes on script tags. + ``` Use attribute/value pairs for boolean attributes + ```html + ``` @@ -127,6 +128,7 @@ HTML attributes should be listed in an order that reflects the fact that class n ```html Text + Text ``` @@ -143,33 +145,38 @@ Elements with multiple attributes can have attributes arranged across multiple l ``` ### Elements + Optional closing tags may not be omitted. + ```html

The quick brown fox jumps over the lazy dog.

+

The quick brown fox jumps over the lazy dog. ``` Self-closing (void) elements should not be closed. Trailing forward slashes and spaces should be omitted. + ```html + ``` - ### Formatting + Use a new line for every block, list, or table element, and indent every such child element. ```html

-
    -
  • Home
  • -
  • Blog
  • -
+
    +
  • Home
  • +
  • Blog
  • +
@@ -205,17 +212,17 @@ Tip: configure your editor to "show invisibles". This will allow you to eliminat Taxes - - $ 5.00 - $ 4.50 - + + $ 5.00 + $ 4.50 + + ``` ### Indentation -Don't indent inside html, body, script, or style. Indent inside head and all other elements. -Indent by four spaces at a time. Don’t use tabs or mix tabs and spaces for indentation. +Don't indent inside ``, ``, `