2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 class ExtendedDocument extends DOMDocument {
7 // ExtendedDocument PHP class
8 // this extends the general PHP DOM Document class to simplify some usual constructs
10 // function __construct([$version], [$encoding])
12 // construct a new DOM Document that uses our element definitions
14 // static function initHTML5([$doc])
15 // initialize as an HTML5 document and return references to its basic elements.
16 // If a $doc is handed over (an ExtendedDocument or a derived class), load the content into that document.
17 // returns an associative array with the following elements: 'html', 'head', 'title', 'body'
19 // public function appendElement($name, [$value])
20 // appends a DOMDocument::createElement() as a child of this document (see there for params)
21 // returns the new child
23 // public function appendElementXML($name, $xmldata)
24 // appends a DOMDocument::createElement() with the given name as a child of this document,
25 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
26 // returns the new child
28 // public function appendLink($target, [$value], [$title])
29 // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
30 // returns the new child
32 // public function appendImage($src, [$alt_text])
33 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
34 // returns the new child
36 // public function appendForm($action, $method, $name, [$id])
37 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
38 // returns the new child
40 // public function appendFormDiv($action, $method, $name, [$id])
41 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
42 // returns an HTML <div> that is a child of the new child
44 // public function appendInputHidden($name, $value)
45 // appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params)
46 // returns the new child
48 // public function appendInputText($name, $maxlength, $size, [$id], [$value])
49 // appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
50 // returns the new child
52 // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
53 // appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
54 // returns the new child
56 // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
57 // appends an ExtendedDocument::createElementInputNumber() as a child of this document (see there for params)
58 // returns the new child
60 // public function appendInputRange($name, $id, $min, $max, [$step], [$value])
61 // appends an ExtendedDocument::createElementInputRange() as a child of this document (see there for params)
62 // returns the new child
64 // public function appendInputUrl($name, $maxlength, $size, [$id], [$value])
65 // appends an ExtendedDocument::createElementInputUrl() as a child of this document (see there for params)
66 // returns the new child
68 // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
69 // appends an ExtendedDocument::createElementInputEmail() as a child of this document (see there for params)
70 // returns the new child
72 // public function appendInputTel($name, $maxlength, $size, [$id], [$value])
73 // appends an ExtendedDocument::createElementInputTel() as a child of this document (see there for params)
74 // returns the new child
76 // public function appendInputDate($name, [$id], [$min], [$max], [$value])
77 // appends an ExtendedDocument::createElementInputDate() as a child of this document (see there for params)
78 // returns the new child
80 // public function appendInputTime($name, [$id], [$min], [$max], [$value])
81 // appends an ExtendedDocument::createElementInputTime() as a child of this document (see there for params)
82 // returns the new child
84 // public function appendInputColor($name, [$id], [$value])
85 // appends an ExtendedDocument::createElementInputColor() as a child of this document (see there for params)
86 // returns the new child
88 // public function appendInputRadio($name, $id, $value, $checked)
89 // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
90 // returns the new child
92 // public function appendInputCheckbox($name, $id, $value, $checked)
93 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
94 // returns the new child
96 // public function appendInputFile($name, $id, $accept)
97 // appends an ExtendedDocument::createElementInputFile() as a child of this document (see there for params)
98 // returns the new child
100 // public function appendInputSubmit($value)
101 // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
102 // returns the new child
104 // public function appendButton($value, $onclick = null)
105 // appends an ExtendedDocument::createElementButton() as a child of this document (see there for params)
106 // returns the new child
108 // public function appendTextArea($name, $columns, $rows, [$id], [$value])
109 // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
110 // returns the new child
112 // public function appendElementSelect($name, [$id], [$options], [$default], [$strictmatch])
113 // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
114 // returns the new child
116 // public function appendElementOption($key, $desc, [$selected])
117 // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
118 // returns the new child
120 // public function appendLabel($for_id, $value)
121 // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
122 // returns the new child
124 // public function appendText($text)
125 // appends a DOMDocument::createTextNode() as a child of this document (see there for params)
126 // returns the new child
128 // public function appendLinebreak()
129 // appends a <br> as a child of this document
130 // returns the new child
132 // public function appendEntity($name)
133 // appends a DOMDocument::createEntityReference() as a child of this document (see there for params)
134 // returns the new child
136 // public function appendComment($comment_data)
137 // appends a DOMDocument::createComment() as a child of this document (see there for params)
138 // returns the new child
140 // public function appendHTMLMarkup($htmldata, [$parentNode])
141 // appends a representation of the HTML data as children of the given parent node, by default this document
144 // public function appendXMLMarkup($xmldata, [$parentNode])
145 // appends a representation of the XML data as children of the given parent node, by default this document
148 // public function appendJSElement($jsdata)
149 // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
152 // public function appendJSFile($jsURL, [$defer], [$async])
153 // appends an ExtendedDocument::createElementJSFile() as a child of this document (see there for params)
154 // returns the new child
156 // public function createElementLink($target, [$value], [$title])
157 // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value as well as (optional) title attribute
159 // public function createElementImage($src, [$alt_text])
160 // returns an ExtendedElement that is an HTML <img> with the given src and alt attributes (set to '' by default)
162 // public function createElementForm($action, $method, $name)
163 // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
164 // with the given action, method, and name
166 // public function createElementInputHidden($name, $value)
167 // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
169 // public function createElementInputText($name, $maxlength, $size, [$id], [$value])
170 // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
171 // and optionally id and value
173 // public function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
174 // returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
175 // and optionally id and value
177 // public function createElementInputNumber($name, $maxlength, $size, [$id], [$value])
178 // returns an ExtendedElement that is an HTML <input> of type 'number' with the given name, maxlength, size,
179 // and optionally id and value
181 // public function createElementInputRange($name, $id, $min, $max, [$step], [$value])
182 // returns an ExtendedElement that is an HTML <input> of type 'range' with the given name, id, min, max,
183 // and optionally step and value
185 // public function createElementInputUrl($name, $maxlength, $size, [$id], [$value])
186 // returns an ExtendedElement that is an HTML <input> of type 'url' with the given name, maxlength, size,
187 // and optionally id and value
189 // public function createElementInputEmail($name, $maxlength, $size, [$id], [$value])
190 // returns an ExtendedElement that is an HTML <input> of type 'email' with the given name, maxlength, size,
191 // and optionally id and value
193 // public function createElementInputTel($name, $maxlength, $size, [$id], [$value])
194 // returns an ExtendedElement that is an HTML <input> of type 'tel' with the given name, maxlength, size,
195 // and optionally id and value
197 // public function createElementInputDate($name, [$id], [$min], [$max], [$value])
198 // returns an ExtendedElement that is an HTML <input> of type 'date' with the given name,
199 // and optionally id, min, max, and value
201 // public function createElementInputTime($name, [$id], [$min], [$max], [$value])
202 // returns an ExtendedElement that is an HTML <input> of type 'time' with the given name,
203 // and optionally id, min, max, and value
205 // public function createElementInputColor($name, [$id], [$value])
206 // returns an ExtendedElement that is an HTML <input> of type 'color' with the given name,
207 // and optionally id and value
209 // public function createElementInputRadio($name, $id, $value, $checked)
210 // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
213 // public function createElementInputCheckbox($name, $id, $value, $checked)
214 // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
217 // public function createElementInputFile($name, $id, $accept)
218 // returns an ExtendedElement that is an HTML <input> of type 'file' with the given name, id and accept
220 // public function createElementInputSubmit($value)
221 // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
223 // public function createElementButton($value, $onclick = null)
224 // returns an ExtendedElement that is an HTML button with the given value as label and optionally onclick attribute
226 // public function createElementTextArea($name, $columns, $rows, [$id], [$value])
227 // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
228 // and optionally id and value
230 // public function createElementSelect($name, [$id], [$options], [$default], [$strictmatch])
231 // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
232 // array of options (key => description) and key of the by-default selected entry (matched including type when strictmatch is true)
234 // public function createElementOption($key, $desc, [$selected])
235 // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
236 // and optionally bool that tells if the entry is selected
238 // public function createElementLabel($for_id, $value)
239 // returns an ExtendedElement that is an HTML <label> with the given 'for' and value
241 // public function createElementJS($jsdata)
242 // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
244 // public function createElementJSFile($jsURL, [$defer], [$async])
245 // returns an ExtendedElement that is an HTML <script> of JavaScript type linking to the file given by the URL
246 // $defer and $async are boolean attributes that set if the script should be executed after parsing but before onload, and if it should be loaded asynchronously.
248 function __construct($version = '1.0', $encoding = 'utf-8') {
249 // make sure the default DOMDocument constructor runs
250 parent::__construct($version, $encoding);
251 $this->registerNodeClass('DOMElement', 'ExtendedElement');
252 $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
255 static function initHTML5($doc = null) {
256 if (is_null($doc)) { $doc = new ExtendedDocument(); }
257 $doc->loadHTML('<!DOCTYPE html><html></html>'); // this seems to be the only way to get the DOCTYPE set properly.
259 // Created basic HTML document structure.
260 $root = $doc->getElementsByTagName('html')->item(0);
261 $head = $root->appendElement('head');
262 $title = $head->appendElement('title');
263 $body = $root->appendElement('body');
265 return array('document' => $doc,
272 public function appendElement($name, $value = '') {
273 return $this->appendChild($this->createElement($name, $value));
275 public function appendElementXML($name, $xmldata) {
276 $aelem = $this->appendChild($this->createElement($name));
277 $aelem->appendXMLMarkup($xmldata);
278 //$aelem->appendChild($this->createXMLFragment($xmldata));
281 public function appendLink($target, $value = '', $title = null) {
282 return $this->appendChild($this->createElementLink($target, $value, $title));
284 public function appendImage($src, $alt_text = '') {
285 return $this->appendChild($this->createElementImage($src, $alt_text));
287 public function appendForm($action, $method, $name, $id = null) {
288 return $this->appendChild($this->createElementForm($action, $method, $name, $id));
290 public function appendFormDiv($action, $method, $name, $id = null) {
291 $formelem = $this->appendChild($this->createElementForm($action, $method, $name, $id));
292 return $formelem->appendElement('div');
294 public function appendInputHidden($name, $value) {
295 return $this->appendChild($this->createElementInputHidden($name, $value));
297 public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
298 return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
300 public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
301 return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
303 public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
304 return $this->appendChild($this->createElementInputNumber($name, $maxlength, $size, $id, $value));
306 public function appendInputRange($name, $id, $min, $max, $step = null, $value = null) {
307 return $this->appendChild($this->createElementInputRange($name, $id, $min, $max, $step, $value));
309 public function appendInputUrl($name, $maxlength, $size, $id = null, $value = null) {
310 return $this->appendChild($this->createElementInputUrl($name, $maxlength, $size, $id, $value));
312 public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
313 return $this->appendChild($this->createElementInputEmail($name, $maxlength, $size, $id, $value));
315 public function appendInputTel($name, $maxlength, $size, $id = null, $value = null) {
316 return $this->appendChild($this->createElementInputTel($name, $maxlength, $size, $id, $value));
318 public function appendInputDate($name, $id = null, $min = null, $max = null, $value = null) {
319 return $this->appendChild($this->createElementInputDate($name, $id, $min, $max, $value));
321 public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
322 return $this->appendChild($this->createElementInputTime($name, $id, $min, $max, $value));
324 public function appendInputColor($name, $id = null, $value = null) {
325 return $this->appendChild($this->createElementInputColor($name, $id, $value));
327 public function appendInputRadio($name, $id, $value, $checked) {
328 return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
330 public function appendInputCheckbox($name, $id, $value, $checked) {
331 return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
333 public function appendInputFile($name, $id, $accept) {
334 return $this->appendChild($this->createElementInputFile($name, $id, $accept));
336 public function appendInputSubmit($value) {
337 return $this->appendChild($this->createElementInputSubmit($value));
339 public function appendButton($value, $onclick = null) {
340 return $this->appendChild($this->createElementButton($value, $onclick));
342 public function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
343 return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
345 public function appendElementSelect($name, $id = null, $options = array(), $default = null, $strictmatch = false) {
346 return $this->appendChild($this->createElementSelect($name, $id, $options, $default, $strictmatch));
348 public function appendElementOption($key, $desc, $selected = false) {
349 return $this->appendChild($this->createElementOption($key, $desc, $selected));
351 public function appendLabel($for_id, $value) {
352 return $this->appendChild($this->createElementLabel($for_id, $value));
354 public function appendText($text) {
355 return $this->appendChild($this->createTextNode($text));
357 public function appendLinebreak() {
358 return $this->appendChild($this->createElement('br'));
360 public function appendEntity($name) {
361 return $this->appendChild($this->createEntityReference($name));
363 public function appendComment($comment_data) {
364 return $this->appendChild($this->createComment($comment_data));
366 public function appendJSElement($jsdata) {
367 $this->appendChild($this->createElementJS($jsdata));
369 public function appendJSFile($jsdata, $defer = false, $async = false) {
370 return $this->appendChild($this->createElementJSFile($jsdata, $defer, $async));
373 public function appendHTMLMarkup($htmldata, $parentNode = null) {
374 if (is_null($parentNode)) { $parentNode =& $this; }
375 // Use loadHTML() to parse and turn the markup into proper HTML.
376 $tmpdoc = new ExtendedDocument;
377 // The XML line is needed to tell the parser that we need UTF-8 parsing.
378 $tmpdoc->loadHTML('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html><html><body>'.$htmldata.'</body></html>');
379 foreach ($tmpdoc->getElementsByTagName('body')->item(0)->childNodes as $child) {
380 $parentNode->appendChild($this->importNode($child, true));
384 public function appendXMLMarkup($xmldata, $parentNode = null) {
385 if (is_null($parentNode)) { $parentNode =& $this; }
386 $tmpdoc = new ExtendedDocument;
387 $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
388 $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
389 $tmpxml .= '<root>'.$xmldata.'</root>';
390 $tmpdoc->loadXML($tmpxml);
391 foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
392 $parentNode->appendChild($this->importNode($child, true));
396 public function createElement($name, $value = '') {
397 // Adding the $value in DOMDocument's createElement does NOT escape it, so override it and use appendText to support that.
398 $aelem = parent::createElement($name);
399 if (strlen($value)) { $aelem->appendText($value); }
403 public function createElementLink($target, $value = '', $title = null) {
404 $link = $this->createElement('a', $value);
405 $link->setAttribute('href', $target); // XXX: take care of & etc. in links
406 if (!is_null($title)) { $link->setAttribute('title', $title); }
410 public function createElementImage($src, $alt_text = '') {
411 $img = $this->createElement('img');
412 $img->setAttribute('src', $src);
413 $img->setAttribute('alt', $alt_text);
417 public function createElementForm($action, $method, $name, $id = null) {
418 $formelem = $this->createElement('form');
419 $formelem->setAttribute('action', $action);
420 $formelem->setAttribute('method', $method);
421 $formelem->setAttribute('name', $name);
422 if (!is_null($id)) { $formelem->setAttribute('id', $id); }
426 public function createElementInputHidden($name, $value) {
427 $hidden = $this->createElement('input');
428 $hidden->setAttribute('type', 'hidden');
429 $hidden->setAttribute('name', $name);
430 $hidden->setAttribute('value', $value);
434 public function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
435 $txfield = $this->createElement('input');
436 $txfield->setAttribute('type', 'text');
437 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
438 $txfield->setAttribute('name', $name);
439 $txfield->setAttribute('maxlength', $maxlength);
440 $txfield->setAttribute('size', $size);
441 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
445 public function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
446 $pwfield = $this->createElement('input');
447 $pwfield->setAttribute('type', 'password');
448 if (!is_null($id)) { $pwfield->setAttribute('id', $id); }
449 $pwfield->setAttribute('name', $name);
450 $pwfield->setAttribute('maxlength', $maxlength);
451 $pwfield->setAttribute('size', $size);
452 if (!is_null($value)) { $pwfield->setAttribute('value', $value); }
456 public function createElementInputNumber($name, $maxlength, $size, $id = null, $value = null) {
457 $numfield = $this->createElement('input');
458 $numfield->setAttribute('type', 'number');
459 if (!is_null($id)) { $numfield->setAttribute('id', $id); }
460 $numfield->setAttribute('name', $name);
461 $numfield->setAttribute('maxlength', $maxlength);
462 $numfield->setAttribute('size', $size);
463 if (!is_null($value)) { $numfield->setAttribute('value', $value); }
467 public function createElementInputRange($name, $id, $min, $max, $step = null, $value = null) {
468 $rgfield = $this->createElement('input');
469 $rgfield->setAttribute('type', 'range');
470 if (!is_null($id)) { $rgfield->setAttribute('id', $id); }
471 $rgfield->setAttribute('name', $name);
472 if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
473 if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
474 if (!is_null($step)) { $rgfield->setAttribute('step', $step); }
475 if (!is_null($value)) { $rgfield->setAttribute('value', $value); }
479 public function createElementInputUrl($name, $maxlength, $size, $id = null, $value = null) {
480 $urlfield = $this->createElement('input');
481 $urlfield->setAttribute('type', 'url');
482 if (!is_null($id)) { $urlfield->setAttribute('id', $id); }
483 $urlfield->setAttribute('name', $name);
484 $urlfield->setAttribute('maxlength', $maxlength);
485 $urlfield->setAttribute('size', $size);
486 if (!is_null($value)) { $urlfield->setAttribute('value', $value); }
490 public function createElementInputEmail($name, $maxlength, $size, $id = null, $value = null) {
491 $mailfield = $this->createElement('input');
492 $mailfield->setAttribute('type', 'email');
493 if (!is_null($id)) { $mailfield->setAttribute('id', $id); }
494 $mailfield->setAttribute('name', $name);
495 $mailfield->setAttribute('maxlength', $maxlength);
496 $mailfield->setAttribute('size', $size);
497 if (!is_null($value)) { $mailfield->setAttribute('value', $value); }
501 public function createElementInputTel($name, $maxlength, $size, $id = null, $value = null) {
502 $telfield = $this->createElement('input');
503 $telfield->setAttribute('type', 'tel');
504 if (!is_null($id)) { $telfield->setAttribute('id', $id); }
505 $telfield->setAttribute('name', $name);
506 $telfield->setAttribute('maxlength', $maxlength);
507 $telfield->setAttribute('size', $size);
508 if (!is_null($value)) { $telfield->setAttribute('value', $value); }
512 public function createElementInputDate($name, $id = null, $min = null, $max = null, $value = null) {
513 $telfield = $this->createElement('input');
514 $telfield->setAttribute('type', 'date');
515 if (!is_null($id)) { $telfield->setAttribute('id', $id); }
516 if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
517 if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
518 if (!is_null($value)) { $telfield->setAttribute('value', $value); }
522 public function createElementInputTime($name, $id = null, $min = null, $max = null, $value = null) {
523 $telfield = $this->createElement('input');
524 $telfield->setAttribute('type', 'time');
525 if (!is_null($id)) { $telfield->setAttribute('id', $id); }
526 if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
527 if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
528 if (!is_null($value)) { $telfield->setAttribute('value', $value); }
532 public function createElementInputColor($name, $id = null, $value = null) {
533 $colfield = $this->createElement('input');
534 $colfield->setAttribute('type', 'color');
535 if (!is_null($id)) { $colfield->setAttribute('id', $id); }
536 $colfield->setAttribute('name', $name);
537 if (!is_null($value)) { $colfield->setAttribute('value', $value); }
541 public function createElementInputRadio($name, $id, $value, $checked) {
542 $radio = $this->createElement('input');
543 $radio->setAttribute('type', 'radio');
544 $radio->setAttribute('name', $name);
545 if (!is_null($id)) { $radio->setAttribute('id', $id); }
546 $radio->setAttribute('value', $value);
547 if ($checked) { $radio->setAttribute('checked', ''); }
551 public function createElementInputCheckbox($name, $id, $value, $checked) {
552 $cbox = $this->createElement('input');
553 $cbox->setAttribute('type', 'checkbox');
554 $cbox->setAttribute('name', $name);
555 if (!is_null($id)) { $cbox->setAttribute('id', $id); }
556 $cbox->setAttribute('value', $value);
557 if ($checked) { $cbox->setAttribute('checked', ''); }
561 public function createElementInputFile($name, $id, $accept) {
562 $fileinput = $this->createElement('input');
563 $fileinput->setAttribute('type', 'file');
564 $fileinput->setAttribute('name', $name);
565 if (!is_null($id)) { $fileinput->setAttribute('id', $id); }
566 $fileinput->setAttribute('accept', $accept);
570 public function createElementInputSubmit($value) {
571 $submitbtn = $this->createElement('input');
572 $submitbtn->setAttribute('type', 'submit');
573 $submitbtn->setAttribute('value', $value);
577 public function createElementButton($value, $onclick = null) {
578 $btn = $this->createElement('input');
579 $btn->setAttribute('type', 'button');
580 $btn->setAttribute('value', $value);
581 if (!is_null($onclick)) { $btn->setAttribute('onclick', $onclick); }
585 public function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
586 $txtarea = $this->createElement('textarea', $value);
587 $txtarea->setAttribute('name', $name);
588 $txtarea->setAttribute('cols', $columns);
589 $txtarea->setAttribute('rows', $rows);
590 if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
594 public function createElementSelect($name, $id = null, $options = array(), $default = null, $strictmatch = false) {
595 $select = $this->createElement('select');
596 $select->setAttribute('name', $name);
597 if (!is_null($id)) { $select->setAttribute('id', $id); }
598 foreach ($options as $key => $desc) {
599 $select->appendElementOption($key, $desc, $strictmatch ? ($key === $default) : ($key == $default));
604 public function createElementOption($key, $desc, $selected = false) {
605 $option = $this->createElement('option', $desc);
606 $option->setAttribute('value', $key);
607 if ($selected) { $option->setAttribute('selected', ''); }
611 public function createElementLabel($for_id, $value) {
612 $label = $this->createElement('label', $value);
613 $label->setAttribute('for', $for_id);
617 public function createElementJS($jsdata) {
618 $jselem = $this->createElement('script');
619 // Note: type can/should be left out for HTML5.
620 $jselem->setAttribute('type', 'text/javascript');
621 $jselem->appendChild($this->createCDATASection($jsdata));
625 public function createElementJSFile($jsURL, $defer = false, $async = false) {
626 $jselem = $this->createElement('script');
627 // Note: type can/should be left out for HTML5.
628 $jselem->setAttribute('type', 'text/javascript');
630 $jselem->setAttribute('defer', '');
633 $jselem->setAttribute('async', '');
635 $jselem->setAttribute('src', $jsURL);
640 class ExtendedElement extends DOMElement {
641 // ExtendedElement PHP class
642 // this extends the general PHP DOM Element class to simplify some usual constructs
644 // public function appendElement($name, [$value])
645 // appends a DOMDocument::createElement() as a child of this element (see there for params)
646 // returns the new child
648 // public function appendElementXML($name, $xmldata)
649 // appends a DOMDocument::createElement() with the given name as a child of this element,
650 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
651 // returns the new child
653 // public function appendLink($target, [$value], [$title])
654 // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
655 // returns the new child
657 // public function appendImage($src, [$alt_text])
658 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
659 // returns the new child
661 // public function appendForm($action, $method, $name, [$id])
662 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
663 // returns the new child
665 // public function appendFormDiv($action, $method, $name, [$id])
666 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
667 // returns an HTML <div> that is a child of the new child
669 // public function appendInputHidden($name, $value)
670 // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
671 // returns the new child
673 // public function appendInputText($name, $maxlength, $size, [$id], [$value])
674 // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
675 // returns the new child
677 // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
678 // appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
679 // returns the new child
681 // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
682 // appends an ExtendedDocument::createElementInputNumber() as a child of this element (see there for params)
683 // returns the new child
685 // public function appendInputRange($name, $id, $min, $max, [$step], [$value])
686 // appends an ExtendedDocument::createElementInputRange() as a child of this element (see there for params)
687 // returns the new child
689 // public function appendInputUrl($name, $maxlength, $size, [$id], [$value])
690 // appends an ExtendedDocument::createElementInputUrl() as a child of this element (see there for params)
691 // returns the new child
693 // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
694 // appends an ExtendedDocument::createElementInputEmail() as a child of this element (see there for params)
695 // returns the new child
697 // public function appendInputTel($name, $maxlength, $size, [$id], [$value])
698 // appends an ExtendedDocument::createElementInputTel() as a child of this element (see there for params)
699 // returns the new child
701 // public function appendInputDate($name, [$id], [$min], [$max], [$value])
702 // appends an ExtendedDocument::createElementInputDate() as a child of this element (see there for params)
703 // returns the new child
705 // public function appendInputTime($name, [$id], [$min], [$max], [$value])
706 // appends an ExtendedDocument::createElementInputTime() as a child of this element (see there for params)
707 // returns the new child
709 // public function appendInputColor($name, [$id], [$value])
710 // appends an ExtendedDocument::createElementInputColor() as a child of this element (see there for params)
712 // public function appendInputRadio($name, $id, $value, $checked)
713 // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
714 // returns the new child
716 // public function appendInputCheckbox($name, $id, $value, $checked)
717 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
718 // returns the new child
720 // public function appendInputFile($name, $id, $accept)
721 // appends an ExtendedDocument::createElementInputFile() as a child of this element (see there for params)
722 // returns the new child
724 // public function appendInputSubmit($value)
725 // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
726 // returns the new child
728 // public function appendButton($value, $onclick = null)
729 // appends an ExtendedDocument::createElementButton() as a child of this element (see there for params)
730 // returns the new child
732 // public function appendTextArea($name, $columns, $rows, [$id], [$value])
733 // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
734 // returns the new child
736 // public function appendElementSelect($name, [$id], [$options], [$default], [$strictmatch])
737 // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
738 // returns the new child
740 // public function appendElementOption($key, $desc, [$selected])
741 // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
742 // returns the new child
744 // public function appendLabel($for_id, $value)
745 // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
746 // returns the new child
748 // public function appendText($text)
749 // appends a DOMDocument::createTextNode() as a child of this element (see there for params)
750 // returns the new child
752 // public function appendLinebreak()
753 // appends a <br> as a child of this element
754 // returns the new child
756 // public function appendEntity($name)
757 // appends a DOMDocument::createEntityReference() as a child of this element (see there for params)
758 // returns the new child
760 // public function appendComment($comment_data)
761 // appends a DOMDocument::createComment() as a child of this element (see there for params)
762 // returns the new child
764 // public function appendHTMLMarkup($htmldata)
765 // appends a representation of the HTML data as children of this element
768 // public function appendXMLMarkup($xmldata)
769 // appends a representation of the XML data as children of this element
772 // public function appendJSElement($jsdata)
773 // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
776 // public function appendJSFile($jsURL, [$defer], [$async])
777 // appends an ExtendedDocument::createElementJSFile() as a child of this element (see there for params)
778 // returns the new child
780 // public function setClass($classname)
781 // sets the 'class' attribute of the element to the given classname value
783 // public function addClass($classname)
784 // adds the given classname value to the space-separated list in the 'class' attribute
785 // returns the value of the 'class' attribute
787 // public function setID($elem_id)
788 // sets the 'id' attribute of the element to the given elem_id value
790 public function appendElement($name, $value = '') {
791 return $this->appendChild($this->ownerDocument->createElement($name, $value));
793 public function appendElementXML($name, $xmldata) {
794 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
795 $aelem->appendXMLMarkup($xmldata);
798 public function appendLink($target, $value = '', $title = null) {
799 return $this->appendChild($this->ownerDocument->createElementLink($target, $value, $title));
801 public function appendImage($src, $alt_text = '') {
802 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
804 public function appendForm($action, $method, $name, $id = null) {
805 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
807 public function appendFormDiv($action, $method, $name, $id = null) {
808 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
809 return $formelem->appendElement('div');
811 public function appendInputHidden($name, $value) {
812 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
814 public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
815 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
817 public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
818 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
820 public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
821 return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
823 public function appendInputRange($name, $id, $min, $max, $step = null, $value = null) {
824 return $this->appendChild($this->ownerDocument->createElementInputRange($name, $id, $min, $max, $step, $value));
826 public function appendInputUrl($name, $maxlength, $size, $id = null, $value = null) {
827 return $this->appendChild($this->ownerDocument->createElementInputUrl($name, $maxlength, $size, $id, $value));
829 public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
830 return $this->appendChild($this->ownerDocument->createElementInputEmail($name, $maxlength, $size, $id, $value));
832 public function appendInputTel($name, $maxlength, $size, $id = null, $value = null) {
833 return $this->appendChild($this->ownerDocument->createElementInputTel($name, $maxlength, $size, $id, $value));
835 public function appendInputDate($name, $id = null, $min = null, $max = null, $value = null) {
836 return $this->appendChild($this->ownerDocument->createElementInputDate($name, $id, $min, $max, $value));
838 public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
839 return $this->appendChild($this->ownerDocument->createElementInputTime($name, $id, $min, $max, $value));
841 public function appendInputColor($name, $id = null, $value = null) {
842 return $this->appendChild($this->ownerDocument->createElementInputColor($name, $id, $value));
844 public function appendInputRadio($name, $id, $value, $checked) {
845 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
847 public function appendInputCheckbox($name, $id, $value, $checked) {
848 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
850 public function appendInputFile($name, $id, $accept) {
851 return $this->appendChild($this->ownerDocument->createElementInputFile($name, $id, $accept));
853 public function appendInputSubmit($value) {
854 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
856 public function appendButton($value, $onclick = null) {
857 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
859 public function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
860 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
862 public function appendElementSelect($name, $id = null, $options = array(), $default = null, $strictmatch = false) {
863 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default, $strictmatch));
865 public function appendElementOption($key, $desc, $selected = false) {
866 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
868 public function appendLabel($for_id, $value) {
869 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
871 public function appendText($text) {
872 return $this->appendChild($this->ownerDocument->createTextNode($text));
874 public function appendLinebreak() {
875 return $this->appendChild($this->ownerDocument->createElement('br'));
877 public function appendEntity($name) {
878 return $this->appendChild($this->ownerDocument->createEntityReference($name));
880 public function appendComment($comment_data) {
881 return $this->appendChild($this->ownerDocument->createComment($comment_data));
883 public function appendHTMLMarkup($htmldata) {
884 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
886 public function appendXMLMarkup($xmldata) {
887 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
889 public function appendJSElement($jsdata) {
890 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
892 public function appendJSFile($jsdata, $defer = false, $async = false) {
893 return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async));
895 public function setClass($classname) {
896 $this->setAttribute('class', $classname);
898 public function addClass($classname) {
899 $classval = $this->getAttribute('class');
900 if (strlen($classval)) { $classval .= ' '; }
901 $classval .= $classname;
902 $this->setClass($classval);
905 public function setID($elem_id) {
906 $this->setAttribute('id', $elem_id);
910 class ExtendedDocumentFragment extends DOMDocumentFragment {
911 // ExtendedDocumentFragment PHP class
912 // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
914 // public function appendElement($name, [$value])
915 // appends a DOMDocument::createElement() as a child of this fragment (see there for params)
916 // returns the new child
918 // public function appendElementXML($name, $xmldata)
919 // appends a DOMDocument::createElement() with the given name as a child of this fragment,
920 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
921 // returns the new child
923 // public function appendLink($target, [$value], [$title])
924 // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
925 // returns the new child
927 // public function appendImage($src, [$alt_text])
928 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
929 // returns the new child
931 // public function appendForm($action, $method, $name, [$id])
932 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
933 // returns the new child
935 // public function appendFormDiv($action, $method, $name, [$id])
936 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
937 // returns an HTML <div> that is a child of the new child
939 // public function appendInputHidden($name, $value)
940 // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
941 // returns the new child
943 // public function appendInputText($name, $maxlength, $size, [$id], [$value])
944 // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
945 // returns the new child
947 // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
948 // appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
949 // returns the new child
951 // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
952 // appends an ExtendedDocument::createElementInputNumber() as a child of this fragment (see there for params)
953 // returns the new child
955 // public function appendInputRange($name, $id, $min, $max, [$step], [$value])
956 // appends an ExtendedDocument::createElementInputRange() as a child of this fragment (see there for params)
957 // returns the new child
959 // public function appendInputUrl($name, $maxlength, $size, [$id], [$value])
960 // appends an ExtendedDocument::createElementInputUrl() as a child of this fragment (see there for params)
961 // returns the new child
963 // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
964 // appends an ExtendedDocument::createElementInputEmail() as a child of this fragment (see there for params)
965 // returns the new child
967 // public function appendInputTel($name, $maxlength, $size, [$id], [$value])
968 // appends an ExtendedDocument::createElementInputTel() as a child of this fragment (see there for params)
969 // returns the new child
971 // public function appendInputDate($name, [$id], [$min], [$max], [$value])
972 // appends an ExtendedDocument::createElementInputDate() as a child of this fragment (see there for params)
973 // returns the new child
975 // public function appendInputTime($name, [$id], [$min], [$max], [$value])
976 // appends an ExtendedDocument::createElementInputTime() as a child of this fragment (see there for params)
977 // returns the new child
979 // public function appendInputColor($name, [$id], [$value])
980 // appends an ExtendedDocument::createElementInputColor() as a child of this fragment (see there for params)
982 // public function appendInputRadio($name, $id, $value, $checked)
983 // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
984 // returns the new child
986 // public function appendInputCheckbox($name, $id, $value, $checked)
987 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
988 // returns the new child
990 // public function appendInputFile($name, $id, $accept)
991 // appends an ExtendedDocument::createElementInputFile() as a child of this fragment (see there for params)
992 // returns the new child
994 // public function appendInputSubmit($value)
995 // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
996 // returns the new child
998 // public function appendButton($value, $onclick = null)
999 // appends an ExtendedDocument::createElementButton() as a child of this fragment (see there for params)
1000 // returns the new child
1002 // public function appendTextArea($name, $columns, $rows, [$id], [$value])
1003 // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
1004 // returns the new child
1006 // public function appendElementSelect($name, [$id], [$options], [$default], [$strictmatch])
1007 // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
1008 // returns the new child
1010 // public function appendElementOption($key, $desc, [$selected])
1011 // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
1012 // returns the new child
1014 // public function appendLabel($for_id, $value)
1015 // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
1016 // returns the new child
1018 // public function appendText($text)
1019 // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
1020 // returns the new child
1022 // public function appendLinebreak()
1023 // appends a <br> as a child of this fragment
1024 // returns the new child
1026 // public function appendEntity($name)
1027 // appends a DOMDocument::createEntityReference() as a child of this fragment (see there for params)
1028 // returns the new child
1030 // public function appendComment($comment_data)
1031 // appends a DOMDocument::createComment() as a child of this fragment (see there for params)
1032 // returns the new child
1034 // public function appendHTMLMarkup($htmldata)
1035 // appends a representation of the HTML data as children of this fragment
1038 // public function appendXMLMarkup($xmldata)
1039 // appends a representation of the XML data as children of this fragment
1042 // public function appendJSElement($jsdata)
1043 // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
1046 // public function appendJSFile($jsURL, [$defer], [$async])
1047 // appends an ExtendedDocument::createElementJSFile() as a child of this fragment (see there for params)
1048 // returns the new child
1050 public function appendElement($name, $value = '') {
1051 return $this->appendChild($this->ownerDocument->createElement($name, $value));
1053 public function appendElementXML($name, $xmldata) {
1054 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
1055 $aelem->appendXMLMarkup($xmldata);
1058 public function appendLink($target, $value = '', $title = null) {
1059 return $this->appendChild($this->ownerDocument->createElementLink($target, $value, $title));
1061 public function appendImage($src, $alt_text = '') {
1062 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
1064 public function appendForm($action, $method, $name, $id = null) {
1065 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
1067 public function appendFormDiv($action, $method, $name, $id = null) {
1068 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
1069 return $formelem->appendElement('div');
1071 public function appendInputHidden($name, $value) {
1072 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
1074 public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
1075 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
1077 public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
1078 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
1080 public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
1081 return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
1083 public function appendInputRange($name, $id, $min, $max, $step = null, $value = null) {
1084 return $this->appendChild($this->ownerDocument->createElementInputRange($name, $id, $min, $max, $step, $value));
1086 public function appendInputUrl($name, $maxlength, $size, $id = null, $value = null) {
1087 return $this->appendChild($this->ownerDocument->createElementInputUrl($name, $maxlength, $size, $id, $value));
1089 public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
1090 return $this->appendChild($this->ownerDocument->createElementInputEmail($name, $maxlength, $size, $id, $value));
1092 public function appendInputTel($name, $maxlength, $size, $id = null, $value = null) {
1093 return $this->appendChild($this->ownerDocument->createElementInputTel($name, $maxlength, $size, $id, $value));
1095 public function appendInputDate($name, $id = null, $min = null, $max = null, $value = null) {
1096 return $this->appendChild($this->ownerDocument->createElementInputDate($name, $id, $min, $max, $value));
1098 public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
1099 return $this->appendChild($this->ownerDocument->createElementInputTime($name, $id, $min, $max, $value));
1101 public function appendInputColor($name, $id = null, $value = null) {
1102 return $this->appendChild($this->ownerDocument->createElementInputColor($name, $id, $value));
1104 public function appendInputRadio($name, $id, $value, $checked) {
1105 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
1107 public function appendInputCheckbox($name, $id, $value, $checked) {
1108 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
1110 public function appendInputFile($name, $id, $accept) {
1111 return $this->appendChild($this->ownerDocument->createElementInputFile($name, $id, $accept));
1113 public function appendInputSubmit($value) {
1114 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
1116 public function appendButton($value, $onclick = null) {
1117 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
1119 public function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
1120 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
1122 public function appendElementSelect($name, $id = null, $options = array(), $default = null, $strictmatch = false) {
1123 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default, $strictmatch));
1125 public function appendElementOption($key, $desc, $selected = false) {
1126 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
1128 public function appendLabel($for_id, $value) {
1129 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
1131 public function appendText($text) {
1132 return $this->appendChild($this->ownerDocument->createTextNode($text));
1134 public function appendLinebreak() {
1135 return $this->appendChild($this->ownerDocument->createElement('br'));
1137 public function appendEntity($name) {
1138 return $this->appendChild($this->ownerDocument->createEntityReference($name));
1140 public function appendComment($comment_data) {
1141 return $this->appendChild($this->ownerDocument->createComment($comment_data));
1143 public function appendHTMLMarkup($htmldata) {
1144 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
1146 public function appendXMLMarkup($xmldata) {
1147 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
1149 public function appendJSElement($jsdata) {
1150 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
1152 public function appendJSFile($jsdata, $defer = false, $async = false) {
1153 return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async));