Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 10 years ago

#27931 closed defect (bug) (wontfix)

HTML Editor Removes Schema (Span) Tags

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

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
13 years ago

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

#2 @nacin
13 years ago

  • Milestone Awaiting Review → 3.9.1

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

#3 @iseulde
13 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.


13 years ago

#5 @nacin
13 years ago

  • Milestone 3.9.1 → 3.9.2

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

#6 @azaozz
13 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
12 years ago

  • Milestone 3.9.2
  • Resolution → wontfix
  • Status new → 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
10 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.