From ed57ed318a03b895bc924c31d47b99a19d651f49 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <ben@bnf.dev> Date: Fri, 25 Aug 2023 06:20:46 +0200 Subject: [PATCH] [BUGFIX] Avoid console error when tabbing through EXT:form inspector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …of a new form element, that has not yet been persisted. Tabbing through an elemenet is considered an "input" by the browser, which is why the "input" even is triggered. The result is an empty input element (as before), but an intent is made to delete the underlying property from the form element object model. When the object model is empty (remeber, it is a new element), and an input field refers to a nested property (e.g. properties.fluidAdditionalAttributes.placeholder) removing an element (e.g. 'placeholder') will fail when the parent has not yet been set (e.g. properties.fluidAdditionalAttributes) Resolves: #101750 Releases: main, 12.4, 11.5 Change-Id: I49a9ead343e671c3d0289bd6d969316b888d05eb Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80733 Tested-by: Benjamin Franzke <ben@bnf.dev> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Benjamin Franzke <ben@bnf.dev> --- .../Resources/Public/JavaScript/Backend/FormEditor/Core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js index cc45a2413e4c..ee5ba3bb8341 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js @@ -886,7 +886,9 @@ define(['jquery'], function($) { propertyToRemove = parentPropertyPath.pop(); parentPropertyPath = parentPropertyPath.join('.'); parentPropertyData = get(parentPropertyPath); - delete parentPropertyData[propertyToRemove]; + if (typeof parentPropertyData !== 'undefined') { + delete parentPropertyData[propertyToRemove]; + } } else { assert(false, 'remove toplevel properties is not supported', 1489319753); } -- GitLab