Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#22941 closed defect (bug) (wontfix)

TinyMCE Paste From Word Uses <b> for Bold Instead of <strong>

Reported by: cgrymala Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: TinyMCE Keywords: close
Focuses: Cc:


I'm not sure if this counts as a bug or not, but it's a definite change between 3.4.2 and 3.5.

Steps to Reproduce:

  1. Create a new Microsoft Word document
  2. Type some text into the Word document and make it bold
  3. Create a new post/page in WordPress, making sure that the Visual Editor is selected
  4. Copy the bold text from Word and use the Paste From Word button to paste it into the new post/page you're creating
  5. Switch to the HTML editor and look at the code

Expected Result:

  1. The background HTML code for the bold text should be wrapped in <strong></strong>

Actual Result:

  1. The background HTML code for the bold text is actually wrapped in <b></b>

Tested in WordPress 3.5 using Chrome 23.0.1271.97 m on Windows 8 x64. I'll test in other browsers later.

I tested in a WordPress 3.4.2 installation in the same setup, and those same steps produced text that was wrapped in <strong></strong> correctly.

Change History (7)

#1 @nacin
9 years ago

  • Milestone changed from Awaiting Review to 3.5.1

Moving to 3.5.1 for review.

#2 @MikeHansenMe
9 years ago

  • Cc mdhansen@… added

I was able to confirm this, I also test italic text and it used <i> instead of <em>

#3 @nacin
9 years ago

In fairness, this may have been a deliberate change. b and i are valid HTML5 elements that mean bold text and italic text. strong and em are forms of emphasis. Should bolded text in Word have the extra semantic meaning of emphasis, or is it simply bold?

#4 @MikeHansenMe
9 years ago

Yea, reading on whatwg does show these as valid. I guess the question is why only when paste from Word. If you use the Bold or Italic buttons from TinyMCE it uses <strong> or <em>

#5 @azaozz
9 years ago

In 3.5 TinyMCE follows the HTML 5.0 spec and as @nacin said <b> and <i> are valid elements there.

When pasting from MS Word and some other apps (and from another tab in the browser), the clipboard contains html. The 'paste' plugin filters it for irregularities and removes redundant classes, etc. but if the clipboard contains these elements they will be left untouched. The same happens when a user types in the Text tab, <b> and <i> are not replaced as they are valid and not deprecated any more.

#6 @azaozz
9 years ago

  • Keywords close added

#7 @markjaquith
9 years ago

  • Milestone 3.5.1 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

These are valid elements. We can't determine intent. It may have been an unintentional change, but it's not wrong.

Note: See TracTickets for help on using tickets.