Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21528 closed defect (bug) (duplicate)

A tag bug with NAME and HREF parameter

Reported by: matthewvb@… Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords:
Focuses: Cc:


I'm noticing a bug using a tags using 3.4.1. Tried on a few sites using 3.4.1.

To replicate:

When editing a post, go in HTML view.

Add a link with both a HREF and a NAME:
<a href="http://google.com" name="#google">google</a>

Click on Visual mode

Go back to HTML mode. code now looks like:
<a href="http://google.com" name="#google"></a>google

Link text is being moved outside the a tag.

I don't believe this should happen - you should, in theory, be able to put both an HREF and a NAME together, though perhaps this isn't valid syntax.

Change History (4)

#1 @toscho
3 years ago

  • Cc info@… added
  • Component changed from General to TinyMCE

Confirmed. This happens with valid markup too: <a name="google" href="http://google.com">google</a> is changed to <a name="google" href="http://google.com"></a>google.
The href attribute doesn’t make a difference. Without it the same happens.

#2 @azaozz
3 years ago

  • Keywords close added

This has come up before. The visual editor separates anchors and links as the name attribute was formally deprecated in XHTML 1.0. In HTML 5.0 this was "downgraded" to a recommendation to always use ID instead of name.

Currently you can use an anchor followed by a link:

<a name="123"></a><a href="go-there">...</a>

which will work in exactly the same way.

If you really need to still use <a name="..."> and have it act as a link too, perhaps open a ticket on TinyMCE's bug-tracker.

#3 @ocean90
3 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 3.4.1 deleted

#4 @SergeyBiryukov
3 years ago

This is fixed in trunk (probably after TinyMCE update in [21228]).

Note: See TracTickets for help on using tickets.