mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
returning self.Set was not a good idea
This commit is contained in:
parent
068860ef74
commit
7e4e69fd84
@ -62,49 +62,47 @@ vAPI.domFilterer = (function() {
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var SSet = (function() {
|
if ( typeof self.Set !== 'function' ) {
|
||||||
if ( typeof self.Set === 'function' ) {
|
self.Set = function() {
|
||||||
return self.Set;
|
|
||||||
}
|
|
||||||
var Set = function() {
|
|
||||||
this._set = [];
|
this._set = [];
|
||||||
this._i = 0;
|
this._i = 0;
|
||||||
this.value = undefined;
|
this.value = undefined;
|
||||||
};
|
};
|
||||||
Set.prototype.polyfill = true;
|
self.Set.prototype = {
|
||||||
Set.prototype.clear = function() {
|
polyfill: true,
|
||||||
this._set = [];
|
clear: function() {
|
||||||
};
|
this._set = [];
|
||||||
Set.prototype.add = function(k) {
|
},
|
||||||
if ( this._set.indexOf(k) === -1 ) {
|
add: function(k) {
|
||||||
this._set.push(k);
|
if ( this._set.indexOf(k) === -1 ) {
|
||||||
|
this._set.push(k);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delete: function(k) {
|
||||||
|
var pos = this._set.indexOf(k);
|
||||||
|
if ( pos !== -1 ) {
|
||||||
|
this._set.splice(pos, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
has: function(k) {
|
||||||
|
return this._set.indexOf(k) !== -1;
|
||||||
|
},
|
||||||
|
values: function() {
|
||||||
|
this._i = 0;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
next: function() {
|
||||||
|
this.value = this._set[this._i];
|
||||||
|
this._i += 1;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Set.prototype.delete = function(k) {
|
Object.defineProperty(self.Set.prototype, 'size', {
|
||||||
var pos = this._set.indexOf(k);
|
|
||||||
if ( pos !== -1 ) {
|
|
||||||
this._set.splice(pos, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
Set.prototype.has = function(k) {
|
|
||||||
return this._set.indexOf(k) !== -1;
|
|
||||||
};
|
|
||||||
Set.prototype.values = function() {
|
|
||||||
this._i = 0;
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
Set.prototype.next = function() {
|
|
||||||
this.value = this._set[this._i];
|
|
||||||
this._i += 1;
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
Object.defineProperty(Set.prototype, 'size', {
|
|
||||||
get: function() { return this._set.length; }
|
get: function() { return this._set.length; }
|
||||||
});
|
});
|
||||||
return Set;
|
}
|
||||||
})();
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@ -125,11 +123,10 @@ var allExceptions = Object.create(null);
|
|||||||
var allSelectors = Object.create(null);
|
var allSelectors = Object.create(null);
|
||||||
|
|
||||||
// Complex selectors, due to their nature may need to be "de-committed". A
|
// Complex selectors, due to their nature may need to be "de-committed". A
|
||||||
// Set() is used to implement this functionality. For browser with no
|
// Set() is used to implement this functionality.
|
||||||
// support of Set(), uBO will skip committing complex selectors.
|
|
||||||
|
|
||||||
var complexSelectorsOldResultSet;
|
var complexSelectorsOldResultSet;
|
||||||
var complexSelectorsCurrentResultSet = new SSet();
|
var complexSelectorsCurrentResultSet = new Set();
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@ -311,7 +308,7 @@ var domFilterer = {
|
|||||||
|
|
||||||
// Complex selectors: non-incremental.
|
// Complex selectors: non-incremental.
|
||||||
complexSelectorsOldResultSet = complexSelectorsCurrentResultSet;
|
complexSelectorsOldResultSet = complexSelectorsCurrentResultSet;
|
||||||
complexSelectorsCurrentResultSet = new SSet();
|
complexSelectorsCurrentResultSet = new Set();
|
||||||
|
|
||||||
// Stock job 3 = complex css selectors/hide
|
// Stock job 3 = complex css selectors/hide
|
||||||
// The handling of these can be considered optional, since they are
|
// The handling of these can be considered optional, since they are
|
||||||
|
Loading…
Reference in New Issue
Block a user