diff --git a/reference/dom/domelement/getattributenames.xml b/reference/dom/domelement/getattributenames.xml new file mode 100644 index 000000000000..346bd56bc432 --- /dev/null +++ b/reference/dom/domelement/getattributenames.xml @@ -0,0 +1,80 @@ + + + + DOMElement::getAttributeNames + Get attribute names + + + + &reftitle.description; + + public arrayDOMElement::getAttributeNames + + + + Get attribute names. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Return attribute names. + + + + + &reftitle.examples; + + <methodname>DOMElement::getAttributeNames</methodname> example + +loadXML(''); +var_dump($dom->documentElement->getAttributeNames()); +?> +]]> + + + &example.outputs; + + + string(10) "xmlns:some" + [1]=> + string(9) "some:test" + [2]=> + string(5) "test2" +} +]]> + + + + diff --git a/reference/dom/domelement/insertadjacentelement.xml b/reference/dom/domelement/insertadjacentelement.xml new file mode 100644 index 000000000000..fcf41518f8df --- /dev/null +++ b/reference/dom/domelement/insertadjacentelement.xml @@ -0,0 +1,112 @@ + + + + DOMElement::insertAdjacentElement + Insert adjacent element + + + + &reftitle.description; + + public DOMElementnullDOMElement::insertAdjacentElement + stringwhere + DOMElementelement + + + Inserts an element at a relative position given by where. + + + + + &reftitle.parameters; + + + + where + + + + beforebegin - Insert before the target element. + afterbegin - Insert as the first child of the target element. + beforeend - Insert as the last child of the target element. + afterend - Insert after the target element. + + + + + + element + + + The element to insert. + + + + + + + + + &reftitle.returnvalues; + + Return DOMElement or &null; on failure. + + + + + &reftitle.examples; + + <methodname>DOMElement::insertAdjacentElement</methodname> example + +loadXML('

foo

'); +$container = $dom->documentElement; +$p = $container->firstElementChild; + +$p->insertAdjacentElement('beforebegin', $dom->createElement('A')); +echo $dom->saveXML(); +?> +]]> +
+
+ &example.outputs; + + +

foo

+]]> +
+
+ + + &reftitle.seealso; + + + DOMElement::insertAdjacentText + + + +
+ diff --git a/reference/dom/domelement/insertadjacenttext.xml b/reference/dom/domelement/insertadjacenttext.xml new file mode 100644 index 000000000000..aa5e4ffa11dd --- /dev/null +++ b/reference/dom/domelement/insertadjacenttext.xml @@ -0,0 +1,115 @@ + + + + DOMElement::insertAdjacentText + Insert adjacent text + + + + &reftitle.description; + + public voidDOMElement::insertAdjacentText + stringwhere + stringdata + + + Inserts text at a relative position given by where. + + + + + &reftitle.parameters; + + + + where + + + + beforebegin - Insert before the target element. + afterbegin - Insert as the first child of the target element. + beforeend - Insert as the last child of the target element. + afterend - Insert after the target element. + + + + + + data + + + The string to insert. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.examples; + + <methodname>DOMElement::insertAdjacentText</methodname> example + +loadXML('

H

'); + +$container = $dom->documentElement; +$p = $container->firstElementChild; + +$p->insertAdjacentText("afterbegin", "P"); +$p->insertAdjacentText("beforeend", "P"); + +echo $dom->saveXML(); +?> +]]> +
+
+ &example.outputs; + + +

PHP

+]]> +
+
+ + + &reftitle.seealso; + + + DOMElement::insertAdjacentElement + + + +
+ diff --git a/reference/dom/domelement/toggleattribute.xml b/reference/dom/domelement/toggleattribute.xml new file mode 100644 index 000000000000..c01d48dc9262 --- /dev/null +++ b/reference/dom/domelement/toggleattribute.xml @@ -0,0 +1,108 @@ + + + + DOMElement::toggleAttribute + Toggle attribute + + + + &reftitle.description; + + public boolDOMElement::toggleAttribute + stringqualifiedName + boolforce&null; + + + Toggle the attribute. + + + + + &reftitle.parameters; + + + + qualifiedName + + + The qualified name of the attribute. + + + + + force + + + + if &null;, the function will toggle the attribute. + if &true;, the function adds the attribute. + if &false;, the function removes the attribute. + + + + + + + + + + &reftitle.returnvalues; + + Returns &true; if the attribute is present after finishing the call, &false; otherwise. + + + + + &reftitle.examples; + + <methodname>DOMElement::toggleAttribute</methodname> example + +loadXML(""); + +var_dump($dom->documentElement->toggleAttribute('selected')); +echo $dom->saveXML() . PHP_EOL; + +var_dump($dom->documentElement->toggleAttribute('selected')); +echo $dom->saveXML(); +?> +]]> + + + &example.outputs; + + + + +bool(true) + + +]]> + + + + diff --git a/reference/dom/domnode/contains.xml b/reference/dom/domnode/contains.xml new file mode 100644 index 000000000000..be383500ac36 --- /dev/null +++ b/reference/dom/domnode/contains.xml @@ -0,0 +1,96 @@ + + + + DOMNode::contains + Checks if node contains other node + + + + &reftitle.description; + + public boolDOMNode::contains + DOMNodeDOMNameSpaceNodenullother + + + Checks if node contains other node. + + + + + &reftitle.parameters; + + + + other + + + Node to be checked. + + + + + + + + + &reftitle.returnvalues; + + Returns &true; if node contains other node, &false; otherwise. + + + + + &reftitle.examples; + + <methodname>DOMNode::contains</methodname> example + +loadXML(<< + + +
+

Hello, world!

+
+ + +XML); + +$xpath = new DOMXPath($dom); +$main = $xpath->query("//main")[0]; + +var_dump($dom->documentElement->contains($main)); +?> +]]> +
+ + + +
+
+
+ diff --git a/reference/dom/domnode/getrootnode.xml b/reference/dom/domnode/getrootnode.xml new file mode 100644 index 000000000000..9cc9c33fd730 --- /dev/null +++ b/reference/dom/domnode/getrootnode.xml @@ -0,0 +1,85 @@ + + + + DOMNode::getRootNode + Get root node + + + + &reftitle.description; + + public DOMNodeDOMNode::getRootNode + arrayoptions&null; + + + Get root node. + + + + + &reftitle.parameters; + + + + options + + + This parameter has no effect yet. + + + + + + + + + &reftitle.returnvalues; + + Returns the root node. + + + + + &reftitle.examples; + + <methodname>DOMNode::getRootNode</methodname> example + +loadXML(''); + +var_dump($dom->documentElement->firstElementChild->getRootNode() === $dom); +?> +]]> + + &example.outputs; + + + + + + + diff --git a/reference/dom/domnode/isequalnode.xml b/reference/dom/domnode/isequalnode.xml new file mode 100644 index 000000000000..55996f8cd4c1 --- /dev/null +++ b/reference/dom/domnode/isequalnode.xml @@ -0,0 +1,84 @@ + + + + DOMNode::isEqualNode + Checks that both nodes are equal + + + + &reftitle.description; + + public boolDOMNode::isEqualNode + DOMNodenullotherNode + + + Checks that both nodes are equal. + + + + + &reftitle.parameters; + + + + otherNode + + + The node. + + + + + + + + + &reftitle.returnvalues; + + Returns &true; if both nodes are equal, &false; otherwise. + + + + + &reftitle.examples; + + <methodname>DOMNode::isEqualNode</methodname> example + +createElement('h1', 'Hello World!'); +$dom2 = (new DOMDocument())->createElement('h1', 'Hello World!'); + +var_dump($dom1->isEqualNode($dom2)); +?> +]]> + + + + + + + + diff --git a/reference/dom/domparentnode/replacechildren.xml b/reference/dom/domparentnode/replacechildren.xml new file mode 100644 index 000000000000..2201a7389518 --- /dev/null +++ b/reference/dom/domparentnode/replacechildren.xml @@ -0,0 +1,88 @@ + + + + DOMParentNode::replaceChildren + Replace children in node + + + + &reftitle.description; + + public voidDOMParentNode::replaceChildren + DOMNodestringnodes + + + Replace children in node. + + + + + &reftitle.parameters; + + + + nodes + + + The nodes replacing the children. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.examples; + + <methodname>DOMParentNode::replaceChildren</methodname> example + +loadHTML('

hi

test

hi2

'); + +$dom->documentElement->replaceChildren('foo', $dom->createElement('p'), 'bar'); +echo $dom->saveXML(); +?> +]]> +
+
+ &example.outputs; + + + +foo

bar +]]> + + + + diff --git a/reference/dom/versions.xml b/reference/dom/versions.xml index 31270ff48adf..e75393343dcd 100644 --- a/reference/dom/versions.xml +++ b/reference/dom/versions.xml @@ -71,6 +71,7 @@ + @@ -78,6 +79,8 @@ + + @@ -88,6 +91,7 @@ + @@ -122,15 +126,17 @@ + + - + @@ -149,6 +155,7 @@ +