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

Side by Side Diff: options.js

Issue 29458601: Issue 5315 - Add support for Microsoft Edge (Closed)
Patch Set: Workaround CSS.excape, i18n issue and use typeof for 'undefined' detection Created July 17, 2017, 12:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« ext/popup.js ('K') | « metadata.edge ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 let elt = new Option(); 526 let elt = new Option();
527 elt.text = text; 527 elt.text = text;
528 elt.value = text; 528 elt.value = text;
529 document.getElementById(boxId).appendChild(elt); 529 document.getElementById(boxId).appendChild(elt);
530 } 530 }
531 531
532 // Remove a filter string from a list box. 532 // Remove a filter string from a list box.
533 function removeFromListBox(boxId, text) 533 function removeFromListBox(boxId, text)
534 { 534 {
535 let list = document.getElementById(boxId); 535 let list = document.getElementById(boxId);
536 let selector = "option[value=" + CSS.escape(text) + "]"; 536 // Edge does not support CSS.escape yet:
537 for (let option of list.querySelectorAll(selector)) 537 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/101410 /
538 list.removeChild(option); 538 if (typeof CSS.escape == "undefined")
539 {
540 for (let i = 0; i < list.length; i++)
kzar 2017/07/17 14:08:19 This will be kinda slow when there are lots of fil
Sebastian Noack 2017/07/17 14:17:21 Couldn't we just do this instead of CSS.escape():
kzar 2017/07/17 14:27:02 I'm not sure that would always work, for example w
Sebastian Noack 2017/07/17 14:31:25 It seems that we have already implemented the same
kzar 2017/07/17 14:41:37 Sounds good to me. Though to avoid duplicating th
Sebastian Noack 2017/07/17 15:49:56 How about using messaging?
Oleksandr 2017/07/17 23:52:09 Done.
541 if (list.options[i].value == text)
542 list.remove(i--);
543 }
544 else
545 {
546 let selector = "option[value=" + CSS.escape(text) + "]";
547 for (let option of list.querySelectorAll(selector))
548 list.removeChild(option);
549 }
539 } 550 }
540 551
541 function addWhitelistDomain(event) 552 function addWhitelistDomain(event)
542 { 553 {
543 event.preventDefault(); 554 event.preventDefault();
544 555
545 let domain = document.getElementById( 556 let domain = document.getElementById(
546 "newWhitelistDomain" 557 "newWhitelistDomain"
547 ).value.replace(/\s/g, ""); 558 ).value.replace(/\s/g, "");
548 document.getElementById("newWhitelistDomain").value = ""; 559 document.getElementById("newWhitelistDomain").value = "";
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 onFilterMessage(message.action, message.args[0]); 744 onFilterMessage(message.action, message.args[0]);
734 break; 745 break;
735 case "prefs.respond": 746 case "prefs.respond":
736 onPrefMessage(message.action, message.args[0]); 747 onPrefMessage(message.action, message.args[0]);
737 break; 748 break;
738 case "subscriptions.respond": 749 case "subscriptions.respond":
739 onSubscriptionMessage(message.action, message.args[0]); 750 onSubscriptionMessage(message.action, message.args[0]);
740 break; 751 break;
741 } 752 }
742 }); 753 });
OLDNEW
« ext/popup.js ('K') | « metadata.edge ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld