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

Unified Diff: desktop-options.js

Issue 29673576: Make new options page compatible with edge (Closed)
Patch Set: dropped automatically inserted extra line Created Feb. 5, 2018, 9:44 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 | « no previous file | skin/desktop-options.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: desktop-options.js
===================================================================
--- a/desktop-options.js
+++ b/desktop-options.js
@@ -533,18 +533,12 @@
function findParentData(element, dataName, returnElement)
{
- while (element)
- {
- if (element.hasAttribute("data-" + dataName))
- {
- if (returnElement)
- return element;
- return element.getAttribute("data-" + dataName);
- }
-
- element = element.parentElement;
- }
- return null;
+ element = element.closest(`[data-${dataName}]`);
saroyanm 2018/02/08 14:59:09 Detail: We are usually careful when it comes to ex
a.giammarchi 2018/02/08 15:07:21 FWIW closest is not really experimental, it has be
saroyanm 2018/02/08 15:20:18 According to MDN it is -> https://developer.mozill
a.giammarchi 2018/02/08 15:27:29 don't trust everything you read in MDN ... it's up
saroyanm 2018/02/08 15:38:30 Thanks for the links and info. Acknowledged.
+ if (!element)
+ return null;
+ if (returnElement)
+ return element;
+ return element.getAttribute(`data-${dataName}`);
}
function sendMessageHandleErrors(message, onSuccess)
@@ -918,10 +912,10 @@
{
setLinks("enable-acceptable-ads-description", link);
});
- setElementText(E("tracking-warning-1"), "options_tracking_warning_1",
+ setElementText(E("tracking-warning-1"), "options_tracking_warning_1",
[getMessage("common_feature_privacy_title"),
- getMessage("options_acceptableAds_ads_label")]);
- setElementText(E("tracking-warning-3"), "options_tracking_warning_3",
+ getMessage("options_acceptableAds_ads_label")]);
+ setElementText(E("tracking-warning-3"), "options_tracking_warning_3",
[getMessage("options_acceptableAds_privacy_label")]);
getDocLink("privacy_friendly_ads", (link) =>
@@ -1295,7 +1289,7 @@
updateSubscription(subscription);
break;
case "added":
- let {url, recommended} = subscription;
+ let {url} = subscription;
// Handle custom subscription
if (/^~user/.test(url))
{
« no previous file with comments | « no previous file | skin/desktop-options.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld