summaryrefslogtreecommitdiff
path: root/addons/website_form
diff options
context:
space:
mode:
authorLaurent Stukkens (LTU) <ltu@odoo.com>2020-06-04 19:28:05 +0000
committerLaurent Stukkens (LTU) <ltu@odoo.com>2020-06-05 13:33:35 +0000
commit94bb547afebf948e58bda8f6916aa7368ede74f2 (patch)
treed9a8d72ed9499b09cc8d147a26ed7538fcfff075 /addons/website_form
parentf0420013e07e1205696bdd7af5502b8f9e3fe271 (diff)
[FIX] website_form: prevent error on drop thumbnail in editor in Safari
Issue When using the website editor in Safari browser, an error occurs when dropping the form builder thumbnail into the editor. Step to Reproduce - Install website and web_editor applications - Use Safari browser - Got to Website - Click on Edit - Drag and drop the From Builder thumbnail from the left panel into the editor Cause The javascript function Node.insertBefore(newNode, referenceNode) needs to be called on referenceNode's immediate parent. Using DocumentFragment.querySelector(':first-child') returns the first child of the first element in the fragment which triggers this issue. The reason why Chrome accepts and handles this correctly remains a mistery to me ;o) Solution Call Node.insertBefore() method on the immediate parent of the node the insertion has to be performed before. So use .childNodes[0] instead of .querySelector(':first-child'). task-2271745 closes odoo/odoo#52520 X-original-commit: dd9ce45c09f8f2181eb48639c0e3ea6617260510 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website_form')
-rw-r--r--addons/website_form/static/src/snippets/s_website_form/options.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_form/static/src/snippets/s_website_form/options.js b/addons/website_form/static/src/snippets/s_website_form/options.js
index 582791f381f..bff1229bf94 100644
--- a/addons/website_form/static/src/snippets/s_website_form/options.js
+++ b/addons/website_form/static/src/snippets/s_website_form/options.js
@@ -535,7 +535,7 @@ options.registry.WebsiteFormEditor = FormEditor.extend({
return;
}
// Add Action select
- const firstOption = uiFragment.querySelector(':first-child');
+ const firstOption = uiFragment.childNodes[0];
uiFragment.insertBefore(this.selectActionEl.cloneNode(true), firstOption);
// Add Action related options