WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 months ago

#29171 new defect (bug)

empty (and valid) span tags are removed when switching from visual to text editor and back to visual

Reported by: ruud@… Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords: has-patch needs-testing
Focuses: Cc:

Description

Forwarded from #28940, related #27391.

The difference with #27391 is that when I tried to use a Bootstrap 3 Glyphicon approach while having the 28940.patch installed the editor removes the (empty) span tag. The span tag doesn't use any new schema type of attribute, just a regular class.

(see http://getbootstrap.com/components/ Glyphicons, How to use for testing)

Attachments (2)

29171.patch (1.2 KB) - added by ruud@… 3 years ago.
Patch for #29171 (using 28940.patch as a template)
29171.2.patch (1.5 KB) - added by azaozz 5 months ago.

Download all attachments as: .zip

Change History (14)

#1 @ruud@…
3 years ago

  • Keywords needs-patch dev-feedback added

#2 @ruud@…
3 years ago

Modified 28940.patch to create this patch.

@ruud@…
3 years ago

Patch for #29171 (using 28940.patch as a template)

#3 @ruud@…
3 years ago

  • Keywords has-patch added; needs-patch removed

#4 @stephdau
3 years ago

I've tested trunk (with and without 28940.patch installed), and empty spans are always stripped out when switching from text to visual and back (with or without class, etc).

I've tried trunk with your attachment:29171.patch patch, and it did not make a difference, empty spans are still being stripped: https://cloudup.com/couAlDKgtGu

Am I missing something?

Last edited 3 years ago by stephdau (previous) (diff)

This ticket was mentioned in IRC in #wordpress-dev by stephdau. View the logs.


3 years ago

#6 @iseulde
3 years ago

  • Version changed from trunk to 3.9

#7 @ruud@…
3 years ago

Hi Stephdau, thanks for checking the patch.

I've watched your video, it is stripping empty span tags as it should.

You describe that spans with classes also get stripped out.
Did you test that case after you applied the patch?
The patch is supposed to fix exactly that.

#8 @chriscct7
2 years ago

  • Keywords needs-testing added

@azaozz
5 months ago

#9 @azaozz
5 months ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 4.9

29171.patch looks good but maybe better to not use &nbsp; for padding. It is "visible" in the editor and the element can still be considered "empty". Thinking it's better to use <wbr /> as it doesn't affect the element at all and is easy to deal with both in the DOM and in the HTML.

In 29171.2.patch: use <wbr /> to pad empty spans and links so they are not removed on editor cleanup.

This ticket was mentioned in Slack in #core by westonruter. View the logs.


5 months ago

This ticket was mentioned in Slack in #core by melchoyce. View the logs.


2 months ago

#12 @melchoyce
2 months ago

  • Milestone changed from 4.9 to Future Release
Note: See TracTickets for help on using tickets.