PhpStorm 2019.2.3 shows some very strange error hint on p tag


Hello,
In my vue page PhpStorm 2019.2.3 shows some very strange error hint :
https://imgur.com/a/FzOnOaw

But p tag is closed!
Looks like that is erro for p tag only...
Can it vbe fixed ?

Thanks!

0

Hi there,

IDE is correct here.

In HTML5 if <ol> is "inside" the <p> then <p> is forcibly closed before the <ol>. See https://www.w3.org/TR/html52/dom.html#tag-omission-in-text-html

See Examples 3,4 & 5:

>List elements (in particular, ol and ul elements) cannot be children of p elements. When a sentence contains a bulleted list, therefore, one might wonder how it should be marked up.

 

In other words, the actual structure is:

<p>text</p>
<ol>
  <li>...</li>
</ol>

and not what you expecting/got there:

<p>text
<ol>
   <li>...</li>
</ol>
</p>

You can check it in your browser -- use Dev Tools and see the HTML structure there.

2

请先登录再写评论。