History log of /php-src/ext/dom/parentnode.c (Results 1 – 25 of 39)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# bb1688d7 03-Apr-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix argument signedness of dom_sanity_check_node_list_types() (#13875)


# 539d8d92 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use common helper macro for getting the node in property handlers


# 6c55513e 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use true instead of 1 with php_dom_throw_error


# 751163d1 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Change stricterror type to bool


# 14b6c981 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

[RFC] Add a way to opt-in ext/dom spec compliance (#13031)

RFC: https://wiki.php.net/rfc/opt_in_dom_spec_compliance


# eebc528c 01-Oct-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix broken cache invalidation with deallocated and reallocated document node

The original caching implementation had an oversight in combination with
the new lifetime management in DOM f

Fix broken cache invalidation with deallocated and reallocated document node

The original caching implementation had an oversight in combination with
the new lifetime management in DOM for 8.3.
The modification counter is stored on the document object itself, but as
that can get deallocated when all references disappear, stale cache data
can be used. Normally this isn't a problem, unless getElementsByTagName is
called not on the document but on a child node. Fix it by moving caching
data into the ref object, which will outlive all nodes from a document
even if the document object disappears.

Closes GH-12338.

show more ...


# 48443183 02-Sep-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use zend_result as return for properties in ext/dom (#12113)


# 620b6220 08-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Optimize checks for DOMParentNode and DOMChildNode

Because we check the list with dom_sanity_check_node_list_for_insertion()
before dom_is_node_in_list(), then we don't have to check the

Optimize checks for DOMParentNode and DOMChildNode

Because we check the list with dom_sanity_check_node_list_for_insertion()
before dom_is_node_in_list(), then we don't have to check the object
type anymore in dom_is_node_in_list(), because
dom_sanity_check_node_list_for_insertion() will have already done that.

Closes GH-11914.

show more ...


# 23ba4cde 07-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Align DOMChildNode parent checks with spec

Closes GH-11905.


# d19e4da1 07-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix segfault when DOMParentNode::prepend() is called when the child disappears

Closes GH-11906.


# 815b5ad5 05-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix viable next sibling search for replaceWith

Closes GH-11888.


# dddd309d 05-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11830: ParentNode methods should perform their checks upfront

Closes GH-11887.


# e701b2fe 05-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Make DOMChildNode::remove() run in O(1) performance

This method had some useless logic in it. It checked whether the child
node is a child of its parent, which is always true of course.

Make DOMChildNode::remove() run in O(1) performance

This method had some useless logic in it. It checked whether the child
node is a child of its parent, which is always true of course.
But I know where this check comes from, if you follow the spec closely
you'll find that the spec used to have explicit child and parent
arguments for the removal algorithm [1].
That's because that algorithm is written in a generic way, where the
parent and child arguments might not come from the same subtree.
However, in this particular case it *is* always the case that the child
is a child of its parent. The checks weren't needed back then for
DOMChildNode::remove(), and are still not needed today.

[1] e.g. https://web.archive.org/web/20180601092634/https://dom.spec.whatwg.org/#concept-node-remove

show more ...


# 6560c9bf 13-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement DOMParentNode::replaceChildren()

ref: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren


# 5c26258e 13-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Handle fragments consisting out of multiple children without a single root correctly

Closes GH-11698.


# 15ff8303 07-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version

Depending on the libxml2 ver

Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version

Depending on the libxml2 version, the behaviour is either to not
render the fragment correctly, or to wrap it inside <></>. Fix it by
unpacking fragments manually. This has the side effect that we need to
move the unlinking check in the replacement function to earlier because
the empty child list is now possible in non-error cases.
Also fixes a mistake in the linked list management.

Closes GH-11627.

show more ...


# 8904ac7f 18-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Add missing cache invalidation in dom_child_replace_with()

This was forgotten during an earlier merge.


# 8e015170 07-Jun-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

[ci skip] Fix inaccurate comment


# a7202682 05-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use uint32_t for the number of nodes (#11371)


# 23f70025 03-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix bug #81642: DOMChildNode::replaceWith() bug when replacing a node with itself

Closes GH-11363.


# b1d8e240 03-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix bug #67440: append_node of a DOMDocumentFragment does not reconcile namespaces

The test was amended from the original issue report. For the test:
Co-authored-by: php@deep-freeze.ca

Fix bug #67440: append_node of a DOMDocumentFragment does not reconcile namespaces

The test was amended from the original issue report. For the test:
Co-authored-by: php@deep-freeze.ca

The problem is that the regular dom_reconcile_ns() only works on a
single node. We actually have to reconciliate the whole tree in case a
fragment was added. This also required to move some code around such
that this special case could be handled separately.

Closes GH-11362.

show more ...


# c3f07973 02-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement iteration cache, item cache and length cache for node list iteration (#11330)

* Implement iteration cache, item cache and length cache for node list iteration

The current

Implement iteration cache, item cache and length cache for node list iteration (#11330)

* Implement iteration cache, item cache and length cache for node list iteration

The current implementation follows the spec requirement that the list
must be "live". This means that changes in the document must be
reflected in the existing node lists without requiring the user to
refetch the node list.
The consequence is that getting any item, or the length of the list,
always starts searching from the root element of the node list. This
results in O(n) time to get any item or the length. If there's a for
loop over the node list, this means the iterations will take O(n²) time
in total. This causes real-world performance issues with potential for
downtime (see GH-11308 and its references for details).

We fix this by introducing a caching strategy. We cache the last
iterated object in the iterator, the last requested item in the node
list, and the last length computation. To invalidate the cache, we
simply count the number of modifications made to the containing
document. If the modification number does not match what the number was
during caching, we know the document has been modified and the cache is
invalid. If this ever overflows, we saturate the modification number and
don't do any caching anymore. Note that we don't check for overflow on
64-bit systems because it would take hundreds of years to overflow.

Fixes GH-11308.

show more ...


# d8102e6b 29-May-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Remove unnecessary tree setting in dom_zvals_to_fragment()

This is already done by xmlNewDocText().

Closes GH-11345.


# b374ec39 29-May-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Fix DOMElement::append() and DOMElement::prepend() hierarchy checks

We could end up in an invalid hierarchy, resulting in infinite loops and
eventual crashes if we don't check for the DO

Fix DOMElement::append() and DOMElement::prepend() hierarchy checks

We could end up in an invalid hierarchy, resulting in infinite loops and
eventual crashes if we don't check for the DOM hierarchy validity.

Closes GH-11344.

show more ...


# cba335d6 22-May-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Fix GH-11288 and GH-11289 and GH-11290 and GH-9142: DOMExceptions and segfaults with replaceWith

This replaces the implementation of before and after with one following
the spec very str

Fix GH-11288 and GH-11289 and GH-11290 and GH-9142: DOMExceptions and segfaults with replaceWith

This replaces the implementation of before and after with one following
the spec very strictly, instead of trying to figure out the state we're
in by looking at the pointers. Also relaxes the condition on text node
copying to prevent working on a stale node pointer.

Closes GH-11299.

show more ...


12