I was looking through the source code trying to understand how it works - I'm just not a javascript person.
How does ADP determine which HTML entities actually have a valid background property?
<body background=<url>> = Valid
<span background=<url>> = Not Valid
I seen how it determines the type options $images, $media and what it looks for. Just not sure how it determines which HTML elements the background is valid on.
ADP and Background Images
Re: ADP and Background Images
I don't have an issue, I'm just trying to understand how it magically knows all elements that have a background element.
For instance I'm looking at the include.preload.js for chrome.
I can see see how it's matching the type options
Then I can see where it's looking for the URLS based on the element
I can follow the logic a little, but when it comes to backgrounds - I don't see any type of mappings - How does it know that <body> <table> etc are valid tags? and that <span> isn't - I don't see where it's searching to find the background element url, it works great and finds them, I just don't know how..
For instance I'm looking at the include.preload.js for chrome.
I can see see how it's matching the type options
Code: Select all
var typeMap = {
"img": "IMAGE",
"input": "IMAGE",
"picture": "IMAGE",
"audio": "MEDIA",
"video": "MEDIA",
"frame": "SUBDOCUMENT",
"iframe": "SUBDOCUMENT",
"object": "OBJECT",
"embed": "OBJECT"
};
Code: Select all
function getURLsFromElement(element)
{
var urls;
switch (element.localName)
{
case "object":
urls = getURLsFromObjectElement(element);
break;
case "video":
case "audio":
case "picture":
urls = getURLsFromMediaElement(element);
break;
default:
urls = getURLsFromAttributes(element);
break;
}
Re: ADP and Background Images
I believe that the webRequest API tells ABP what kind of request it was; ABP does not scan the HTML of pages that it blocks ads on to determine what and how to block them.
For Firefox, nsIContentPolicy is similar.
For Firefox, nsIContentPolicy is similar.
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.