WordPress.org

Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#6128 closed enhancement (fixed)

the_content spits out bogus BR tag

Reported by: kickslop Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.3.3
Component: Administration Keywords: has-patch tested
Focuses: Cc:

Description

When calling the_content() via, say... archives.php, a BR tag is spit out even if the page is empty.

Let me try explaining that in more detail.

Calling the_content() from a page template PHP file (like archives.php in some themes) should drag in the contents of the actual page itself, as written by the page author. When the Wordpress page content is BLANK (read: "just spit out only what the page template generates"), the_content() is still generating a BR tag.

It causes bogus whitespace that is not wanted.

Attachments (2)

6128.diff (615 bytes) - added by Denis-de-Bernardy 11 years ago.
6128.js.diff (575 bytes) - added by Denis-de-Bernardy 11 years ago.

Download all attachments as: .zip

Change History (13)

#1 @Viper007Bond
11 years ago

  • Keywords wpautop added
  • Milestone changed from 2.9 to Future Release

#2 @Viper007Bond
11 years ago

  • Type changed from defect (bug) to enhancement

Not really a bug, so gonna switch this to an enhancement.

#3 follow-ups: @Denis-de-Bernardy
11 years ago

  • Component changed from Template to TinyMCE
  • Keywords has-patch tested added; wpautop removed
  • Milestone changed from Future Release to 2.8
  • Owner changed from anonymous to azaozz

a separate patch is needed for the js version of wpautop in wp-admin/js/editor.js. you can see tinymce add the <br /> back and forth as you switch to and from the wysiwyg.

but as the code is minified, it's not easy to read or edit.

#4 in reply to: ↑ 3 @jbsil
11 years ago

Replying to Denis-de-Bernardy:

but as the code is minified, it's not easy to read or edit.

See editor.dev.js

#5 in reply to: ↑ 3 ; follow-up: @jbsil
11 years ago

Replying to Denis-de-Bernardy:

you can see tinymce add the <br /> back and forth as you switch to and from the wysiwyg.

How? I cannot get mine to do that.

#6 in reply to: ↑ 5 @Denis-de-Bernardy
11 years ago

Replying to jbsil:

Replying to Denis-de-Bernardy:

you can see tinymce add the <br /> back and forth as you switch to and from the wysiwyg.

How? I cannot get mine to do that.

In Camino, you actually see the transformed code for a fraction of a second before things switch to Wysiwyg view.

#7 @azaozz
11 years ago

  • Component changed from TinyMCE to Administration
  • Owner changed from azaozz to anonymous

TinyMCE uses <br /> to pad the empty editor so the cursor can be placed in it. That's removed during the save cleanup. Think the <br /> in an empty post comes from autop (next line after the proposed fix in the first patch).

#8 @azaozz
11 years ago

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

(In [11048]) Don't output <br /> for empty posts, props Denis-de-Bernardy, fixes #6128

#9 follow-up: @Denis-de-Bernardy
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

we're not fixing the js too?

#10 in reply to: ↑ 9 @azaozz
11 years ago

Replying to Denis-de-Bernardy:

we're not fixing the js too?

It doesn't happen there, see the previous comment.

#11 @Denis-de-Bernardy
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

oh, sorry, I had missed your comment.

Note: See TracTickets for help on using tickets.