-
Notifications
You must be signed in to change notification settings - Fork 480
fix(edit-field): Replace jQuery with direct DOM manipulation #34329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(edit-field): Replace jQuery with direct DOM manipulation #34329
Conversation
…bnail and multiselect updates
…o-persist-when-jquery-is-included-via-custom-field-vtl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request partially addresses issue #34288 by replacing jQuery-conflicting $() selectors with standard document.getElementById() calls in field update functions. The issue occurs when external jQuery is loaded via a Custom Field VTL script, overriding the legacy $() shorthand function and breaking field persistence for checkboxes and date fields.
Changes:
- Replaced
$()withdocument.getElementById()in checkbox, multi-select, and image thumbnail update functions
…hen-jquery-is-included-via-custom-field-vtl' of github.com:dotCMS/core into 34288-defect-checkbox-and-date-fields-fail-to-persist-when-jquery-is-included-via-custom-field-vtl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
This pull request updates the way DOM elements are selected in the
edit_field.jspfile, replacing the use of the$()selector (which is likely a jQuery-style or custom selector) with the native JavaScriptdocument.getElementByIdmethod. This change improves code clarity and performance by relying on standard, modern JavaScript APIs.Refactoring DOM element selection:
$()selector withdocument.getElementByIdfor updating the image thumbnail source in thechange<%=field.getFieldContentlet()%>ThumbnailSizefunction.update<%=field.getVelocityVarName()%>MultiSelectfunction to usedocument.getElementByIdinstead of$()for accessing the multi-select element and its hidden field. [1] [2]document.getElementByIdinstead of$().This PR fixes: #34288
This PR fixes: #34288