Valerii Vasin (valerii) wrote in changelog,
Valerii Vasin
valerii
changelog

[livejournal] r23296: LJSUP-14149: [Friends Feed] "Give tokens...

Committer: vvasin
LJSUP-14149: [Friends Feed] "Give tokens" button going to be broken after ajax request.
U   trunk/htdocs/js/jquery_fn.js
Modified: trunk/htdocs/js/jquery_fn.js
===================================================================
--- trunk/htdocs/js/jquery_fn.js	2012-11-13 14:36:23 UTC (rev 23295)
+++ trunk/htdocs/js/jquery_fn.js	2012-11-13 14:48:11 UTC (rev 23296)
@@ -473,9 +473,25 @@
 	 * @return {Object}      jQuery node
 	 */
 	function parse(node) {
-		var html = node.html();
+		var html = node.html(),
+			// regexp for removing _tmplitem attribute
+			tmplRegexp = /_tmplitem=['"]\d+['"]/mig;
 
+		// uncomment like buttons
 		html = $.trim( html.replace(/<!--([\s\S]*?)-->/mig, '$1') );
+
+		/**
+		 * Clean _tmplitem attributes
+		 *
+		 * It's a quirk for jquery templates possible bug with commented nodes
+		 * and double applying jquery templates.
+		 * _tmplitem attributes are not removed after compilation.
+		 * Fix for #LJSUP-14149
+		 */
+		if ( tmplRegexp.test(html) ) {
+			html = html.replace(tmplRegexp, '');
+		}
+
 		LiveJournal.parseLikeButtons( node.html(html) );
 
 		return node;

Tags: invis89, js, livejournal, vvasin
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments