Replace xlink:href with href#2632
Conversation
WalkthroughReplaced SVG Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
classes/views/frm-forms/edit.php (1)
26-29: Minor: stray double quote in button labelLine 28 prints an extra
"after the translated "Update" text, so the button label will appear asUpdate".- <?php esc_attr_e( 'Update', 'formidable' ); ?>" + <?php esc_attr_e( 'Update', 'formidable' ); ?>js/src/form-templates/events/favoriteButtonListener.js (1)
90-104: Favorite heart icons correctly migrated tohrefUsing
setAttribute('href', …)for both the primary and twin heart icons keeps the toggle behavior intact while aligning with the new SVG usage.If you ever expect templates without a
<use>child, a small defensive guard likeif (heartIcon) { … }would avoid a potential runtime error, but that’s not new to this PR.js/src/admin/admin.js (1)
8536-8578: Consider fully migrating JS attribute handling away fromxlinkMarkup now uses
<use href="…">, but helper logic still usesgetAttributeNS/setAttributeNSwith the XLink namespace in a few places (for example when toggling the shortcode box icons and when resetting them inhideShortcodes). Functionally this should keep working, but if the long‑term goal is to eliminatexlink:hrefentirely, you may want to eventually switch those spots to plaingetAttribute('href')/setAttribute('href', ...)and drop the XLink namespace checks.Also applies to: 8800-8811
tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js (1)
155-642: SVG icon assertions correctly migrated fromxlink:hreftohref.All
<use>icon checks now consistently asserthrefacross the add‑on cards, matching the deprecation ofxlink:hrefwithout changing test behavior or selectors. If this area gets touched again, consider a small helper/custom command for the repeatedsvg.frmsvg > use+ icon‑ID assertion to reduce duplication, but it’s not required for this PR.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
images/sales/anniversary.svgis excluded by!**/*.svg,!**/*.svgimages/sales/no-brainer.svgis excluded by!**/*.svg,!**/*.svg
📒 Files selected for processing (10)
classes/helpers/FrmAppHelper.php(3 hunks)classes/views/frm-forms/edit.php(1 hunks)classes/views/styles/_style-options.php(2 hunks)js/admin/dom.js(1 hunks)js/src/admin/admin.js(3 hunks)js/src/form-templates/events/favoriteButtonListener.js(1 hunks)js/src/form-templates/ui/showModal.js(1 hunks)tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js(40 hunks)tests/cypress/e2e/Form Templates/FormTemplates.cy.js(1 hunks)tests/phpunit/misc/test_FrmAppHelper.php(1 hunks)
🔇 Additional comments (10)
classes/views/frm-forms/edit.php (1)
44-51: SVG<use>migration tohrefis correct and consistentUsing
hreffor#frm_break_field_group_icon,#frm_settings_icon, and#frm_delete_iconaligns with the updated helpers and sanitization and will keep these icons rendering correctly after deprecatingxlink:href.js/src/form-templates/ui/showModal.js (1)
86-96: Upgrade modal icon now correctly useshrefSwitching
svg.setAttributeto targethrefinstead ofxlink:hrefmatches the rest of the SVG migration and the updated sprite markup; behavior stays the same.tests/cypress/e2e/Form Templates/FormTemplates.cy.js (1)
33-75: Cypress expectations updated to matchhref-based SVG iconsThe assertions on the category icons now check the
hrefattribute instead ofxlink:href, which keeps the tests aligned with the new markup without changing test intent.classes/views/styles/_style-options.php (1)
12-15: Back button SVG now useshrefThe
<use>in the styles back button correctly switches tohref="#frm_back", consistent with the helper and sanitization changes.classes/helpers/FrmAppHelper.php (1)
1271-1273: Helper and kses configuration correctly updated forhref-based icons
- The safe HTML allowlist for
<use>now permits onlyhref, matching the removal ofxlink:href.icon_by_class()now emits<svg class="frmsvg…"><use href="#icon" /></svg>, in line with the JavaScript SVG helper.- The
format_form_datadocblock’s@param array $formmatches the actual usage.These changes keep server-side icon generation and sanitization aligned with the new SVG pattern.
Also applies to: 1370-1379, 3697-3707
tests/phpunit/misc/test_FrmAppHelper.php (1)
355-369: Unit tests now validatehrefon SVG<use>The
test_kses_iconfixtures have been updated to expecthrefinstead ofxlink:href, ensuring tests stay in sync with the new icon HTML and sanitization rules.js/admin/dom.js (1)
767-781: SVG helper and sanitization are now consistentlyhref-only
svg(), theallowedHtml.usewhitelist, andcleanNode()all work purely withhrefon<use>, completing the migration away fromxlink:hrefsupport in this module.Also applies to: 818-828, 840-848
js/src/admin/admin.js (3)
1394-1407: SVG field group control icons correctly switched tohrefThe new
innerHTMLforlayoutOptionandmoveOptionnow uses<use href="…">, which aligns with SVG2 and matches the rest of the icon system. No functional or safety concerns here.
2638-2653: Dropdown action icon markup updated consistently
anchor.innerHTMLnow uses<use href="#…">with the existingoption.iconvalues. This keeps the icon rendering consistent with the rest of the file and avoids deprecatedxlink:href. Looks good.
7289-7298: Shortcode trigger icon injection aligned withhrefusage
showInputIconnow wraps inputs and prepends<svg class="frmsvg frm-show-box"><use href="#frm_more_horiz_solid_icon"/></svg>, which is consistent with the new SVG pattern. Existing logic that finds/toggles these icons remains compatible. No issues.
|
@truongwp I see this other block of code in |
|
@Crabcyborg I updated this to handle the |
…href Replace xlink:href with href
Fixes issue: https://github.com/Strategy11/formidable-pro/issues/6106