Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9262 closed defect (bug) (invalid)

Incorrect behaviour with using the PRE tag when switching between Visual and HTML editor

Reported by: shamess Owned by: azaozz
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: TinyMCE Keywords: reporter-feedback
Focuses: Cc:


There's a problem with using the HTML <pre> tag, well it's contents actually.

Typing something like


Will get parsed back to


When switch from the HTML editor to the visual editor. It's clearly just stripping out bag HTML, despite me having "WordPress should correct invalidly nested XHTML automatically" unchecked in the Writing settings, and text within <pre> tags not supposed to be changed in that way.

Also, when using less than and greater than signs within <pre> tags, they'll get transformed into their html entity counterparts (&lt; and &gt;) which isn't what the user expects, since that's not what they want outputted to the screen.

-Text between <pre> and <code> tags shouldn't be reparsed to be "fixed" by WordPress.

I'm using 2.8 (bleeding edge), but this bug has been around for a while before. Can't remember when though.

Change History (5)

#1 @shamess
12 years ago

  • Summary changed from Incorrect behaviour with using the PRE tag when switching between Visual and TML editor to Incorrect behaviour with using the PRE tag when switching between Visual and HTML editor

#2 @Viper007Bond
12 years ago

  • Keywords reporter-feedback added; html tags removed

Are you typing the fake tags into the HTML editor? If so, then the first part is to be expected as TinyMCE is stripping the bad HTML out (<pre> is not meant to escape HTML for you).

The &lt; into < and then staying as such or whatever is a bug though. I've noticed the same thing with "&" being entered into the HTML editor and then it being converted to &amp; after switching to TinyMCE and then back to the HTML editor. I guess that's also to be expected though as that's proper HTML even though it was inside a shortcode.

In short, ticket seems invalid.

#3 @Viper007Bond
12 years ago

My above comment is a bit contradictory, so let me clarify a little:

If you type < into TinyMCE, it's actually creating &lt; behind the scenes as it's WYSIWYG edit and it assumes you want < to be outputted.

#4 @azaozz
12 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Viper007Bond is right. Also <code> is an inline tag that has no special meaning in HTML. According to W3C the browsers "may choose" to display it with fixed width font, nothing else.

The <pre> tag has special meaning. It displays line breaks as they appear in the source. It can include most inline elements (http://www.w3.org/TR/html401/sgml/dtd.html#pre.exclusion). It doesn't escape and cannot contain bad/invalid HTML tags.

#5 @Denis-de-Bernardy
12 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.