[FIX] web_editor: prevent undefined class/style
The `_wrap` util function of `convert_inline` was not checking if `className` and `style` were defined before adding them to the wrapper element, leading to things like `<div class="undefined">element</div>`. X-original-commit: 9fd6e069d07c3f7964511af7289d95c970d11b3e Part-of: odoo/odoo#124465
This commit is contained in:
@@ -1623,8 +1623,12 @@ function _normalizeStyle(style) {
|
||||
*/
|
||||
function _wrap(element, wrapperTag, wrapperClass, wrapperStyle) {
|
||||
const wrapper = document.createElement(wrapperTag);
|
||||
wrapper.className = wrapperClass;
|
||||
wrapper.style.cssText = wrapperStyle;
|
||||
if (wrapperClass) {
|
||||
wrapper.className = wrapperClass;
|
||||
}
|
||||
if (wrapperStyle) {
|
||||
wrapper.style.cssText = wrapperStyle;
|
||||
}
|
||||
element.parentElement.insertBefore(wrapper, element);
|
||||
wrapper.append(element);
|
||||
return wrapper;
|
||||
|
||||
Reference in New Issue
Block a user