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

Delta Between Two Patch Sets: lib/filterClasses.js

Issue 29367031: Issue 4684 - Allow { and } in attribute and property selectors (Closed) Base URL: https://bitbucket.org/fhd/adblockpluscore
Left Patch Set: Created Dec. 9, 2016, 2:07 p.m.
Right Patch Set: Add a space after the escape sequence for { and } Created Dec. 13, 2016, 4:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/content/elemHideEmulation.js ('k') | test/filterClasses.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 * @augments ActiveFilter 821 * @augments ActiveFilter
822 */ 822 */
823 function ElemHideBase(text, domains, selector) 823 function ElemHideBase(text, domains, selector)
824 { 824 {
825 ActiveFilter.call(this, text, domains || null); 825 ActiveFilter.call(this, text, domains || null);
826 826
827 if (domains) 827 if (domains)
828 this.selectorDomain = domains.replace(/,~[^,]+/g, "").replace(/^~[^,]+,?/, " ").toLowerCase(); 828 this.selectorDomain = domains.replace(/,~[^,]+/g, "").replace(/^~[^,]+,?/, " ").toLowerCase();
829 829
830 // Braces are being escaped to prevent CSS rule injection. 830 // Braces are being escaped to prevent CSS rule injection.
831 this.selector = selector.replace("{", "\\x7B").replace("}", "\\x7D"); 831 this.selector = selector.replace("{", "\\x7B ").replace("}", "\\x7D ");
Wladimir Palant 2016/12/13 14:32:16 I was probably not clear enough but the space at t
Felix Dahlke 2016/12/13 16:04:48 Done. I gotta admit this is feeling hacky. But I t
Wladimir Palant 2016/12/13 16:29:12 This is exactly how EHH is doing it - took a while
832 } 832 }
833 exports.ElemHideBase = ElemHideBase; 833 exports.ElemHideBase = ElemHideBase;
834 834
835 ElemHideBase.prototype = extend(ActiveFilter, { 835 ElemHideBase.prototype = extend(ActiveFilter, {
836 /** 836 /**
837 * @see ActiveFilter.domainSeparator 837 * @see ActiveFilter.domainSeparator
838 */ 838 */
839 domainSeparator: ",", 839 domainSeparator: ",",
840 840
841 /** 841 /**
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 */ 973 */
974 function ElemHideEmulationFilter(text, domains, selector) 974 function ElemHideEmulationFilter(text, domains, selector)
975 { 975 {
976 ElemHideBase.call(this, text, domains, selector); 976 ElemHideBase.call(this, text, domains, selector);
977 } 977 }
978 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; 978 exports.ElemHideEmulationFilter = ElemHideEmulationFilter;
979 979
980 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { 980 ElemHideEmulationFilter.prototype = extend(ElemHideBase, {
981 type: "elemhideemulation" 981 type: "elemhideemulation"
982 }); 982 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld