X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Fdocument.js;h=a959fa5fca00985d5cd24f99b8375ee97240f006;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=a68ddf5394201c13f289c4f656786042c08b77ec;hpb=614511639979907ceb0da3614122a4d8eb963ad4;p=ckeditor.git diff --git a/_source/core/dom/document.js b/_source/core/dom/document.js index a68ddf5..a959fa5 100644 --- a/_source/core/dom/document.js +++ b/_source/core/dom/document.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -165,6 +165,9 @@ CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype, getHead : function() { var head = this.$.getElementsByTagName( 'head' )[0]; + if ( !head ) + head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true ); + else head = new CKEDITOR.dom.element( head ); return ( @@ -220,5 +223,29 @@ CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype, { return win; })(); + }, + + /** + * Defines the document contents through document.write. Note that the + * previous document contents will be lost (cleaned). + * @since 3.5 + * @param {String} html The HTML defining the document contents. + * @example + * document.write( + * '<html>' + + * '<head><title>Sample Doc</title></head>' + + * '<body>Document contents created by code</body>' + + * '</html>' ); + */ + write : function( html ) + { + // Don't leave any history log in IE. (#5657) + this.$.open( 'text/html', 'replace' ); + + // Support for custom document.domain in IE. + CKEDITOR.env.isCustomDomain() && ( this.$.domain = document.domain ); + + this.$.write( html ); + this.$.close(); } });