Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#28191 closed defect (bug) (worksforme)

Visual Editor Changing Order of Outputted HTML Tag Attributes

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

Description

This ticket is coming about in relation to this support thread here:

http://wordpress.org/support/topic/title-showing-before-href

And -possibly- might be indirectly related to an old closed ticket #5796.

Unlike previous tickets that mention tags gone missing (though this ticket might also be related), this ticket is in regards to the output order of tags being changed when swapping to the Visual Editor from the Text Editor and then swapping back to the Text Editor.

Included are two examples tested on both the thread posters' installs running 3.9 and on my own vanilla install running 3.9.1:

Example 1:

<a href="http://wordpress.org" title="WordPress dot org">WordPress!</a>

typed up in the Text Editor gets outputted into:

<a title="WordPress dot org" href="http://wordpress.org">WordPress!</a>

when swapping to Visual Editor and then swapping back to Text Editor.

Example 2:

<iframe width="560" height="315" src="//www.youtube.com/embed/embedcodehere" frameborder="0" allowfullscreen></iframe>

typed (or pasted directly from YT, also notice YT's missing/incomplete additional allowfullscreen declaration) into Text Editor gets outputted to:

<iframe src="//www.youtube.com/embed/embedcodehere" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

when swapping to Visual Editor and then swapping back to Text Editor (also notice the 'completed' allowfullscreen declaration).

Some Clarification:

IF one is ONLY using either Text Mode (and never swaps to Visual Editor during the time of post/page-writing) or simply has Visual Editor turned off in preferences, this tag swapping does NOT occur.

This is the expected and 'normal' behavior to my/our understanding - that properly written links and embeds ought to simply output out as they are typed.

This 'bug' is only triggered when someone swaps into Visual Editor mode from Text Editor mode and back into Text Editor mode that this happens.

Some Additional Thoughts and Information:

Though I myself cannot confirm this because I always keep Visual Editor off unless helping others to troubleshoot, the OP of the thread I referenced mentioned that the change is recent. Their 'how I write posts' behavior and habits haven't changed but the way things are outputting has.

I am unsure as to why this tag order swapping is occurring and initially, I thought this was/is related to changes in TinyMCE.

Upon some rethinking, I am wondering if this has something to do with 'sanitizing' - how WordPress tries to correct improperly coded code within posts and pages.

(Note: HTML documentation and SEO documentation don't mention much about tag orders other than to be consistent with how they are written with some publications suggesting alphabetizing, but as the samples show, the outputted tags aren't alphabetized, either!)

Whatever the case is, the OP expressed concern about the sudden swapping of tag orders for no apparent reason and additionally expressed a desire to have it back to the way it was (no random tag order swapping around) to maintain coding consistency (which I agree).

As such, I am submitting this ticket.

Thanks!

Change History (5)

#1 @iseulde
11 years ago

  • Component changed from Editor to TinyMCE
  • Version changed from 3.9.1 to 3.9

#2 @helen
11 years ago

  • Keywords close added
  • Summary changed from Visual Editor Changing Order of Outputted HTML Tags to Visual Editor Changing Order of Outputted HTML Tag Attributes

As annoying as I know things like this can be for somebody's workflow, this doesn't seem like much of a bug. I am also rather skeptical of the claim on the support thread that HTML tag attribute order affects Google search results.

#3 @azaozz
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Agree with @helen, there is no mention of attributes order in either HTML 4.0, XHTML 1.0 or HTML 5.0 specs.

The link in the support thread is about compressing server output, has nothing to do with rankings or specs. Even looking at the HTML source of that google page, there is a link in the footer where href is the last attribute :)

As TinyMCE serializes the DOM into a string, the attributes order can actually be set. If you feel strongly about that, perhaps open a ticket on their bug tracker.

Closing as worksforme. If changed upstream, it will be included with the TinyMCE updates.

#4 @EMG
11 years ago

Hi to both @helen and @azaozz! :)

Not trying to be argumentative, but for the purposes of this 'bug', I actually wasn't even taking into consideration of the SEO changes (if there actually are any; this was why I brought up the fact that there is no documentation to support what tags ought to be in what order).

Rather, my concern was more for the fact that even though the typed coding was correct, swapping to Visual Editor and back to Text Editor forced the typed links in question to swap tag orders for apparently no reason. In other words, this was/is unexpected behavior.

Is this something controlled entirely by TinyMCE (which, if I was reading @azaozz's comment correctly, seems to be the case and in which case, I'll definitely go file a bug there) and/or is there an explanation for this sort of unexpected behavior?

Something that I - as a Forum Volunteer - can tell people on the forums if this sort of question/concern comes up again? Besides, "don't worry about it?"

Thanks in advance and I appreciate your thoughts! :)

#5 @DLR1029
11 years ago

Amazing.

Then please include instructions on how to Remove TINYMCE from Wordpress installations. For Designers who prefer coding the Correct way maybe Wordpress and/or TinyMCE isn't a solution anymore.

If Google Posts something like the one we referenced That's all Designers can go on, so unless it's confirmed with Google it's an Unknown. Specially since there is "no mention" that it's either good nor bad.

As for being Skeptical, We aren't some little kid in Mommy's basement, we've been professional Designers since 1992 and know what to look at when Rankings drop. It's come down to This issue and the sites we've Recoded have returned to their previous Rankings. Trust me, thinking that just because Google has an Error on their own website means it's OK is far from the truth. Their websites run Rampant with Errors that if done by anyone else would slaughter their Rankings.

Note: See TracTickets for help on using tickets.