Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#2807 closed New Feature (wontfix)

Fatal error when using content-type: application/xhtml+xml

Reported by: Dmitri Ponomarjov Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Review- CantFix Cc:

Description

Steps to reproduce:

  1. Use "content-type: application/xhtml+xml" in HTTP response headers.
  2. Initialise FCKEditor using the following Javascript code:

<script type="text/javascript"> var oFCKeditor = new FCKeditor('content'); oFCKeditor.BasePath = "../externals/fckeditor/"; oFCKeditor.Value = ; oFCKeditor.Create(); </script> Result: FCKEditor is not started. The following error message can be seen in FireBug extension for Firefox.

uncaught exception: Operation is not supported (NS_ERROR_DOM_NOT_SUPPORTED_ERR) [Break on this error] document.write( this.CreateHtml() ) ; fckeditor.js (line 67)

This problem is not appearing if 'content-type: text/html' is used in HTTP headers.

This problem has been reproduced on the following software: OS: Windows XP SP3 Eng Browsers: Firefox 3.0.5, Google Chrome 1.0.154.43, Safari 3.1.1 (525.17), Opera 9.63

Attachments (2)

xhtml.php (758 bytes) - added by Artur Formella 15 years ago.
2807.patch (587 bytes) - added by Artur Formella 15 years ago.

Download all attachments as: .zip

Change History (9)

Changed 15 years ago by Artur Formella

Attachment: xhtml.php added

comment:1 Changed 15 years ago by Artur Formella

Resolution: invalid
Status: newclosed

W3c says:

Does document.write work in XHTML?

No. Because of the way XML is defined, it is not possible to do tricks like this, where markup is generated by scripting while the parser is still parsing the markup.

You can still achieve the same effects, but you have to do it by using the DOM to add and delete elements.

I attached a sample solution using innerHTML, but you can also use other methods.

comment:2 Changed 15 years ago by Dmitri Ponomarjov

Resolution: invalid
Status: closedreopened

Yes, arczi is right - the problem is caused by unability to use the document.write() method for XHTML applications. Why not to fix FCKEditor::Create() method instead of using the workaround with FCKEditor::CreateHTML() for an everyday situation? document.write is clearly not the optimal long-term solution for the modern web, so this should be at least replaced with innerHTML for the browsers capable of innerHTML operations.

comment:3 Changed 15 years ago by Artur Formella

Type: BugNew Feature

Is it possible to detect content-type with javascript?

comment:4 Changed 15 years ago by Artur Formella

Keywords: Review? added

Example with try-catch in attachment.

Changed 15 years ago by Artur Formella

Attachment: 2807.patch added

comment:5 Changed 15 years ago by Alfonso Martínez de Lizarrondo

Keywords: Review- added; Review? removed

Injecting the code inside a span looks like a very bad solution, you should use a div. Also, IMHO, it's better to use the sample that you have created xhtml.php, after all almost no one is using xhtml+xml.

The code inside the editor does use iframes, document.write, and document.contentEditable, those are invalid under XHTML, so I doubt that changing the fckeditor.js is enough in order to get full xhtml+xml compatibility.

comment:6 in reply to:  5 Changed 15 years ago by Artur Formella

Resolution: wontfix
Status: reopenedclosed

Replying to alfonsoml:

The code inside the editor does use iframes, document.write, and document.contentEditable, those are invalid under XHTML, so I doubt that changing the fckeditor.js is enough in order to get full xhtml+xml compatibility.

We can't fix it. Editor is based on document.contentEditable and iframes.

comment:7 Changed 15 years ago by Frederico Caldeira Knabben

Keywords: CantFix added
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