DOM 2 util.
More...
DOM 2 util.
- Author
- Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
- Version
- $Id$ /
Definition at line 11 of file class.ilDOM2Util.php.
◆ addParent()
static ilDOM2Util::addParent |
( |
|
$node, |
|
|
|
$name |
|
) |
| |
|
static |
Add parent.
- Parameters
-
- Returns
Definition at line 47 of file class.ilDOM2Util.php.
48 {
49 $newnode = $node->ownerDocument->createElement($name);
50
51
52 $par = $node->parentNode;
53
54
55 if ($next_sib = $node->nextSibling)
56 {
57 $newnode = $par->insertBefore($newnode, $next_sib);
58 }
59 else
60 {
61 $newnode = $par->appendChild($newnode);
62 }
63
64 $node = $par->removeChild($node);
65 $newnode->appendChild($node);
66
67
68
69
70
71
72
73 return $newnode;
74 }
Referenced by ilPCParagraph\handleAjaxContent().
◆ changeName()
static ilDOM2Util::changeName |
( |
|
$node, |
|
|
|
$name, |
|
|
|
$keep_attributes = true |
|
) |
| |
|
static |
Change name of a node.
- Parameters
-
object | $node | |
| string | new name |
- Returns
Definition at line 20 of file class.ilDOM2Util.php.
21 {
22 $newnode = $node->ownerDocument->createElement($name);
23
24 foreach ($node->childNodes as $child)
25 {
26 $child2 = $child->cloneNode(true);
27 $newnode->appendChild($child2);
28 }
29 if ($keep_attributes)
30 {
31 foreach ($node->attributes as $attrName => $attrNode)
32 {
33 $newnode->setAttribute($attrName, $attrNode);
34 }
35 }
36 $node->parentNode->replaceChild($newnode, $node);
37
38 return $newnode;
39 }
Referenced by ilPCParagraph\handleAjaxContent().
◆ replaceByChilds()
static ilDOM2Util::replaceByChilds |
( |
|
$node | ) |
|
|
static |
Replace a node by its child.
- Parameters
-
- Returns
Definition at line 82 of file class.ilDOM2Util.php.
83 {
84 foreach ($node->childNodes as $child)
85 {
86 $child2 = $child->cloneNode(true);
87 $node->parentNode->insertBefore($child2, $node);
88 }
89 $node->parentNode->removeChild($node);
90 }
Referenced by ilPCParagraph\handleAjaxContent().
The documentation for this class was generated from the following file: