small fixes: HTML5 charset, deprecated curly brackets, argument names
[php-utility-classes.git] / classes / document.php-class
index f266fb073b022b3fdbcb3ae16edd5d4277fced4d..d3dca7d7e66553df777c4160ab97b633f685553a 100755 (executable)
@@ -25,7 +25,7 @@ class ExtendedDocument extends DOMDocument {
   //   with an ExtendedDocument::createXMLFragment() of the given XML data inside
   //     returns the new child
   //
-  // public function appendLink($target, [$value])
+  // public function appendLink($target, [$value], [$title])
   //   appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
   //     returns the new child
   //
@@ -49,16 +49,40 @@ class ExtendedDocument extends DOMDocument {
   //   appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
   //     returns the new child
   //
+  // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
+  //     returns the new child
+  //
   // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
   //   appends an ExtendedDocument::createElementInputNumber() as a child of this document (see there for params)
   //     returns the new child
   //
+  // public function appendInputRange($name, $id, $min, $max, [$step], [$value])
+  //   appends an ExtendedDocument::createElementInputRange() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputUrl($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputUrl() as a child of this document (see there for params)
+  //     returns the new child
+  //
   // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
   //   appends an ExtendedDocument::createElementInputEmail() as a child of this document (see there for params)
   //     returns the new child
   //
-  // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
-  //   appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
+  // public function appendInputTel($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputTel() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputDate($name, [$id], [$min], [$max], [$value])
+  //   appends an ExtendedDocument::createElementInputDate() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputTime($name, [$id], [$min], [$max], [$value])
+  //   appends an ExtendedDocument::createElementInputTime() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputColor($name, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputColor() as a child of this document (see there for params)
   //     returns the new child
   //
   // public function appendInputRadio($name, $id, $value, $checked)
@@ -101,6 +125,10 @@ class ExtendedDocument extends DOMDocument {
   //   appends a DOMDocument::createTextNode() as a child of this document (see there for params)
   //     returns the new child
   //
+  // public function appendLinebreak()
+  //   appends a <br> as a child of this document
+  //     returns the new child
+  //
   // public function appendEntity($name)
   //   appends a DOMDocument::createEntityReference() as a child of this document (see there for params)
   //     returns the new child
@@ -109,6 +137,11 @@ class ExtendedDocument extends DOMDocument {
   //   appends a DOMDocument::createComment() as a child of this document (see there for params)
   //     returns the new child
   //
+  // public function appendClonedElement($dom_element, [$deep])
+  //   appends a clone of the given DOMElement as a child of this document
+  //     the boolean $deep specifies if the children are cloned as well (defaults to TRUE)
+  //     returns the new child
+  //
   // public function appendHTMLMarkup($htmldata, [$parentNode])
   //   appends a representation of the HTML data as children of the given parent node, by default this document
   //     NO return value!
@@ -125,11 +158,11 @@ class ExtendedDocument extends DOMDocument {
   //   appends an ExtendedDocument::createElementJSFile() as a child of this document (see there for params)
   //     returns the new child
   //
-  // public function createElementLink($target, [$value])
-  //   returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
+  // public function createElementLink($target, [$value], [$title])
+  //   returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value as well as (optional) title attribute
   //
   // public function createElementImage($src, [$alt_text])
-  //   returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
+  //   returns an ExtendedElement that is an HTML <img> with the given src and alt attributes (set to '' by default)
   //
   // public function createElementForm($action, $method, $name)
   //   returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
@@ -142,16 +175,40 @@ class ExtendedDocument extends DOMDocument {
   //   returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
   //   and optionally id and value
   //
+  // public function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
+  //   and optionally id and value
+  //
   // public function createElementInputNumber($name, $maxlength, $size, [$id], [$value])
   //   returns an ExtendedElement that is an HTML <input> of type 'number' with the given name, maxlength, size,
   //   and optionally id and value
   //
+  // public function createElementInputRange($name, $id, $min, $max, [$step], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'range' with the given name, id, min, max,
+  //   and optionally step and value
+  //
+  // public function createElementInputUrl($name, $maxlength, $size, [$id], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'url' with the given name, maxlength, size,
+  //   and optionally id and value
+  //
   // public function createElementInputEmail($name, $maxlength, $size, [$id], [$value])
   //   returns an ExtendedElement that is an HTML <input> of type 'email' with the given name, maxlength, size,
   //   and optionally id and value
   //
-  // public function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
-  //   returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
+  // public function createElementInputTel($name, $maxlength, $size, [$id], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'tel' with the given name, maxlength, size,
+  //   and optionally id and value
+  //
+  // public function createElementInputDate($name, [$id], [$min], [$max], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'date' with the given name,
+  //   and optionally id, min, max, and value
+  //
+  // public function createElementInputTime($name, [$id], [$min], [$max], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'time' with the given name,
+  //   and optionally id, min, max, and value
+  //
+  // public function createElementInputColor($name, [$id], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'color' with the given name,
   //   and optionally id and value
   //
   // public function createElementInputRadio($name, $id, $value, $checked)
@@ -202,7 +259,7 @@ class ExtendedDocument extends DOMDocument {
 
   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.
+    $doc->loadHTML('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html><html></html>'); // this seems to be the only way to get the DOCTYPE set properly.
 
     // Created basic HTML document structure.
     $root = $doc->getElementsByTagName('html')->item(0);
@@ -226,8 +283,8 @@ class ExtendedDocument extends DOMDocument {
     //$aelem->appendChild($this->createXMLFragment($xmldata));
     return $aelem;
   }
-  public function appendLink($target, $value = '') {
-    return $this->appendChild($this->createElementLink($target, $value));
+  public function appendLink($target, $value = '', $title = null) {
+    return $this->appendChild($this->createElementLink($target, $value, $title));
   }
   public function appendImage($src, $alt_text = '') {
     return $this->appendChild($this->createElementImage($src, $alt_text));
@@ -245,14 +302,32 @@ class ExtendedDocument extends DOMDocument {
   public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
   }
+  public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  }
   public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->createElementInputNumber($name, $maxlength, $size, $id, $value));
   }
+  public function appendInputRange($name, $id, $min, $max, $step = null, $value = null) {
+    return $this->appendChild($this->createElementInputRange($name, $id, $min, $max, $step, $value));
+  }
+  public function appendInputUrl($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->createElementInputUrl($name, $maxlength, $size, $id, $value));
+  }
   public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->createElementInputEmail($name, $maxlength, $size, $id, $value));
   }
-  public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
-    return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  public function appendInputTel($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->createElementInputTel($name, $maxlength, $size, $id, $value));
+  }
+  public function appendInputDate($name, $id = null, $min = null, $max = null, $value = null) {
+    return $this->appendChild($this->createElementInputDate($name, $id, $min, $max, $value));
+  }
+  public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
+    return $this->appendChild($this->createElementInputTime($name, $id, $min, $max, $value));
+  }
+  public function appendInputColor($name, $id = null, $value = null) {
+    return $this->appendChild($this->createElementInputColor($name, $id, $value));
   }
   public function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
@@ -284,17 +359,23 @@ class ExtendedDocument extends DOMDocument {
   public function appendText($text) {
     return $this->appendChild($this->createTextNode($text));
   }
+  public function appendLinebreak() {
+    return $this->appendChild($this->createElement('br'));
+  }
   public function appendEntity($name) {
     return $this->appendChild($this->createEntityReference($name));
   }
   public function appendComment($comment_data) {
     return $this->appendChild($this->createComment($comment_data));
   }
+  public function appendClonedElement($dom_element, $deep = true) {
+    return $this->appendChild($dom_element->cloneNode($deep));
+  }
   public function appendJSElement($jsdata) {
-    $this->appendChild($this->createElementJS($jsdata));
+    return $this->appendChild($this->createElementJS($jsdata));
   }
-  public function appendJSFile($jsdata, $defer = false, $async = false) {
-    return $this->appendChild($this->createElementJSFile($jsdata, $defer, $async));
+  public function appendJSFile($jsURL, $defer = false, $async = false) {
+    return $this->appendChild($this->createElementJSFile($jsURL, $defer, $async));
   }
 
   public function appendHTMLMarkup($htmldata, $parentNode = null) {
@@ -323,13 +404,14 @@ class ExtendedDocument extends DOMDocument {
   public function createElement($name, $value = '') {
     // Adding the $value in DOMDocument's createElement does NOT escape it, so override it and use appendText to support that.
     $aelem = parent::createElement($name);
-    $aelem->appendText($value);
+    if (strlen($value)) { $aelem->appendText($value); }
     return $aelem;
   }
 
-  public function createElementLink($target, $value = '') {
+  public function createElementLink($target, $value = '', $title = null) {
     $link = $this->createElement('a', $value);
     $link->setAttribute('href', $target); // XXX: take care of & etc. in links
+    if (!is_null($title)) { $link->setAttribute('title', $title); }
     return $link;
   }
 
@@ -345,7 +427,7 @@ class ExtendedDocument extends DOMDocument {
     $formelem->setAttribute('action', $action);
     $formelem->setAttribute('method', $method);
     $formelem->setAttribute('name', $name);
-    $formelem->setAttribute('id', $id);
+    if (!is_null($id)) { $formelem->setAttribute('id', $id); }
     return $formelem;
   }
 
@@ -368,28 +450,6 @@ class ExtendedDocument extends DOMDocument {
     return $txfield;
   }
 
-  public function createElementInputNumber($name, $maxlength, $size, $id = null, $value = null) {
-    $txfield = $this->createElement('input');
-    $txfield->setAttribute('type', 'number');
-    if (!is_null($id)) { $txfield->setAttribute('id', $id); }
-    $txfield->setAttribute('name', $name);
-    $txfield->setAttribute('maxlength', $maxlength);
-    $txfield->setAttribute('size', $size);
-    if (!is_null($value)) { $txfield->setAttribute('value', $value); }
-    return $txfield;
-  }
-
-  public function createElementInputEmail($name, $maxlength, $size, $id = null, $value = null) {
-    $txfield = $this->createElement('input');
-    $txfield->setAttribute('type', 'email');
-    if (!is_null($id)) { $txfield->setAttribute('id', $id); }
-    $txfield->setAttribute('name', $name);
-    $txfield->setAttribute('maxlength', $maxlength);
-    $txfield->setAttribute('size', $size);
-    if (!is_null($value)) { $txfield->setAttribute('value', $value); }
-    return $txfield;
-  }
-
   public function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
     $pwfield = $this->createElement('input');
     $pwfield->setAttribute('type', 'password');
@@ -401,6 +461,91 @@ class ExtendedDocument extends DOMDocument {
     return $pwfield;
   }
 
+  public function createElementInputNumber($name, $maxlength, $size, $id = null, $value = null) {
+    $numfield = $this->createElement('input');
+    $numfield->setAttribute('type', 'number');
+    if (!is_null($id)) { $numfield->setAttribute('id', $id); }
+    $numfield->setAttribute('name', $name);
+    $numfield->setAttribute('maxlength', $maxlength);
+    $numfield->setAttribute('size', $size);
+    if (!is_null($value)) { $numfield->setAttribute('value', $value); }
+    return $numfield;
+  }
+
+  public function createElementInputRange($name, $id, $min, $max, $step = null, $value = null) {
+    $rgfield = $this->createElement('input');
+    $rgfield->setAttribute('type', 'range');
+    if (!is_null($id)) { $rgfield->setAttribute('id', $id); }
+    $rgfield->setAttribute('name', $name);
+    if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
+    if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
+    if (!is_null($step)) { $rgfield->setAttribute('step', $step); }
+    if (!is_null($value)) { $rgfield->setAttribute('value', $value); }
+    return $rgfield;
+  }
+
+  public function createElementInputUrl($name, $maxlength, $size, $id = null, $value = null) {
+    $urlfield = $this->createElement('input');
+    $urlfield->setAttribute('type', 'url');
+    if (!is_null($id)) { $urlfield->setAttribute('id', $id); }
+    $urlfield->setAttribute('name', $name);
+    $urlfield->setAttribute('maxlength', $maxlength);
+    $urlfield->setAttribute('size', $size);
+    if (!is_null($value)) { $urlfield->setAttribute('value', $value); }
+    return $urlfield;
+  }
+
+  public function createElementInputEmail($name, $maxlength, $size, $id = null, $value = null) {
+    $mailfield = $this->createElement('input');
+    $mailfield->setAttribute('type', 'email');
+    if (!is_null($id)) { $mailfield->setAttribute('id', $id); }
+    $mailfield->setAttribute('name', $name);
+    $mailfield->setAttribute('maxlength', $maxlength);
+    $mailfield->setAttribute('size', $size);
+    if (!is_null($value)) { $mailfield->setAttribute('value', $value); }
+    return $mailfield;
+  }
+
+  public function createElementInputTel($name, $maxlength, $size, $id = null, $value = null) {
+    $telfield = $this->createElement('input');
+    $telfield->setAttribute('type', 'tel');
+    if (!is_null($id)) { $telfield->setAttribute('id', $id); }
+    $telfield->setAttribute('name', $name);
+    $telfield->setAttribute('maxlength', $maxlength);
+    $telfield->setAttribute('size', $size);
+    if (!is_null($value)) { $telfield->setAttribute('value', $value); }
+    return $telfield;
+  }
+
+  public function createElementInputDate($name, $id = null, $min = null, $max = null, $value = null) {
+    $telfield = $this->createElement('input');
+    $telfield->setAttribute('type', 'date');
+    if (!is_null($id)) { $telfield->setAttribute('id', $id); }
+    if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
+    if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
+    if (!is_null($value)) { $telfield->setAttribute('value', $value); }
+    return $telfield;
+  }
+
+  public function createElementInputTime($name, $id = null, $min = null, $max = null, $value = null) {
+    $telfield = $this->createElement('input');
+    $telfield->setAttribute('type', 'time');
+    if (!is_null($id)) { $telfield->setAttribute('id', $id); }
+    if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
+    if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
+    if (!is_null($value)) { $telfield->setAttribute('value', $value); }
+    return $telfield;
+  }
+
+  public function createElementInputColor($name, $id = null, $value = null) {
+    $colfield = $this->createElement('input');
+    $colfield->setAttribute('type', 'color');
+    if (!is_null($id)) { $colfield->setAttribute('id', $id); }
+    $colfield->setAttribute('name', $name);
+    if (!is_null($value)) { $colfield->setAttribute('value', $value); }
+    return $colfield;
+  }
+
   public function createElementInputRadio($name, $id, $value, $checked) {
     $radio = $this->createElement('input');
     $radio->setAttribute('type', 'radio');
@@ -513,7 +658,7 @@ class ExtendedElement extends DOMElement {
   //   with an ExtendedDocument::createXMLFragment() of the given XML data inside
   //     returns the new child
   //
-  // public function appendLink($target, [$value])
+  // public function appendLink($target, [$value], [$title])
   //   appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
   //     returns the new child
   //
@@ -537,18 +682,41 @@ class ExtendedElement extends DOMElement {
   //   appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
   //     returns the new child
   //
+  // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
+  //     returns the new child
+  //
   // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
   //   appends an ExtendedDocument::createElementInputNumber() as a child of this element (see there for params)
   //     returns the new child
   //
+  // public function appendInputRange($name, $id, $min, $max, [$step], [$value])
+  //   appends an ExtendedDocument::createElementInputRange() as a child of this element (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputUrl($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputUrl() as a child of this element (see there for params)
+  //     returns the new child
+  //
   // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
   //   appends an ExtendedDocument::createElementInputEmail() as a child of this element (see there for params)
   //     returns the new child
   //
-  // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
-  //   appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
+  // public function appendInputTel($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputTel() as a child of this element (see there for params)
   //     returns the new child
   //
+  // public function appendInputDate($name, [$id], [$min], [$max], [$value])
+  //   appends an ExtendedDocument::createElementInputDate() as a child of this element (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputTime($name, [$id], [$min], [$max], [$value])
+  //   appends an ExtendedDocument::createElementInputTime() as a child of this element (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputColor($name, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputColor() as a child of this element (see there for params)
+  //
   // public function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
   //     returns the new child
@@ -589,6 +757,10 @@ class ExtendedElement extends DOMElement {
   //   appends a DOMDocument::createTextNode() as a child of this element (see there for params)
   //     returns the new child
   //
+  // public function appendLinebreak()
+  //   appends a <br> as a child of this element
+  //     returns the new child
+  //
   // public function appendEntity($name)
   //   appends a DOMDocument::createEntityReference() as a child of this element (see there for params)
   //     returns the new child
@@ -597,6 +769,11 @@ class ExtendedElement extends DOMElement {
   //   appends a DOMDocument::createComment() as a child of this element (see there for params)
   //     returns the new child
   //
+  // public function appendClonedElement($dom_element, [$deep])
+  //   appends a clone of the given DOMElement as a child of this element
+  //     the boolean $deep specifies if the children are cloned as well (defaults to TRUE)
+  //     returns the new child
+  //
   // public function appendHTMLMarkup($htmldata)
   //   appends a representation of the HTML data as children of this element
   //     NO return value!
@@ -607,11 +784,21 @@ class ExtendedElement extends DOMElement {
   //
   // public function appendJSElement($jsdata)
   //   appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
-  //     NO return value!
+  //     returns the new child
   //
   // public function appendJSFile($jsURL, [$defer], [$async])
   //   appends an ExtendedDocument::createElementJSFile() as a child of this element (see there for params)
   //     returns the new child
+  //
+  // public function setClass($classname)
+  //   sets the 'class' attribute of the element to the given classname value
+  //
+  // public function addClass($classname)
+  //   adds the given classname value to the space-separated list in the 'class' attribute
+  //     returns the value of the 'class' attribute
+  //
+  // public function setID($elem_id)
+  //   sets the 'id' attribute of the element to the given elem_id value
 
   public function appendElement($name, $value = '') {
     return $this->appendChild($this->ownerDocument->createElement($name, $value));
@@ -621,8 +808,8 @@ class ExtendedElement extends DOMElement {
     $aelem->appendXMLMarkup($xmldata);
     return $aelem;
   }
-  public function appendLink($target, $value = '') {
-    return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
+  public function appendLink($target, $value = '', $title = null) {
+    return $this->appendChild($this->ownerDocument->createElementLink($target, $value, $title));
   }
   public function appendImage($src, $alt_text = '') {
     return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
@@ -640,14 +827,32 @@ class ExtendedElement extends DOMElement {
   public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
   }
+  public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  }
   public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
   }
+  public function appendInputRange($name, $id, $min, $max, $step = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputRange($name, $id, $min, $max, $step, $value));
+  }
+  public function appendInputUrl($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputUrl($name, $maxlength, $size, $id, $value));
+  }
   public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputEmail($name, $maxlength, $size, $id, $value));
   }
-  public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
-    return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  public function appendInputTel($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputTel($name, $maxlength, $size, $id, $value));
+  }
+  public function appendInputDate($name, $id = null, $min = null, $max = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputDate($name, $id, $min, $max, $value));
+  }
+  public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputTime($name, $id, $min, $max, $value));
+  }
+  public function appendInputColor($name, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputColor($name, $id, $value));
   }
   public function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
@@ -679,12 +884,18 @@ class ExtendedElement extends DOMElement {
   public function appendText($text) {
     return $this->appendChild($this->ownerDocument->createTextNode($text));
   }
+  public function appendLinebreak() {
+    return $this->appendChild($this->ownerDocument->createElement('br'));
+  }
   public function appendEntity($name) {
     return $this->appendChild($this->ownerDocument->createEntityReference($name));
   }
   public function appendComment($comment_data) {
     return $this->appendChild($this->ownerDocument->createComment($comment_data));
   }
+  public function appendClonedElement($dom_element, $deep = true) {
+    return $this->appendChild($dom_element->cloneNode($deep));
+  }
   public function appendHTMLMarkup($htmldata) {
     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
   }
@@ -692,10 +903,23 @@ class ExtendedElement extends DOMElement {
     $this->ownerDocument->appendXMLMarkup($xmldata, $this);
   }
   public function appendJSElement($jsdata) {
-    $this->appendChild($this->ownerDocument->createElementJS($jsdata));
+    return $this->appendChild($this->ownerDocument->createElementJS($jsdata));
+  }
+  public function appendJSFile($jsURL, $defer = false, $async = false) {
+    return $this->appendChild($this->ownerDocument->createElementJSFile($jsURL, $defer, $async));
+  }
+  public function setClass($classname) {
+    $this->setAttribute('class', $classname);
+  }
+  public function addClass($classname) {
+    $classval = $this->getAttribute('class');
+    if (strlen($classval)) { $classval .= ' '; }
+    $classval .= $classname;
+    $this->setClass($classval);
+    return $classval;
   }
-  public function appendJSFile($jsdata, $defer = false, $async = false) {
-    return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async));
+  public function setID($elem_id) {
+    $this->setAttribute('id', $elem_id);
   }
 }
 
@@ -712,7 +936,7 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   with an ExtendedDocument::createXMLFragment() of the given XML data inside
   //     returns the new child
   //
-  // public function appendLink($target, [$value])
+  // public function appendLink($target, [$value], [$title])
   //   appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
   //     returns the new child
   //
@@ -736,18 +960,41 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
   // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
   //   appends an ExtendedDocument::createElementInputNumber() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // public function appendInputRange($name, $id, $min, $max, [$step], [$value])
+  //   appends an ExtendedDocument::createElementInputRange() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputUrl($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputUrl() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
   // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
   //   appends an ExtendedDocument::createElementInputEmail() as a child of this fragment (see there for params)
   //     returns the new child
   //
-  // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
-  //   appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
+  // public function appendInputTel($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputTel() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputDate($name, [$id], [$min], [$max], [$value])
+  //   appends an ExtendedDocument::createElementInputDate() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
+  // public function appendInputTime($name, [$id], [$min], [$max], [$value])
+  //   appends an ExtendedDocument::createElementInputTime() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // public function appendInputColor($name, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputColor() as a child of this fragment (see there for params)
+  //
   // public function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
   //     returns the new child
@@ -788,6 +1035,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // public function appendLinebreak()
+  //   appends a <br> as a child of this fragment
+  //     returns the new child
+  //
   // public function appendEntity($name)
   //   appends a DOMDocument::createEntityReference() as a child of this fragment (see there for params)
   //     returns the new child
@@ -796,6 +1047,11 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends a DOMDocument::createComment() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // public function appendClonedElement($dom_element, [$deep])
+  //   appends a clone of the given DOMElement as a child of this fragment
+  //     the boolean $deep specifies if the children are cloned as well (defaults to TRUE)
+  //     returns the new child
+  //
   // public function appendHTMLMarkup($htmldata)
   //   appends a representation of the HTML data as children of this fragment
   //     NO return value!
@@ -806,7 +1062,7 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //
   // public function appendJSElement($jsdata)
   //   appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
-  //     NO return value!
+  //     returns the new child
   //
   // public function appendJSFile($jsURL, [$defer], [$async])
   //   appends an ExtendedDocument::createElementJSFile() as a child of this fragment (see there for params)
@@ -820,8 +1076,8 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
     $aelem->appendXMLMarkup($xmldata);
     return $aelem;
   }
-  public function appendLink($target, $value = '') {
-    return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
+  public function appendLink($target, $value = '', $title = null) {
+    return $this->appendChild($this->ownerDocument->createElementLink($target, $value, $title));
   }
   public function appendImage($src, $alt_text = '') {
     return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
@@ -839,14 +1095,32 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
   }
+  public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  }
   public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
   }
+  public function appendInputRange($name, $id, $min, $max, $step = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputRange($name, $id, $min, $max, $step, $value));
+  }
+  public function appendInputUrl($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputUrl($name, $maxlength, $size, $id, $value));
+  }
   public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputEmail($name, $maxlength, $size, $id, $value));
   }
