ABP hides a element when previewing but unhides when added

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey
Post Reply
User avatar
nitrox
Posts: 166
Joined: Wed Nov 18, 2009 11:57 am
Location: ::1
Contact:

ABP hides a element when previewing but unhides when added

Post by nitrox »

Site 1: http://www.rdmag.com/News/2009/10/Gener ... iV1KLy8orb
When i use element hiding helper to generate a element to hide
Get daily R&D industry top stories and headlines - Sign up now!
I get

Code: Select all

rdmag.com###highlighted_text_ad\ 

While previewing it, the element is hidden but when i click on Add element hiding rule the element is unhidden. I am not sure why there is a backward slash at the end. I tried removing the backward slash at the end but it doesn't work. The element is still visible.

Code: Select all

<div id="highlighted_text_ad " style="text-align: center;">
When i looked at the source code there seems to be a space at the end of the div name which might be some hidden character, so i am guessing that's what is causing the issue.

Site 2: http://www.realclearpolitics.com/articl ... 08401.html
I tried to hide the News alerts box in the middle of the article using both of the filters below. One at a time.

Code: Select all

realclearpolitics.com###pending_subscriptions
realclearpolitics.com##DIV[style="display: inline; float: right; width: 300px; margin: 0px 0 12px 12px; padding: 0 0 0 10px; position: relative; background-color:#fff;"]
The box is hidden while i preview the element but it is not hidden once i add the filter to adblock plus.

Adblock Plus Errrors

Code: Select all

You are running Adblock Plus 1.3.8, build 3024.

Errors related to Adblock Plus:
Warning:
Expected identifier for pseudo-class or pseudo-element but found ' '. Ruleset ignored due to bad selector.

Location: file:///C:/Users/Nitrox/AppData/Roaming/Mozilla/Firefox/Profiles/ty863try.default/adblockplus/elemhide.css line 15167
Warning:
Selector expected. Ruleset ignored due to bad selector.

Location: file:///C:/Users/Nitrox/AppData/Roaming/Mozilla/Firefox/Profiles/ty863try.default/adblockplus/elemhide.css line 15171
For line 15167 (Site 1)

Code: Select all

#highlighted_text_ad\{-moz-binding: url(about:abp-elemhidehit?467396565069#dummy) !important;}
Full part

Code: Select all

@-moz-document domain("rdmag.com"){
#article_subscriptioncenter{-moz-binding: url(about:abp-elemhidehit?575608194993#dummy) !important;}
#dialog{-moz-binding: url(about:abp-elemhidehit?030298943131#dummy) !important;}
#highlighted_text_ad\{-moz-binding: url(about:abp-elemhidehit?467396565069#dummy) !important;}
#mask{-moz-binding: url(about:abp-elemhidehit?309195071039#dummy) !important;}
#socialmedia{-moz-binding: url(about:abp-elemhidehit?781848116683#dummy) !important;}
}
For Line 15171 (Site 2)

Code: Select all

@-moz-document domain("realclearpolitics.com"){
Full Part

Code: Select all

@-moz-document domain("realclearpolitics.com"){
#pending_subscriptions{-moz-binding: url(about:abp-elemhidehit?690063388538#dummy) !important;}
}
Browser: Firefox 4.0.1
Fanboy list Co-Maintainer

Fanboy Adblock List's

Fanboy List Forum
Michael
Posts: 1361
Joined: Sat Dec 19, 2009 12:29 pm

Re: ABP hides a element when previewing but unhides when added

Post by Michael »

nitrox wrote:When i looked at the source code there seems to be a space at the end of the div name which might be some hidden character, so i am guessing that's what is causing the issue.
The selector is technically invalid, as I believe that an id must end with a letter (this is an issue that the website owner should fix for the sake of standards compliance). The browser is then unable to understand the generated CSS and cannot apply the stylesheet that contains the bad selector.
Ares2
Posts: 1275
Joined: Fri Feb 15, 2008 12:47 pm

Re: ABP hides a element when previewing but unhides when added

Post by Ares2 »

The id seems to be fine, it's just Adblock Plus stripping the trailing space (that in this case is part of the identifier, escaped by the backslash) that breaks the rule. I can hide the element without problems using my own CSS (i.e. Stylish):

Code: Select all

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("rdmag.com") {

#highlighted_text_ad\ { display: none !important; }

}
Wladimir Palant

Re: ABP hides a element when previewing but unhides when added

Post by Wladimir Palant »

Fun, an identifier that ends with a space... The second issue is a follow-up error - the invalid selector prevents correct parsing of the rules that follow it.

Fixed: https://hg.adblockplus.org/elemhidehelp ... d62306706a
Now the filter suggested is:

Code: Select all

rdmag.com###highlighted_text_ad\20
And that works fine without relying on whitespace at the end of the filter.
User avatar
nitrox
Posts: 166
Joined: Wed Nov 18, 2009 11:57 am
Location: ::1
Contact:

Re: ABP hides a element when previewing but unhides when added

Post by nitrox »

Wladimir Palant wrote: Fixed: https://hg.adblockplus.org/elemhidehelp ... d62306706a
Now the filter suggested is:

Code: Select all

rdmag.com###highlighted_text_ad\20
And that works fine without relying on whitespace at the end of the filter.
Confirmed working. Thank you
Fanboy list Co-Maintainer

Fanboy Adblock List's

Fanboy List Forum
Post Reply