X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=classes%2Fdocument.php-class;h=1f4d8a2c17af82857f4e06ae5a9138d1c2b20308;hp=d2e9aff3ef105989212f27adc028c4ab4ba34421;hb=b841a92bbdccbbc2d14dfb1453ce6791eacebf3c;hpb=0bbc241e7d4e54f0ff7efbc1a4deb4225bc90ec8 diff --git a/classes/document.php-class b/classes/document.php-class index d2e9aff..1f4d8a2 100755 --- a/classes/document.php-class +++ b/classes/document.php-class @@ -1,23 +1,7 @@ - * - * ***** END LICENSE BLOCK ***** */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ class ExtendedDocument extends DOMDocument { // ExtendedDocument PHP class @@ -27,8 +11,9 @@ class ExtendedDocument extends DOMDocument { // CONSTRUCTOR // construct a new DOM Document that uses our element definitions // - // static function initHTML5() + // static function initHTML5([$doc]) // initialize as an HTML5 document and return references to its basic elements. + // If a $doc is handed over (an ExtendedDocument or a derived class), load the content into that document. // returns an associative array with the following elements: 'html', 'head', 'title', 'body' // // public function appendElement($name, [$value]) @@ -214,8 +199,8 @@ class ExtendedDocument extends DOMDocument { $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment'); } - static function initHTML5() { - $doc = new ExtendedDocument(); + static function initHTML5($doc = null) { + if (is_null($doc)) { $doc = new ExtendedDocument(); } $doc->loadHTML(''); // this seems to be the only way to get the DOCTYPE set properly. // Created basic HTML document structure.