-  public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
-    return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  public function appendInputTel($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputTel($name, $maxlength, $size, $id, $value));
+  }
+  public function appendInputDate($name, $id = null, $min = null, $max = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputDate($name, $id, $min, $max, $value));
+  }
+  public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputTime($name, $id, $min, $max, $value));
+  }
+  public function appendInputColor($name, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputColor($name, $id, $value));
   }
   public function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
@@ -878,12 +1152,18 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   public function appendText($text) {
     return $this->appendChild($this->ownerDocument->createTextNode($text));
   }
+  public function appendLinebreak() {
+    return $this->appendChild($this->ownerDocument->createElement('br'));
+  }
   public function appendEntity($name) {
     return $this->appendChild($this->ownerDocument->createEntityReference($name));
   }
   public function appendComment($comment_data) {
     return $this->appendChild($this->ownerDocument->createComment($comment_data));
   }
+  public function appendClonedElement($dom_element, $deep = true) {
+    return $this->appendChild($dom_element->cloneNode($deep));
+  }
   public function appendHTMLMarkup($htmldata) {
     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
   }
@@ -891,10 +1171,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
     $this->ownerDocument->appendXMLMarkup($xmldata, $this);
   }
   public function appendJSElement($jsdata) {
-    $this->appendChild($this->ownerDocument->createElementJS($jsdata));
+    return $this->appendChild($this->ownerDocument->createElementJS($jsdata));
   }
-  public function appendJSFile($jsdata, $defer = false, $async = false) {
-    return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async));
+  public function appendJSFile($jsURL, $defer = false, $async = false) {
+    return $this->appendChild($this->ownerDocument->createElementJSFile($jsURL, $defer, $async));
   }
 }
 ?>