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...
Actions