Opened 14 years ago

Closed 14 years ago

#981 closed defect (fixed)

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@…


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.


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

Won't work without correct doctype declaration.

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "">

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

best regards,

Attachments (1)

ie_img_padding_doctype.patch (670 bytes) - added by axel@… 14 years ago.

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by axel@…

comment:1 Changed 14 years ago by ray

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

comment:2 Changed 14 years ago by ray

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 14 years ago by axel@…

  • Resolution fixed deleted
  • Status changed from closed to reopened


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,

comment:4 Changed 14 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
  // 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.

comment:5 Changed 14 years ago by ray

  • Milestone set to Version 1.0
  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.