== Why is this an issue?

The ``++<dt>++`` HTML element specifies a term in a description or definition list, and as such must be used inside a ``++<dl>++`` element, which represents a description list. Common uses for this element are to implement a glossary or to display metadata.

The ``++<li>++`` HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list (``++<ol>++``), an unordered list (``++<ul>++``), or a menu (``++<menu>++``).

Using a ``++<li>++`` or ``++<dt>++`` item tag outside of the aforementioned parent elements does not follow the HTML specification.

[source,html,diff-id=1,diff-type=noncompliant]
----
<li>Apple</li>          <!-- Noncompliant -->
<li>Strawberry</li>     <!-- Noncompliant -->

<dt>Apple</dt>          <!-- Noncompliant -->
<dt>Strawberry</dt>     <!-- Noncompliant -->
----

To fix this issue, enclose ``++<li>++`` and ``++<dt>++`` with their respective allowed parent tags.

[source,html,diff-id=1,diff-type=compliant]
----
<ul> <!-- or <ul> or <menu> -->
  <li>Apple</li>
  <li>Strawberry</li>
</ul>

<dl>
  <dt>Apple</dt>
  <dt>Strawberry</dt>
</dl>
----

== Resources

=== Documentation

* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li[``++<li>++``: The List Item element]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt[``++<dt>++``: The Description Term element]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Surround this {0} item tag by a {1} or {2} container one.


'''
== Comments And Links
(visible only on this page)

=== on 21 Jun 2013, 08:59:48 Dinesh Bolkensteyn wrote:
----
<?php
echo "<ul>\n";
foreach ($array as $element) {
  <li><?php echo $element; ?></li>
}
echo "</ul>\n";
?>
----

should be refactored into:


----
<ul>
<?php
foreach ($array as $element) {
?>
  <li><?php echo $element; ?></li>
<?php
}
?>
</ul>
----

or:



----
<?php
echo "<ul>\n";
foreach ($array as $element) {
  echo "  <li>$element</li>\n";
}
echo "</ul>\n";
?>
----

=== on 21 Jun 2013, 09:28:59 Dinesh Bolkensteyn wrote:
We should be careful with nested lists....

=== on 8 Jul 2013, 18:21:30 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-2993

endif::env-github,rspecator-view[]
