Issue Bug Closed

#91405Form editor fails when editing FileUpload fields due to changes in how jQuery parses html with 3.5.0

Markus Scholz 05/14/20, 16:10 updated 05/14/20, 16:22

Description

Hey guys,

after updating to 10.4.2 the FormEditor fails when editing a form that contains a FileUpload field. The reason seems to be a change in the latest jQuery release (3.5.0, https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/).

There are partials that have self closing div elements (e.g. typo3/sysext/form/Resources/Private/Backend/Partials/FormEditor/Stage/FileUploadTemplate.html). Parsing this with jQuery has a different outcome now.

You can reproduce this in the browser console. Try running the following code in 10.4.1 and 10.4.2 backends:

$('<div class="element-content"><div data-template-property="properties.saveToFileMount" /><div data-identifier="multiValueContainer" data-template-property="properties.allowedMimeTypes"><div data-template-property="_value" /></div></div>').html()

Parsed result in 10.4.1 is:

<div data-template-property="properties.saveToFileMount"></div>
<div data-identifier="multiValueContainer" data-template-property="properties.allowedMimeTypes">
    <div data-template-property="_value"></div>
</div>

Parsed result in 10.4.2 is:

<div data-template-property="properties.saveToFileMount">
    <div data-identifier="multiValueContainer" data-template-property="properties.allowedMimeTypes">
        <div data-template-property="_value"></div>
    </div>
</div>

While processing templates and fields “properties.allowedMimeTypes” is overwritten, when updating “properties.saveToFileMount”, resulting in “Invalid parameter ‘key’ (1475361755)”.

I’d recommend updating the templates and avoiding self closing elements for non-void-elements (see https://html.spec.whatwg.org/multipage/syntax.html#start-tags).

Cheers,
Markus

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.