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

Unified Diff: include.preload.js

Issue 29401596: Issue 5094 - Implement support for :has() in chrome extension (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created April 3, 2017, 2:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -425,17 +425,18 @@ function ElemHide()
window,
callback =>
{
ext.backgroundPage.sendMessage({
type: "filters.get",
what: "elemhideemulation"
}, callback);
},
- this.addSelectors.bind(this)
+ this.addSelectors.bind(this),
+ this.hideElements.bind(this)
);
}
ElemHide.prototype = {
selectorGroupSize: 200,
createShadowTree()
{
// Use Shadow DOM if available as to not mess with with web pages that
@@ -536,16 +537,27 @@ ElemHide.prototype = {
this.style.sheet.insertRule(selector + "{display: none !important;}",
this.style.sheet.cssRules.length);
}
if (this.tracer)
this.tracer.addSelectors(selectors, filters || selectors);
},
+ hideElements(elements, filters)
+ {
+ for (let element of elements)
+ {
+ element.style.display = "none";
Sebastian Noack 2017/04/04 10:14:45 We should use the same logic as we have in checkCo
hub 2017/04/05 09:05:53 Done.
+ }
+ // XXX first arg is supposed to be selectors
+ if (this.tracer)
+ this.tracer.addSelectors(filters, filters);
Sebastian Noack 2017/04/04 10:14:45 ElementHidingTracer.addSelectors() will search for
hub 2017/04/05 09:05:53 Done.
+ },
+
apply()
{
ext.backgroundPage.sendMessage({type: "get-selectors"}, response =>
{
if (this.tracer)
this.tracer.disconnect();
this.tracer = null;
« no previous file with comments | « dependencies ('k') | lib/filterValidation.js » ('j') | lib/filterValidation.js » ('J')

Powered by Google App Engine
This is Rietveld