-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeList.item() returns removed nodes #499
Labels
Milestone
Comments
qtow
added
bug
Something isn't working
needs investigation
Information is missing and needs to be researched
labels
Jun 15, 2023
Thanks for the great bug report. |
karfau
added
help-wanted
External contributions welcome
and removed
needs investigation
Information is missing and needs to be researched
labels
Jun 15, 2023
karfau
added a commit
that referenced
this issue
Jul 16, 2023
karfau
added a commit
that referenced
this issue
Jul 19, 2023
- `NodeList.item` now checks the `length` attribute before accessing the item at a provided index and returns `null` it the index is out of range - when updating `LiveNodeList` (as part of accessing the `item` method) and the new `length` is shorter then the current one, any references on indexes following the index starting from `length` are `delete`d, and `null` is returned instead of `undefined` - added some exports to the `lib/dom.js` module to enable testing fixes #499
karfau
added a commit
that referenced
this issue
Jul 19, 2023
- `NodeList.item` now checks the `length` attribute before accessing the item at a provided index and returns `null` it the index is out of range - when updating `LiveNodeList` (as part of accessing the `item` method) and the new `length` is shorter then the current one, any references on indexes following the index starting from `length` are `delete`d, and `null` is returned instead of `undefined` - added some exports to the `lib/dom.js` module to enable testing fixes #499
karfau
added a commit
that referenced
this issue
Jul 19, 2023
- `NodeList.item` now checks the `length` attribute before accessing the item at a provided index and returns `null` it the index is out of range - when updating `LiveNodeList` (as part of accessing the `item` method) and the new `length` is shorter then the current one, any references on indexes following the index starting from `length` are `delete`d, and `null` is returned instead of `undefined` - added some exports to the `lib/dom.js` module to enable testing fixes #499
The fix landed in 0.7 (lts), 0.8 (latest) and 0.9 (next) |
This was referenced Sep 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
Cause:
LiveNodeList is updated at dom.js:312 by copying all owned properties from an array. If the new array is shorter, indexes >= length are not removed.
Possible Solution:
Before or after
copy(ls, list)
, explicitly delete the extra properties:Runtime & Version:
xmldom: 0.8.8
nodejs: 20.3.0
Additional context:
This causes problems with patterns like this:
The text was updated successfully, but these errors were encountered: