Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: subscriptionLink.postload.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: "use strict"; Created Jan. 16, 2017, 3:30 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « stats.js ('k') | utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: subscriptionLink.postload.js
diff --git a/subscriptionLink.postload.js b/subscriptionLink.postload.js
index 09316efca0fc116de00a51c10456e8149316747e..0aaf68c78dd12e4f82afa3f37b3138529207893f 100644
--- a/subscriptionLink.postload.js
+++ b/subscriptionLink.postload.js
@@ -19,7 +19,7 @@
if (document instanceof HTMLDocument)
{
- document.addEventListener("click", function(event)
+ document.addEventListener("click", event =>
{
// Ignore right-clicks
if (event.button == 2)
@@ -30,7 +30,7 @@ if (document instanceof HTMLDocument)
return;
// Search the link associated with the click
- var link = event.target;
+ let link = event.target;
while (!(link instanceof HTMLAnchorElement))
{
link = link.parentNode;
@@ -52,12 +52,11 @@ if (document instanceof HTMLDocument)
event.stopPropagation();
// Decode URL parameters
- var params = link.search.substr(1).split("&");
- var title = null;
- var url = null;
- for (var i = 0; i < params.length; i++)
+ let title = null;
+ let url = null;
+ for (let param of link.search.substr(1).split("&"))
{
- var parts = params[i].split("=", 2);
+ let parts = param.split("=", 2);
if (parts.length != 2 || !/\S/.test(parts[1]))
continue;
switch (parts[0])
« no previous file with comments | « stats.js ('k') | utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld