Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#27931 closed defect (bug) (wontfix)

HTML Editor Removes Schema (Span) Tags

Reported by: slightlyconcernedcitizen's profile slightlyconcernedcitizen Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords:
Focuses: Cc:

Description

I have been trying to add span tags to my blog posts. However whenever I switch to the Visual editor it removes all of the tags.

These are not empty span tags, as they are adhering to the schema format.

Examples tags might be something like this:

<span itemscope itemtype="http://schema.org/Thing" sameAs="http://en.wikipedia.org/wiki/Google">Google</span> has <span itemprop="ratingCount">25</span> user ratings

If I add that HTML and then switch to the Visual Editor and then switch back to the HTML editor, that gets changed to

Google has 25 user ratings

The span tag, despite having information is getting completely removed. Schema tags are widely in use now, and Google has gone on record saying they make use of them. I have read past tickets where you say that you remove span tags that are empty, but these span tags are clearly not empty as they have itemprop,itemscope,itemtype,sameAs and many other attributes.

Change History (9)

#1 @SergeyBiryukov
11 years ago

Confirmed. This happens in TinyMCE demo as well: http://www.tinymce.com/tryit/full.php.

#2 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.9.1

I presume this is a regression in 3.9? Moving to 3.9.1 for review/investigation.

#3 @iseulde
11 years ago

In TinyMCE 3.5.9 and WordPress 3.8.3 this would be converted to

<span itemscope="" itemtype="http://schema.org/Thing">Google</span> has <span itemprop="ratingCount">25</span> user ratings

So itemscope becomes itemscope="" and sameAsis removed.

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


11 years ago

#5 @nacin
11 years ago

  • Milestone changed from 3.9.1 to 3.9.2

This likely needs to be reported upstream; moving to 3.9.2.

#6 @azaozz
11 years ago

None of these are valid HTML (4 or 5) attributes. What seems to happen is MCE removes invalid attributes, then the spans are without any attributes and are removed. If there is a valid attribute on a span, it is not removed.

TinyMCE can be set to keep "invalid" attributes on the <span> tags with the extended_valid_elements setting, probably a plugin material?

#8 @azaozz
11 years ago

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

Closing this as a "plugin material". Would be really nice to have a TinyMCE plugin that enables the schema attributes (and it doesn't look very hard to make one) :)

#9 @makfruit
9 years ago

Closing this as a "plugin material". Would be really nice to have a TinyMCE plugin that enables the schema attributes (and it doesn't look very hard to make one) :)

We created one : )

Please feel free to use: https://wordpress.org/plugins/protect-schemaorg-markup-in-html-editor/

Note: See TracTickets for help on using tickets.