#
2f9320c0 |
| 22-Feb-2024 |
divinity76 |
DOMXPath::quote(string $str): string (#13456) Method to quote strings in XPath, similar to PDO::quote() / mysqli::real_escape_string. Sample usage: $xp->query("//span[contains(text(
DOMXPath::quote(string $str): string (#13456) Method to quote strings in XPath, similar to PDO::quote() / mysqli::real_escape_string. Sample usage: $xp->query("//span[contains(text()," . $xp->quote($string) . ")]") The algorithm is derived from Robert Rossney's research into XPath quoting published at https://stackoverflow.com/a/1352556/1067003 But using an improved implementation I wrote myself, originally for https://github.com/chrome-php/chrome/pull/575
show more ...
|
#
90785dd8 |
| 12-Jan-2024 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
[RFC] Improve callbacks in ext/dom and ext/xsl (#12627)
|
#
d8268f1a |
| 16-Dec-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Change return type of registerNodeClass to true (#12960)
|
#
9c306470 |
| 04-Dec-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Handle libxml2 OOM more consistently (#11927) This is a continuation of commit c2a58ab07d, in which several OOM error handling was converted to throwing an INVALID_STATE_ERR DOMException
Handle libxml2 OOM more consistently (#11927) This is a continuation of commit c2a58ab07d, in which several OOM error handling was converted to throwing an INVALID_STATE_ERR DOMException. Some places were missed and they still returned false without an exception, or threw a PHP_ERR DOMException. Convert all of these to INVALID_STATE_ERR DOMExceptions. This also reduces confusion of users going through documentation [1]. Unfortunately, not all node creations are checked for a NULL pointer. Some places therefore will not do anything if an OOM occurs (well, except crash). On the one hand it's nice to handle these OOM cases. On the other hand, this adds some complexity and it's very unlikely to happen in the real world. But then again, "unlikely" situations have caused trouble before. Ideally all cases should be checked. [1] https://github.com/php/doc-en/issues/1741
show more ...
|
#
164995ef |
| 27-Nov-2023 |
Máté Kocsis |
Fix ext/dom object hierarchy gen_stub.php references classes inside namespaces relatively
|
#
1492be52 |
| 13-Nov-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
[RFC] DOM HTML5 parsing and serialization support (#12111)
|
#
24e5e4ec |
| 08-Oct-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix GH-8996: DOMNode serialization on PHP ^8.1 PHP 8.1 introduced a seemingly unintentional BC break in ca94d55a19 by blocking the (un)serialization of DOM objects. This was done bec
Fix GH-8996: DOMNode serialization on PHP ^8.1 PHP 8.1 introduced a seemingly unintentional BC break in ca94d55a19 by blocking the (un)serialization of DOM objects. This was done because the serialization never really worked and just resulted in an empty object, which upon unserialization just resulted in an object that you can't use. Users can however implement their own serialization methods, but the commit made that impossible as the ACC flag gets passed down to the child class. An approach was tried in #10307 with a new ACC flag to selectively allow serialization with subclasses if they implement the right methods. However, that was found to be too ad hoc. Instead, let's abuse how the __sleep and __wakeup methods work to throw the exception instead. If the child class implements the __serialize / __unserialize method, then the throwing methods won't be called. Similarly, if the child class implements __sleep and __wakeup, then they're overridden and it doesn't matter that they throw. For the user, this PR has the exact same behaviour for (sub)classes that don't implement the serialization methods: an exception will be thrown. For code that previously implemented subclasses with these methods, this approach will make that code work again. This approach should be both BC preserving and unbreak user's code. Closes GH-12388. For the test: Co-authored-by: wazelin <contact@sergeimikhailov.com>
show more ...
|
#
f2fede56 |
| 08-Sep-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Deduplicate ParentNode and ChildNode interface implementations using @implementation-alias The entry points are duplicated: they add bloat and make it easier to forget to change somethin
Deduplicate ParentNode and ChildNode interface implementations using @implementation-alias The entry points are duplicated: they add bloat and make it easier to forget to change something. Make maintenance easier by using @implementation-alias. Also, this has the nice side-effect of slightly reducing the amount of code and binary size. Closes GH-12158.
show more ...
|
#
880faa39 |
| 08-Sep-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Add DOMNode::compareDocumentPosition() (#12146) Reference: https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
|
#
6e468bbd |
| 31-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix json_encode result on DOMDocument According to https://www.php.net/manual/en/class.domdocument: When using json_encode() on a DOMDocument object the result will be that of en
Fix json_encode result on DOMDocument According to https://www.php.net/manual/en/class.domdocument: When using json_encode() on a DOMDocument object the result will be that of encoding an empty object. But this was broken in 8.1. The output was `{"config": null}`. That's because the config property is defined with a default value of NULL, hence it was included. The other properties are not included because they don't have a default property, and nothing is ever written to their backing field. Hence, the JSON encoder excludes them. Similarly, `(array) $doc` would yield the same `config` key in the array. Closes GH-11840.
show more ...
|
#
ae66a0d1 |
| 26-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Corrections to return type of loading DOM documents
|
#
db5e8ae6 |
| 13-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMElement::toggleAttribute() ref: https://dom.spec.whatwg.org/#dom-element-toggleattribute Closes GH-11696.
|
#
a73f38f4 |
| 17-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMElement::insertAdjacent{Element,Text} (#11700) * Implement DOMElement::insertAdjacent{Element,Text} ref: https://dom.spec.whatwg.org/#dom-element-insertadjacentelement
Implement DOMElement::insertAdjacent{Element,Text} (#11700) * Implement DOMElement::insertAdjacent{Element,Text} ref: https://dom.spec.whatwg.org/#dom-element-insertadjacentelement ref: https://dom.spec.whatwg.org/#dom-element-insertadjacenttext Closes GH-11700.
show more ...
|
#
2f318cfb |
| 12-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMNode::isEqualNode() Since we still support obsoleted nodes in our implementation, this uses the old spec to match the old nodes; and this uses the new spec for nodes sti
Implement DOMNode::isEqualNode() Since we still support obsoleted nodes in our implementation, this uses the old spec to match the old nodes; and this uses the new spec for nodes still defined in the living spec. When unclear, the behaviour was cross-verified with Firefox. References: https://dom.spec.whatwg.org/#dom-node-isequalnode (for everything still in the living spec) https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html#core-Node3-isEqualNode (for old nodes removed from the living spec) Closes GH-11690.
show more ...
|
#
d04f48b6 |
| 11-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMNode::parentElement and DOMNameSpaceNode::parentElement ref: https://dom.spec.whatwg.org/#parent-element Closes GH-11679.
|
#
d38cc9b9 |
| 11-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMNode::isConnected and DOMNameSpaceNode::isConnected ref: https://dom.spec.whatwg.org/#dom-node-isconnected Closes GH-11677.
|
#
72e2e250 |
| 13-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMElement::id ref: https://dom.spec.whatwg.org/#dom-element-id Closes GH-11701.
|
#
6560c9bf |
| 13-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMParentNode::replaceChildren() ref: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
|
#
b24b3510 |
| 12-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMElement::className ref: https://dom.spec.whatwg.org/#dom-element-classname Closes GH-11691.
|
#
d17069e1 |
| 12-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMNode::getRootNode() ref: https://dom.spec.whatwg.org/#dom-node-getrootnode Closes GH-11693.
|
#
10d7e8dc |
| 12-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMElement::getAttributeNames() ref: https://dom.spec.whatwg.org/#dom-element-getattributenames
|
#
ea794e9c |
| 11-Jul-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMNode::contains() ref: https://dom.spec.whatwg.org/#dom-node-contains
|
#
ed6df1f0 |
| 25-Jun-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Implement DOMDocument::adoptNode() For the past 20 years this threw a "not yet implemented" exception. But the function was actually there (albeit not documented) and could be called...
Implement DOMDocument::adoptNode() For the past 20 years this threw a "not yet implemented" exception. But the function was actually there (albeit not documented) and could be called... Closes GH-11333.
show more ...
|
#
761b9a44 |
| 29-May-2023 |
divinity76 |
Fix return value in stub file for DOMNodeList::item Not explicitly documenting the possibility of returning DOMElement causes the Intelephense linter (a popular PHP linter with ~9 millio
Fix return value in stub file for DOMNodeList::item Not explicitly documenting the possibility of returning DOMElement causes the Intelephense linter (a popular PHP linter with ~9 million downloads: https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client) to think this code is bad: $xp->query("whatever")->item(0)->getAttribute("foo"); DOMNode does not have getAttribute (while DOMElement does). Documenting the DOMElement return type should fix Intelephense's linter. Closes GH-11342.
show more ...
|
#
e1967ca9 |
| 25-Feb-2023 |
othercorey |
Change DOMCharacterData::appendData return type to true (#10690)
|