Special HTML Characters in alt tag
Xano - July 28, 2007 - 22:47
| Project: | Smileys |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
The current version of the module places special HTML characters in the alt tag of the images. Besides the fact that I find that the code for a smiley should be in the title tag and the description in the alt tag (usability), these characters cause the page to be invalid HTML. I suggest using htmlspecialchars() in PHP to fill the alt tags with the right code and use some JS like this to turn it back into the actual code:
var smiley = ' ' + this.alt.replace(new Array('$amp;', '"', ''', '<', '>'), new Array('&','"','\'','<','>')) + ' ';(replacement code for line 30 in smileys.js)
I'm just starting to learn a bit more about JS, so I hope this code is efficient enough.

#1
#2
It's not very polite to mark something as a won't fix without even giving an explanation.
#3
<and>are already handled when adding new packs. I am not sure if the other characters you report would make the page HTML invalid. Will need to investigate in this.