orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
511 stars 220 forks source link

Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty #6383

Closed avernet closed 2 weeks ago

avernet commented 2 weeks ago

To reproduce, publish this form, open the /new page, select "1" from the dropdown, check the box labeled "Field 1", and the error will appear.

This regression was introduced while fixing #6336. We switched from YUI to the DOM methods .classList.remove() and .classList.add(), but encountered an issue where an empty string was being added as a class, which the DOM API rejects. This is not unreasonable. The empty string arises because in JavaScript, "".split(" ") returns an array with an empty string instead of an empty array. We don't have this problem in our latest code, where we use our own splitTo method from StringUtils.scala, where "".splitTo[List]("") returns an empty list.

+1 from customer

avernet commented 2 weeks ago

Fixed by https://github.com/orbeon/orbeon-forms-pe/commit/67f9ab73f1f06b9fe0cc499d5beea875a2256754.