formBuilder
formBuilder copied to clipboard
bootstrap grid "t.classList is undefined" fixed
I am still getting this error on Firefox.
I add an autocomplete field then click the pencil icon add any additional class other than form-control such as row-1 and then close the edit screen by clicking the pencil icon. You should get the error.
@Goddard I guess Kevin didn't merge my edit. Get the formbuilder from github. Then replace src/js/layout.js with the one here. https://github.com/kevinchappell/formBuilder/blob/17e52f0350fcde02e6915b9e16cb30ef6e92d96a/src/js/layout.js Get build and use form-builder.js and form-render.js files prepared for you. It will not be a problem.
@suleymantasci sorry just getting to this. Can you explain how this error occurs with steps to reproduce? I don't quite understand the problem or why it only occurs with those fields.
Try this again with the latest version
@suleymantasci thanks for submitting this PR. I wish I had got to it sooner but the issue seems resolved as I'm not able to reproduce the error. @lucasnetau is having a look as well, if the problem is gone PR will be closed.
As it stands, this error cannot occur anymore due to the additional check for field.classList existence before calling field.classList.remove()
As to the correctness of the code, that's another issue. field.classList.remove(...classes)
assumes we have a singular field and not a complex fragment, the original patch in the PR attempted to also fix this issue by looping through the child objects in a hard-coded manner to remove the classes.
adding this child iterator will fix that in a more generic fashion
field.querySelectorAll('[class*=row-],[class*=col-]').forEach(element => {
if (element.classList) {
element.classList.remove(...classes)
}
})
Alternate PR opened https://github.com/kevinchappell/formBuilder/pull/1412, closing this in favour of the new PR