projects
/
php-utility-classes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
34bf691
)
add functions to add a style element (should only be needed inside <head>)
author
Robert Kaiser
<kairo@kairo.at>
Thu, 12 Mar 2020 00:39:04 +0000
(
01:39
+0100)
committer
Robert Kaiser
<kairo@kairo.at>
Thu, 12 Mar 2020 00:39:04 +0000
(
01:39
+0100)
classes/document.php-class
patch
|
blob
|
blame
|
history
diff --git
a/classes/document.php-class
b/classes/document.php-class
index d3dca7d7e66553df777c4160ab97b633f685553a..1933808002202d86d315fc2a553eedfb3d60122a 100755
(executable)
--- a/
classes/document.php-class
+++ b/
classes/document.php-class
@@
-150,9
+150,13
@@
class ExtendedDocument extends DOMDocument {
// appends a representation of the XML data as children of the given parent node, by default this document
// NO return value!
//
// appends a representation of the XML data as children of the given parent node, by default this document
// NO return value!
//
+ // public function appendStyleElement($styledata)
+ // appends an ExtendedDocument::createElementStyle() as a child of this document (see there for params)
+ // returns the new child
+ //
// public function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
// public function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this document (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 document (see there for params)
//
// public function appendJSFile($jsURL, [$defer], [$async])
// appends an ExtendedDocument::createElementJSFile() as a child of this document (see there for params)
@@
-243,6
+247,9
@@
class ExtendedDocument extends DOMDocument {
// public function createElementLabel($for_id, $value)
// returns an ExtendedElement that is an HTML <label> with the given 'for' and value
//
// public function createElementLabel($for_id, $value)
// returns an ExtendedElement that is an HTML <label> with the given 'for' and value
//
+ // public function createElementStyle($styledata)
+ // returns an ExtendedElement that is an HTML <style> of CSS type with the style data inside
+ //
// public function createElementJS($jsdata)
// returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
//
// public function createElementJS($jsdata)
// returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
//
@@
-371,6
+378,9
@@
class ExtendedDocument extends DOMDocument {
public function appendClonedElement($dom_element, $deep = true) {
return $this->appendChild($dom_element->cloneNode($deep));
}
public function appendClonedElement($dom_element, $deep = true) {
return $this->appendChild($dom_element->cloneNode($deep));
}
+ public function appendStyleElement($styledata) {
+ return $this->appendChild($this->createElementStyle($styledata));
+ }
public function appendJSElement($jsdata) {
return $this->appendChild($this->createElementJS($jsdata));
}
public function appendJSElement($jsdata) {
return $this->appendChild($this->createElementJS($jsdata));
}
@@
-622,6
+632,14
@@
class ExtendedDocument extends DOMDocument {
return $label;
}
return $label;
}
+ public function createElementStyle($styledata) {
+ $style_elem = $this->createElement('style');
+ // Note: type can/should be left out for HTML5.
+ $style_elem->setAttribute('type', 'text/css');
+ $style_elem->appendChild($this->createCDATASection($styledata));
+ return $style_elem;
+ }
+
public function createElementJS($jsdata) {
$jselem = $this->createElement('script');
// Note: type can/should be left out for HTML5.
public function createElementJS($jsdata) {
$jselem = $this->createElement('script');
// Note: type can/should be left out for HTML5.
@@
-782,6
+800,10
@@
class ExtendedElement extends DOMElement {
// appends a representation of the XML data as children of this element
// NO return value!
//
// appends a representation of the XML data as children of this element
// NO return value!
//
+ // public function appendStyleElement($styledata)
+ // appends an ExtendedDocument::createElementStyle() as a child of this element (see there for params)
+ // returns the new child
+ //
// public function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
// returns the new child
// public function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
// returns the new child
@@
-902,6
+924,9
@@
class ExtendedElement extends DOMElement {
public function appendXMLMarkup($xmldata) {
$this->ownerDocument->appendXMLMarkup($xmldata, $this);
}
public function appendXMLMarkup($xmldata) {
$this->ownerDocument->appendXMLMarkup($xmldata, $this);
}
+ public function appendStyleElement($styledata) {
+ return $this->appendChild($this->ownerDocument->createElementStyle($styledata));
+ }
public function appendJSElement($jsdata) {
return $this->appendChild($this->ownerDocument->createElementJS($jsdata));
}
public function appendJSElement($jsdata) {
return $this->appendChild($this->ownerDocument->createElementJS($jsdata));
}
@@
-1060,6
+1085,10
@@
class ExtendedDocumentFragment extends DOMDocumentFragment {
// appends a representation of the XML data as children of this fragment
// NO return value!
//
// appends a representation of the XML data as children of this fragment
// NO return value!
//
+ // public function appendStyleElement($styledata)
+ // appends an ExtendedDocument::createElementStyle() as a child of this element (see there for params)
+ // returns the new child
+ //
// public function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
// returns the new child
// public function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
// returns the new child
@@
-1170,6
+1199,9
@@
class ExtendedDocumentFragment extends DOMDocumentFragment {
public function appendXMLMarkup($xmldata) {
$this->ownerDocument->appendXMLMarkup($xmldata, $this);
}
public function appendXMLMarkup($xmldata) {
$this->ownerDocument->appendXMLMarkup($xmldata, $this);
}
+ public function appendStyleElement($styledata) {
+ return $this->appendChild($this->ownerDocument->createElementStyle($styledata));
+ }
public function appendJSElement($jsdata) {
return $this->appendChild($this->ownerDocument->createElementJS($jsdata));
}
public function appendJSElement($jsdata) {
return $this->appendChild($this->ownerDocument->createElementJS($jsdata));
}