Page 1 of 1

ABP hides a element when previewing but unhides when added

Posted: Tue May 31, 2011 3:48 pm
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

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

Posted: Tue May 31, 2011 6:25 pm
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.

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

Posted: Tue May 31, 2011 6:41 pm
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; }

}

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

Posted: Fri Jun 03, 2011 8:50 pm
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.

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

Posted: Sun Jun 05, 2011 11:16 am
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