Skip to content

Commit a305184

Browse files
committed
fix returning the wrong value (re uBlockOrigin/uBlock-issues#6)
1 parent b2094cf commit a305184

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/js/html-filtering.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
/******************************************************************************/
2525

2626
µBlock.htmlFilteringEngine = (function() {
27-
var api = {};
27+
const api = {};
2828

29-
var µb = µBlock,
30-
filterDB = new µb.staticExtFilteringEngine.HostnameBasedDB(),
29+
const µb = µBlock,
3130
pselectors = new Map(),
32-
duplicates = new Set(),
31+
duplicates = new Set();
32+
let filterDB = new µb.staticExtFilteringEngine.HostnameBasedDB(),
3333
acceptedCount = 0,
3434
discardedCount = 0,
3535
docRegister;
3636

37-
var PSelectorHasTextTask = function(task) {
37+
const PSelectorHasTextTask = function(task) {
3838
let arg0 = task[1], arg1;
3939
if ( Array.isArray(task[1]) ) {
4040
arg1 = arg0[1]; arg0 = arg0[0];
@@ -51,7 +51,7 @@
5151
return output;
5252
};
5353

54-
var PSelectorIfTask = function(task) {
54+
const PSelectorIfTask = function(task) {
5555
this.pselector = new PSelector(task[1]);
5656
};
5757
PSelectorIfTask.prototype.target = true;
@@ -70,14 +70,14 @@
7070
return output;
7171
};
7272

73-
var PSelectorIfNotTask = function(task) {
73+
const PSelectorIfNotTask = function(task) {
7474
PSelectorIfTask.call(this, task);
7575
this.target = false;
7676
};
7777
PSelectorIfNotTask.prototype = Object.create(PSelectorIfTask.prototype);
7878
PSelectorIfNotTask.prototype.constructor = PSelectorIfNotTask;
7979

80-
var PSelectorXpathTask = function(task) {
80+
const PSelectorXpathTask = function(task) {
8181
this.xpe = task[1];
8282
};
8383
PSelectorXpathTask.prototype.exec = function(input) {
@@ -101,7 +101,7 @@
101101
return output;
102102
};
103103

104-
var PSelector = function(o) {
104+
const PSelector = function(o) {
105105
if ( PSelector.prototype.operatorToTaskMap === undefined ) {
106106
PSelector.prototype.operatorToTaskMap = new Map([
107107
[ ':has', PSelectorIfTask ],
@@ -161,7 +161,7 @@
161161
return false;
162162
};
163163

164-
var logOne = function(details, exception, selector) {
164+
const logOne = function(details, exception, selector) {
165165
µb.logger.writeOne(
166166
details.tabId,
167167
'cosmetic',
@@ -176,7 +176,7 @@
176176
);
177177
};
178178

179-
var applyProceduralSelector = function(details, selector) {
179+
const applyProceduralSelector = function(details, selector) {
180180
let pselector = pselectors.get(selector);
181181
if ( pselector === undefined ) {
182182
pselector = new PSelector(JSON.parse(selector));
@@ -198,7 +198,7 @@
198198
return modified;
199199
};
200200

201-
var applyCSSSelector = function(details, selector) {
201+
const applyCSSSelector = function(details, selector) {
202202
let nodes = docRegister.querySelectorAll(selector),
203203
i = nodes.length,
204204
modified = false;
@@ -329,7 +329,7 @@
329329
}
330330

331331
if ( toRemoveMap.size === 0 ) { return; }
332-
return Array.from(toRemoveMap);
332+
return Array.from(toRemoveMap.values());
333333
};
334334

335335
api.apply = function(doc, details) {

0 commit comments

Comments
 (0)