Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#39570 closed defect (bug) (fixed)

Extra markup added to links with IE11

Reported by: chriswiegman's profile ChrisWiegman Owned by: azaozz's profile azaozz
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.7
Component: TinyMCE Keywords: has-patch
Focuses: Cc:

Description

When pasting a link to TinyMCE using Win 7, IE 11 extra markup is added to links resulting in problems with display. For example, pasting:

<a href="https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data" target="_blank">number of functions available to handle nearly any situation</a>

will result in:

<a href="https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data" target="_blank"><u><span style="color: #0066cc;">number of functions available to handle nearly any situation</span></u></a>

This is reproducible by pasting any text with a link into TinyMCE using Windows 7 and IE11.

Attachments (1)

39570.patch (771 bytes) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (7)

#1 @azaozz
6 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.8

Confirmed. Also happens in Edge on Win10. Similar to the cruft that Chrome inserts but only when pasting links (fortunately).

The good news is that we already have filtering on paste for Chrome/WebKit what we can also turn on for IE/Edge.

The bad news is that Edge can also insert other tags without inline styles, in particular seeing <u> (see the example in the ticket) and <font>!! The only thing I can think of is to strip these tags when wrapped in links.

This will remove the <u> even if the original content that was copied had that tag combination. However it seems better to "clean up" such cases.

Last edited 6 years ago by azaozz (previous) (diff)

@azaozz
6 years ago

#2 @azaozz
6 years ago

In 39570.patch: remove <font> and <u> tags from inside links when pasting in IE and Edge, but keep their content/text.

The actual tag that is inserted by these browsers is <font color=...> and TinyMCE converts it to a span to make it valid.

Last edited 6 years ago by azaozz (previous) (diff)

#3 @azaozz
6 years ago

  • Keywords has-patch added; needs-patch removed

#4 follow-up: @iseulde
6 years ago

Shouldn't we push for a fix in MCE?

#5 in reply to: ↑ 4 @azaozz
6 years ago

Replying to iseulde:
Sure. Thinking best would be to fix it here for now, then remove when it is fixed upstream in the paste plugin.

#6 @azaozz
6 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 39916:

TinyMCE: strip browser inserted <u> and <font>` tags from inside links when copying and pasting in IE and Edge.

Fixes #39570.

Note: See TracTickets for help on using tickets.