Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8389 closed Bug (invalid)

Editor expands <object /> to <object></object> and encloses trailing text

Reported by: frimicc Owned by:
Priority: Normal Milestone:
Component: Core : Parser Version: 3.6.2
Keywords: Cc:


When the following is pasted into the nightly demo CKEditor's Source view: <p><a class="subscriptions-link" href="/subscriptions/"><object data="urn:dynamic-text:journal-attribute:name" type="application/x-highwire-ui" />Subscriber Help &amp; Information:</a></p>

if you go to WYSIWYG view and then back to Source, it's been transformed into: <p>

<a class="subscriptions-link" href="/subscriptions/"><object data="urn:dynamic-text:journal-attribute:name" type="application/x-highwire-ui">Subscriber Help &amp; Information:</object></a></p>

which is problematic, because the new </object> tag the editor created has gobbled up the text that used to be beside it. The same problem occurs if you load into the editor a file which has the problematic <object /> tag in it already.

I've confirmed this on OS X in both Chrome 14.0.835.162 and Firefox 6.0.2 using .

Change History (2)

comment:1 Changed 12 years ago by Frederico Caldeira Knabben

Component: GeneralCore : Parser
Resolution: invalid
Status: newclosed

The fact is that the <object> element is not self-closing and requires the closing </object> pair. I'm not the one saying so, but the W3C itself (see the object element definition).

This leads to the problem, because the browsers (not the editor), see <object /> as an opening tag with no closing pair, putting everything after it into it.

You can try it yourself. Just create a page like this:

	<script type="text/javascript">
window.onload = function ()
	alert( document.body.innerHTML );
		<a class="subscriptions-link" href="/subscriptions/">
			<object data="urn:dynamic-text:journal-attribute:name" type="application/x-highwire-ui" />
			Subscriber Help &amp; Information:</a></p>

You'll see that you'll have the same output you'll have from the editor.

So, the possible solutions here:

  1. Do not use <object />, making it right: <object></object>.
  1. Use the protect source feature to protect the weird <object />.

comment:2 Changed 12 years ago by frimicc

I didn't define this syntax, but knowing that <object /> is invalid HTML will let me try to talk the people who came up with the idea into changing it. In the meantime, I'll use protectedSource. Thanks for the help!

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy