Prior to this change, both the `a` element and the `img` element have a `title` attribute with the `a` element being a JavaScript tooltip element. This caused a JavaScript tooltip and a native browser tooltip to be shown when hovering over a smiley in the smiley selection below the editor.
See #2220
<ul class="inlineList smileyList">
{foreach from=$smilies item=smiley}
- <li><a title="{lang}{$smiley->smileyTitle}{/lang}" class="jsTooltip jsSmiley">{@$smiley->getHtml()}</a></li>
+ <li><a class="jsSmiley">{@$smiley->getHtml('jsTooltip')}</a></li>
{/foreach}
</ul>
\ No newline at end of file
/**
* Returns the html code to render the smiley.
*
+ * @param string $class (additional) class(es) of the smiley element
* @return string
*/
- public function getHtml() {
+ public function getHtml($class = '') {
$srcset = ($this->smileyPath2x) ? ' srcset="' . StringUtil::encodeHTML($this->getURL2x()) . ' 2x"' : '';
$height = ($this->getHeight()) ? ' height="' . $this->getHeight() . '"' : '';
+ if ($class !== '') {
+ $class = ' ' . $class;
+ }
- return '<img src="' . StringUtil::encodeHTML($this->getURL()) . '" alt="' . StringUtil::encodeHTML($this->smileyCode) . '" title="' . WCF::getLanguage()->get($this->smileyTitle) . '" class="smiley"' . $srcset . $height . '>';
+ return '<img src="' . StringUtil::encodeHTML($this->getURL()) . '" alt="' . StringUtil::encodeHTML($this->smileyCode) . '" title="' . WCF::getLanguage()->get($this->smileyTitle) . '" class="smiley' . $class . '"' . $srcset . $height . '>';
}
}