[wp-trac] [WordPress Trac] #40676: wpautop adds opening & closing p tags around the opening a tag and around the closing a tag when the link contains certain flow content elements like div, h1, h2...
WordPress Trac
noreply at wordpress.org
Fri Jun 9 08:13:36 UTC 2017
#40676: wpautop adds opening & closing p tags around the opening a tag and around
the closing a tag when the link contains certain flow content elements like
div, h1, h2...
--------------------------+------------------------------
Reporter: diegocanal | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 4.7.4
Severity: major | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Description changed by ocean90:
Old description:
> Hi,
>
> == Description ==
> wpautop leaves {{{<a href="">}}} (opening tag of the link) in between
> {{{<p></p>}}} tags and {{{</a>}}} (closing tag of the link) in between
> {{{<p></p>}}} tags when the link contains certain flow content elements
> like div, h1, h2...
>
> == Example 1 ==
>
> If I add this to the HTML editor:
> {{{
> <a href="https://example.com/"><div>DIV inside link</div></a>
> }}}
>
> The output source code is:
> {{{
> <p><a href="https://example.com/"></p>
> <div>DIV inside link</div>
> <p></a></p>
> }}}
>
> ----
>
> == Example 2 ==
>
> If I add this to the HTML editor:
> {{{
> <a href="https://example.com/"><h1>H1 inside link</h1></a>
> }}}
>
> The output source code is:
> {{{
> <p><a href="https://example.com/"></p>
> <h1>H1 inside link</h1>
> <p></a></p>
> }}}
>
> ----
>
> == Note 1 ==
> I would like to point out that html '''''flow content'' elements such as
> {{{<div>}}} or headings ({{{<h1>, <h2>, <h3>}}} ,...) belong to the
> category of permitted content for the {{{<a>}}} element'''. References:
> [https://html.spec.whatwg.org/multipage/semantics.html#the-a-element
> WHATWG HTML Living Standard |The definition of a]
> [http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element HTML5
> | The definition of a]
> [https://developer.mozilla.org/en/docs/Web/HTML/Element/a MDN | The
> definition of a.]
>
> ----
>
> == Note 2 ==
> This issue might be related to
> [https://core.trac.wordpress.org/ticket/34722 ticket #34722]
>
> ----
New description:
Hi,
== Description ==
wpautop leaves {{{<a href="">}}} (opening tag of the link) in between
{{{<p></p>}}} tags and {{{</a>}}} (closing tag of the link) in between
{{{<p></p>}}} tags when the link contains certain flow content elements
like div, h1, h2...
== Example 1 ==
If I add this to the HTML editor:
{{{
<a href="https://example.com/"><div>DIV inside link</div></a>
}}}
The output source code is:
{{{
<p><a href="https://example.com/"></p>
<div>DIV inside link</div>
<p></a></p>
}}}
----
== Example 2 ==
If I add this to the HTML editor:
{{{
<a href="https://example.com/"><h1>H1 inside link</h1></a>
}}}
The output source code is:
{{{
<p><a href="https://example.com/"></p>
<h1>H1 inside link</h1>
<p></a></p>
}}}
----
== Note 1 ==
I would like to point out that html '''''flow content'' elements such as
{{{<div>}}} or headings ({{{<h1>, <h2>, <h3>}}} ,...) belong to the
category of permitted content for the {{{<a>}}} element'''. References:
[https://html.spec.whatwg.org/multipage/semantics.html#the-a-element
WHATWG HTML Living Standard |The definition of a]
[http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element HTML5
| The definition of a]
[https://developer.mozilla.org/en/docs/Web/HTML/Element/a MDN | The
definition of a.]
----
== Note 2 ==
This issue might be related to ticket #34722
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40676#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list