projects
/
php-utility-classes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
880bcb6
)
enable a derived class to init HTML5 to its own document class - this was needed...
author
Robert Kaiser
<kairo@kairo.at>
Tue, 29 Nov 2016 20:05:33 +0000
(21:05 +0100)
committer
Robert Kaiser
<kairo@kairo.at>
Tue, 29 Nov 2016 20:05:33 +0000
(21:05 +0100)
classes/document.php-class
patch
|
blob
|
blame
|
history
diff --git
a/classes/document.php-class
b/classes/document.php-class
index 218ec3cfde4950d2475bc9b614a87769632d478e..1f4d8a2c17af82857f4e06ae5a9138d1c2b20308 100755
(executable)
--- a/
classes/document.php-class
+++ b/
classes/document.php-class
@@
-11,8
+11,9
@@
class ExtendedDocument extends DOMDocument {
// CONSTRUCTOR
// construct a new DOM Document that uses our element definitions
//
// 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.
// 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])
// returns an associative array with the following elements: 'html', 'head', 'title', 'body'
//
// public function appendElement($name, [$value])
@@
-198,8
+199,8
@@
class ExtendedDocument extends DOMDocument {
$this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
}
$this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
}
- static function initHTML5() {
- $doc = new ExtendedDocument();
+ static function initHTML5(
$doc = null
) {
+ if (is_null($doc)) { $doc = new ExtendedDocument(); }
$doc->loadHTML('<!DOCTYPE html><html></html>'); // this seems to be the only way to get the DOCTYPE set properly.
// Created basic HTML document structure.
$doc->loadHTML('<!DOCTYPE html><html></html>'); // this seems to be the only way to get the DOCTYPE set properly.
// Created basic HTML document structure.