Ticket #981 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

No doctype in iframe content document/ editor always in quirks mode

Reported by: axel@… Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version: trunk
Severity: normal Keywords: ie, padding, img, doctype,
Cc: axel@…

Description

If i use the style attribute padding for an im tag, ie will ignore it without a correct doctype declaration. I found out that htmlarea has also a variable doctype and a function to set the doctype, but unfortunately it won't we used.

Example:

<img src="..." style="padding: 25px; border: 1px solid #b6b6b6; background-color: #eeeeee;"/>

Won't work without correct doctype declaration.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I've fixed this problem and created a pacht, if somebody is interested in it, please contact me.

best regards, axel

Attachments

ie_img_padding_doctype.patch (0.7 kB) - added by axel@… 2 years ago.

Change History

Changed 2 years ago by axel@…

Changed 2 years ago by ray

  • summary changed from IE img style padding problem to No doctype in iframe content document/ editor always in quirks mode

Changed 2 years ago by ray

  • status changed from new to closed
  • resolution set to fixed

rev [771]: made the iframe document use either one defined by xinha_config.doctype or the one of the document, if it is set (actually only in Mozilla, in IE using HTML 4.01 or none depending on current rendering mode).

I noticed that in fullpage mode the doctype is explicitly stripped, so there may be a problem I'm not aware of in the moment

Changed 2 years ago by axel@…

  • status changed from closed to reopened
  • resolution deleted

Hi,

today i updated my svn repos and testet the new Version. Unfortunately my problem is not fixed. I analysed the new code and found following issues.

I setup the doctype over following method:

Xinha.prototype.setDoctype = function(doctype) {

this.doctype = doctype;

};

The value is stored in this.doctype.

Now take a look at the initiframe method:

Xinha.prototype.initIframe = function(){ .. .. ..

if ( !editor.config.fullPage ) {

html += editor.config.doctype ? editor.config.doctype : xinha.getDoctype(document) + "\n";

.. .. .. }

I put some alerts around the code and found out that editor.config.doctype is alwasy empty. Also the xinha.getDoctype method returns a wrong doctype.

best regards, axel

Changed 2 years ago by ray

Xinha.prototype.setDoctype() is a private method, so forget it for this purpose. All configuration is to be done via the Xinha.Config object.

In detail: For the problem in question here the actual doctype is relatively irrelevant. What is important is the browser's rendering mode, that is only switched by the presence or absence of a (any) doctype.

Based on this thought in rev [773] I introduce the following Xinha.Config property

  // Whether the edited document should be rendered in Quirksmode or Standard Compliant (Strict) Mode
  // This is commonly known as the "doctype switch"
  // for details read here http://www.quirksmode.org/css/quirksmode.html
  //
  // Possible values:
  //    true     :  Quirksmode is used
  //    false    :  Strict mode is used
  // leave empty :  the mode of the document Xinha is in is used
  this.browserQuirksMode = '';

That is to get e.g. the padding for images you need the strict mode, and you have two options to achive this

  1. set
     xinha_config.browserQuirksMode = false;
    
  2. Use a doctype in the document that holds the editor

Note: All this has only an effect in non-fullpage mode, as in fullpage the doctype has to be in the edited document itself.

Changed 2 years ago by ray

  • status changed from reopened to closed
  • resolution set to fixed
  • milestone set to Version 1.0
Note: See TracTickets for help on using tickets.