From 25889d77b674af282ad6dca8ef3aca3980ff9403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Laxstr=C3=B6m?= Date: Thu, 1 Nov 2012 11:24:56 +0000 Subject: [PATCH] Avoid constructing html with concatenation Change-Id: I6104ade6a9f9209df921577cd04d7fe9487e65d9 --- resources/js/ext.uls.init.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js index c6a64a4c..bcf79b52 100644 --- a/resources/js/ext.uls.init.js +++ b/resources/js/ext.uls.init.js @@ -246,15 +246,18 @@ fade: true, trigger: 'manual', title: function () { - var prevLangName, linkClass, prevLangLink, title; + var link; - prevLangName = $.uls.data.getAutonym( previousLang ); - linkClass = 'uls-prevlang-link'; - prevLangLink = '' + - prevLangName + ''; - title = $.i18n( 'ext-uls-undo-language-tooltip-text', prevLangLink ); - return title; + link = $( '' ).text( $.uls.data.getAutonym( previousLang ) ) + .attr( { + href: '#', + class: 'uls-prevlang-link', + lang: previousLang, + dir: $.uls.data.getDir( previousLang ) + } ); + // Get the html of the link by wrapping it in div first + link = $( '
' ).html( link ).html(); + return $.i18n( 'ext-uls-undo-language-tooltip-text', link ); } } );