Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

favicon: Remove ancient browser workarounds.

Anders Kaseorgc080b4da0694
diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js
index 4fd80414cbd..95e710ca637 100644
--- a/frontend_tests/node_tests/hashchange.js
+++ b/frontend_tests/node_tests/hashchange.js
@@ -123,7 +123,6 @@ function test_helper() {
stub('admin', 'launch');
stub('drafts', 'launch');
- stub('favicon', 'reset');
stub('floating_recipient_bar', 'update');
stub('message_viewport', 'stop_auto_scrolling');
stub('narrow', 'deactivate');
@@ -301,7 +300,6 @@ run_test('save_narrow', () => {
helper.assert_events([
'message_viewport.stop_auto_scrolling',
- 'favicon.reset',
]);
assert.equal(window.location.hash, '#narrow/is/private');
@@ -318,7 +316,6 @@ run_test('save_narrow', () => {
hashchange.save_narrow(operators);
helper.assert_events([
'message_viewport.stop_auto_scrolling',
- 'favicon.reset',
]);
assert.equal(url_pushed, 'http://example.com/#narrow/is/starred');
});
diff --git a/static/js/favicon.js b/static/js/favicon.js
index 105e8b282e8..527c090d3f2 100644
--- a/static/js/favicon.js
+++ b/static/js/favicon.js
@@ -1,26 +1,5 @@
-const favicon_selector = 'link[rel="shortcut icon"]';
-
-// We need to reset the favicon after changing the
-// window.location.hash or Firefox will drop the favicon. See
-// https://bugzilla.mozilla.org/show_bug.cgi?id=519028
-exports.reset = function () {
- $(favicon_selector).detach().appendTo('head');
-};
-
exports.set = function (url) {
- if (/webkit/i.test(navigator.userAgent)) {
- // Works in Chrome 22 at least.
- // Doesn't work in Firefox 10.
- $(favicon_selector).attr('href', url);
- } else {
- // Delete and re-create the node.
- // May cause excessive work by the browser
- // in re-rendering the page (see #882).
- $(favicon_selector).remove();
- $('head').append($('<link>')
- .attr('rel', 'shortcut icon')
- .attr('href', url));
- }
+ $('#favicon').attr('href', url);
};
diff --git a/static/js/hashchange.js b/static/js/hashchange.js
index 8014fcf670b..e546ffc89b5 100644
--- a/static/js/hashchange.js
+++ b/static/js/hashchange.js
@@ -38,7 +38,6 @@ exports.changehash = function (newhash) {
}
message_viewport.stop_auto_scrolling();
set_hash(newhash);
- favicon.reset();
};
exports.save_narrow = function (operators) {
diff --git a/templates/zerver/base.html b/templates/zerver/base.html
index d043093720d..46b0613bbd2 100644
--- a/templates/zerver/base.html
+++ b/templates/zerver/base.html
@@ -12,7 +12,7 @@
<title>Zulip</title>
{% endif %}
{% endblock %}
- <link href="/static/favicon.ico?v=2" rel="shortcut icon">
+ <link id="favicon" rel="icon" href="/static/favicon.ico?v=2">
{% block meta_viewport %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% endblock %}