Skip to content

Fixed image checking for icons#672

Merged
jahaganiev merged 5 commits intohtmlstreamofficial:mainfrom
bubblesortt:main
Jan 27, 2026
Merged

Fixed image checking for icons#672
jahaganiev merged 5 commits intohtmlstreamofficial:mainfrom
bubblesortt:main

Conversation

@bubblesortt
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor 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

@olegpix
Copy link
Copy Markdown
Collaborator

olegpix commented Oct 13, 2025

@bubblesortt Hi!
Sorry for the late reply! We really appreciate your contribution — thank you for the PR.
Please remove the build files and keep only the TypeScript source files.
I’ll approve, and merge your PR in the next update.

@bubblesortt
Copy link
Copy Markdown
Contributor Author

@olegpix Hello! I removed files from dist

@jahaganiev jahaganiev merged commit 6418050 into htmlstreamofficial:main Jan 27, 2026
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.

3 participants