Skip to content

Conversation

bubblesortt
Copy link

What Changed:
Added check for HTMLImageElement type compliance. And the check for the presence of the src property has been removed

Why:
There was no way to set svg as an icon as it is stated on the documentation page
https://preline.co/docs/advanced-select.html#custom-template-with-icons

@olegpix
Copy link
Collaborator

olegpix commented Aug 4, 2025

@bubblesortt Hi!
Thanks for the patch — adding real SVG support via apiIconTag is definitely useful.
Could you please make one small tweak and re-test the public demo before we merge?

  • Keep hiding broken img icons
    At the moment an img with no src shows a broken box. A quick guard keeps the old behaviour:
if (img instanceof HTMLImageElement ? !img.src : !img) {
  icon.classList.add('hidden');
} else {
  icon.classList.remove('hidden');
}
  • Verify the docs demo
    Run the live examples from the documentation (select, datepicker, etc.) with your branch and confirm everything still renders exactly as before—especially icons that use img.

If those checks pass, we’re good to merge. Thanks again for the contribution!

@bubblesortt
Copy link
Author

@olegpix Thanks for your help and the opportunity to contribute!
I am attaching a live example demonstrating the changes, they are in the "select" tab
https://stackblitz.com/edit/preline-3-2-0-astro-d56mwdew?file=src%2Fpages%2Fselect.astro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants