mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-02-05 03:24:17 +00:00
fix wrong bindings for hyperlinks in fillElemWithTxt()
This commit is contained in:
parent
17bfce7c43
commit
3d68b90ef9
@ -805,19 +805,16 @@ function fillElemWithTxt(elem, txt, htmlFormatMsgOpt) {
|
||||
var formatted = htmlFormatMsg(txt, htmlFormatMsgOpt);
|
||||
|
||||
elem.html(formatted.html);
|
||||
elem.find('a')
|
||||
.on('mouseup',
|
||||
function (event) {
|
||||
var href = event.target.getAttribute('href');
|
||||
if (href[0] === '#') {
|
||||
event.data = {route: href};
|
||||
routeOnClick(event);
|
||||
} else
|
||||
muteEvent(event);
|
||||
}
|
||||
)
|
||||
.on('click', {preventDefault: true}, muteEvent)
|
||||
;
|
||||
elem.find('a').each(function (i, elem) {
|
||||
var href = elem.getAttribute('href');
|
||||
if (href && href[0] === '#')
|
||||
$(elem)
|
||||
.on('click', {preventDefault: true}, muteEvent)
|
||||
.on('mouseup', {route: href}, routeOnClick)
|
||||
;
|
||||
else
|
||||
$(elem).on('click mouseup', muteEvent);
|
||||
});
|
||||
|
||||
return formatted;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user