From c50abd1c7623e5dd02b70ac64d9ba79eeb65dc30 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Fri, 8 Mar 2013 19:36:52 -0500 Subject: [PATCH] Fix jQuery selector exception from single quotes in stream names Fixes #1065 (imported from commit 67f74e41f16c01d0d307bd8edf48dd70dde4edf4) --- zephyr/static/js/narrow.js | 2 +- zephyr/static/js/ui.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/zephyr/static/js/narrow.js b/zephyr/static/js/narrow.js index 57c6a44ed5..871cdd5c17 100644 --- a/zephyr/static/js/narrow.js +++ b/zephyr/static/js/narrow.js @@ -345,7 +345,7 @@ exports.activate = function (operators, opts) { if (operators[0][0] === 'in' && operators[0][1] === 'all') { $("#global_filters li[data-name='all']").addClass('active-filter'); } else if (operators[0][0] === "stream") { - $("#stream_filters li[data-name='" + encodeURIComponent(operators[0][1]) + "']").addClass('active-filter'); + ui.get_filter_li('stream', operators[0][1]).addClass('active-filter'); } else if (operators[0][0] === "is" && operators[0][1] === "private-message") { $("#global_filters li[data-name='private']").addClass('active-filter'); } diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index af3e28574e..e440b7856f 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -918,7 +918,15 @@ function sort_narrow_list() { } exports.get_filter_li = function(type, name) { - return $("#" + type + "_filters li[data-name='" + encodeURIComponent(name) + "']"); + var retval = $(); + $("#" + type + "_filters li").each(function (idx, elem) { + var jelem = $(elem); + if (jelem.attr('data-name') === name) { + retval = jelem; + return false; + } + }); + return retval; }; exports.add_narrow_filter = function(name, type, uri) {