Bug 1320057, r=kmag
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 24 Nov 2016 13:09:58 +0000
changeset 324663 577914241a79fcd9fb18230d7b0f9c528f57c89c
parent 324662 313bd77f09009341a35b45bc75866a57f02907b9
child 324664 12c2619098c3bb39565fb1d7ccc627b566247512
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerskmag
bugs1320057
milestone53.0a1
Bug 1320057, r=kmag MozReview-Commit-ID: GlM44da7hYL
browser/extensions/pocket/content/panels/js/saved.js
browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
--- a/browser/extensions/pocket/content/panels/js/saved.js
+++ b/browser/extensions/pocket/content/panels/js/saved.js
@@ -25,17 +25,19 @@ var PKT_SAVED_OVERLAY = function(options
     this.cxt_suggested_available = 0;
     this.cxt_entered = 0;
     this.cxt_suggested = 0;
     this.cxt_removed = 0;
     this.justaddedsuggested = false;
     this.fillTagContainer = function(tags, container, tagclass) {
         container.children().remove();
         for (var i = 0; i < tags.length; i++) {
-            var newtag = $('<li><a href="#" class="token_tag ' + tagclass + '">' + tags[i] + '</a></li>');
+            var newtag = $('<li><a href="#" class="token_tag"></a></li>');
+            newtag.find('a').text(tags[i]);
+            newtag.addClass(tagclass);
             container.append(newtag);
             this.cxt_suggested_available++;
         }
     };
     this.fillUserTags = function() {
         thePKT_SAVED.sendMessage("getTags", {}, function(resp)
         {
             if (typeof resp == 'object' && typeof resp.tags == 'object')
--- a/browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
+++ b/browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
@@ -44,18 +44,28 @@ var DEFAULT_SETTINGS = {
  // Prepopulation settings
     prePopulate: null,
     processPrePopulate: false,
 
  // Manipulation settings
     idPrefix: "token-input-",
 
  // Formatters
-    resultsFormatter: function(item){ return "<li>" + item[this.propertyToSearch]+ "</li>" },
-    tokenFormatter: function(item) { return "<li><p>" + item[this.propertyToSearch] + "</p></li>" },
+    resultsFormatter: function(item) {
+        let listItem = document.createElement("li");
+        listItem.textContent = item[this.propertyToSearch];
+        return listItem.outerHTML;
+    },
+    tokenFormatter: function(item) {
+        let listItem = document.createElement("li");
+        let p = document.createElement("p");
+        p.textContent = item[this.propertyToSearch];
+        listItem.appendChild(p);
+        return listItem.outerHTML;
+    },
 
     // Validations
     validateItem: null,
 
     // Force selections only on mouse click
     noHoverSelect: false,
 
  // Callbacks