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

Delta Between Two Patch Sets: test/browser/elemHideEmulation.js

Issue 29884580: Issue 6504 - Remove element hiding emulation code related to style sheets (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Add comment in constructor Created Sept. 19, 2018, 1:23 p.m.
Right Patch Set: Remove first parameter to constructor Created Sept. 29, 2018, 1:07 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 insertStyleRule("#" + element.id + " " + styleBlock); 146 insertStyleRule("#" + element.id + " " + styleBlock);
147 return element; 147 return element;
148 } 148 }
149 149
150 // Create a new ElemHideEmulation instance with @selectors. 150 // Create a new ElemHideEmulation instance with @selectors.
151 function applyElemHideEmulation(selectors) 151 function applyElemHideEmulation(selectors)
152 { 152 {
153 return Promise.resolve().then(() => 153 return Promise.resolve().then(() =>
154 { 154 {
155 let elemHideEmulation = new ElemHideEmulation( 155 let elemHideEmulation = new ElemHideEmulation(
156 newSelectors =>
157 {
158 if (!newSelectors.length)
159 return;
160 let selector = newSelectors.join(", ");
161 insertStyleRule(selector + "{display: none !important;}");
162 },
163 elems => 156 elems =>
164 { 157 {
165 for (let elem of elems) 158 for (let elem of elems)
166 elem.style.display = "none"; 159 elem.style.display = "none";
167 } 160 }
168 ); 161 );
169 162
170 elemHideEmulation.document = testDocument; 163 elemHideEmulation.document = testDocument;
171 elemHideEmulation.MIN_INVOCATION_INTERVAL = REFRESH_INTERVAL / 2; 164 elemHideEmulation.MIN_INVOCATION_INTERVAL = REFRESH_INTERVAL / 2;
172 elemHideEmulation.apply(selectors.map( 165 elemHideEmulation.apply(selectors.map(
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 for (let element of [...testDocument.getElementsByTagName("div"), 1034 for (let element of [...testDocument.getElementsByTagName("div"),
1042 ...testDocument.getElementsByTagName("p")]) 1035 ...testDocument.getElementsByTagName("p")])
1043 { 1036 {
1044 if (element.id == "n2" || element.id == "n2_3") 1037 if (element.id == "n2" || element.id == "n2_3")
1045 expectProcessed(test, element, element.id); 1038 expectProcessed(test, element, element.id);
1046 else 1039 else
1047 expectNotProcessed(test, element, element.id); 1040 expectNotProcessed(test, element, element.id);
1048 } 1041 }
1049 }).catch(unexpectedError.bind(test)).then(() => test.done()); 1042 }).catch(unexpectedError.bind(test)).then(() => test.done());
1050 }; 1043 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld