commit fa3df2db6fc61e8fbf6080b002412aad402ee65a
parent efaf8b57b9c83ab2ecb83a64a3b64f9b73f7101d
Author: Emily Eisenberg <emily@khanacademy.org>
Date: Tue, 26 Aug 2014 14:50:38 -0700
Make permalink button work in IE8.
IE8 doesn't have addEventListener, so use attachEvent if that doesn't exist.
Auditors: alpert
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/static/main.js b/static/main.js
@@ -9,9 +9,15 @@ function init() {
input.attachEvent("onkeyup", reprocess);
}
- permalink.addEventListener("click", function() {
- window.location.search = "?text=" + encodeURIComponent(input.value);
- });
+ if ("addEventListener" in permalink) {
+ permalink.addEventListener("click", function() {
+ window.location.search = "?text=" + encodeURIComponent(input.value);
+ });
+ } else {
+ permalink.attachEvent("click", function() {
+ window.location.search = "?text=" + encodeURIComponent(input.value);
+ });
+ }
var match = (/(?:^\?|&)text=([^&]+)/).exec(window.location.search);
if (match) {