This commit is contained in:
gorhill 2015-03-19 13:13:25 -04:00
parent 99774f4d19
commit cb69ff9345
1 changed files with 9 additions and 3 deletions

View File

@ -682,13 +682,19 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
var requests = details.requests;
var selectors = [];
var i = requests.length;
var request;
var request, elem, attr, value;
while ( i-- ) {
request = requests[i];
elem = elements[request.index];
// https://github.com/gorhill/uBlock/issues/399
// Never remove elements from the DOM, just hide them
elements[request.index].style.setProperty('display', 'none', 'important');
selectors.push(request.tagName + '[' + srcProps[request.tagName] + '="' + request.url + '"]');
elem.style.setProperty('display', 'none', 'important');
// https://github.com/gorhill/uBlock/issues/1048
// Use attribute to construct CSS rule
attr = srcProps[request.tagName];
if ( value = elem.getAttribute(attr) ) {
selectors.push(request.tagName + '[' + attr + '="' + value + '"]');
}
}
if ( selectors.length !== 0 ) {
messager.send({