Actions
Bug #11180
closedRegression in Wt 4.9.0: widget set mode fails with classList is undefined error
Start date:
12/23/2022
Due date:
% Done:
100%
Estimated time:
Description
Using the widget set example I'm now greeted with:
Wt internal error; code: undefined, description: p.childNodes[i].classList is undefined
Or:
Wt internal error; code: undefined, description: Cannot read properties of undefined (reading 'contains')
This is due to the removal of jQuery. insertAt
in Wt.js
used to contain:
var i, j, il;
for (i = 0, j = 0, il = p.childNodes.length; i < il; ++i) {
if ($(p.childNodes[i]).hasClass("wt-reparented"))
continue;
// ...
}
This was changed to:
for (let i = 0, j = 0, il = p.childNodes.length; i < il; ++i) {
if (p.childNodes[i].classList.contains("wt-reparented")) {
continue;
}
// ...
}
However, childNodes
iterates over all nodes, not just Element
s, so if e.g. a text node is encountered it has no classList
member.
A simple fix could be to change the code to:
for (let i = 0, j = 0, il = p.childNodes.length; i < il; ++i) {
if (p.childNodes[i].classList?.contains("wt-reparented")) {
continue;
}
// ...
}
I'm not sure if it should maybe only iterate over Element
s, though...
Updated by Roel Standaert almost 2 years ago
- Status changed from InProgress to Review
- Assignee changed from Roel Standaert to Korneel Dumon
Updated by Roel Standaert almost 2 years ago
- Has duplicate Bug #11232: Crash when using WidgetSet added
Updated by Roel Standaert almost 2 years ago
- Status changed from Review to Implemented @Emweb
- % Done changed from 0 to 100
Updated by Roel Standaert almost 2 years ago
- Status changed from Implemented @Emweb to Resolved
Updated by Roel Standaert almost 2 years ago
- Assignee changed from Marnik Roosen to Roel Standaert
Updated by Roel Standaert almost 2 years ago
- Status changed from Resolved to Closed
Actions