Page 1 of 1
Can't get a filter to be case insensitive
Posted: Sat Jul 02, 2011 1:44 am
by Kevin_Ar18
Let's say you add this element hiding rule:
##*[alt*=text]
This should hide any element with an alt attribute that contains "text" in it. However, it seems that the filter is case sensitive. It will not block "Text" or any other case.
I have not tested to see if it is just certain pages or not. Is there a way to make it case-insensitive all the time?
Re: Can't get a filter to be case insensitive
Posted: Sat Jul 02, 2011 6:23 am
by fanboy
Its not an issue with adblock, its CSS that is case sensitive.
Re: Can't get a filter to be case insensitive
Posted: Sun Jul 03, 2011 4:50 am
by Kevin_Ar18
fanboy wrote:Its not an issue with adblock, its CSS that is case sensitive.
I thought it might be cause.
... Is there any alternative that would not be case sensitive? Would switching to the old non-css style work?
Is there any technical way to make ABP support case-insensitivity?
As you know, the case sensitivity makes it difficult to write effective filters.

Re: Can't get a filter to be case insensitive
Posted: Sun Jul 03, 2011 4:51 am
by Kevin_Ar18
BTW, thanks for confirming that part about the CSS though.

Re: Can't get a filter to be case insensitive
Posted: Sun Jul 03, 2011 8:21 am
by Michael
Kevin_Ar18 wrote:Would switching to the old non-css style work?
I believe that the old style merely translated the filter into CSS, which was inefficient.
Kevin_Ar18 wrote:Is there any technical way to make ABP support case-insensitivity?
The only way that I can think of is to simultaneously create all possible rules (e.g.
###advert would result in
#advert,
#Advert,
###ADvert,
###ADVert and all the other possible permutations of lower and upper case letters). I don't really think that this would be an ideal solution for performance reasons and the lack of control that subscription authors would have - an exception for a rule would apply to all variations of the id of the element.
Re: Can't get a filter to be case insensitive
Posted: Thu Jul 07, 2011 7:25 pm
by KevinAr18
Michael wrote:The only way that I can think of is to simultaneously create all possible rules (e.g. ###advert would result in #advert, #Advert, ###ADvert, ###ADVert and all the other possible permutations of lower and upper case letters).
Thanks. That's what I had in mind too.
Michael wrote:the lack of control that subscription authors would have - an exception for a rule would apply to all variations of the id of the element.
Could it not be made into an option instead of the default or done via something in regex... or some other way perhaps that would make it easy? In other words, it can be turned on and off. In this way, the option to use case-insensitivity would give greater power to writing filters.
Still, that doesn't solve the problem of "how" to make it work.

I suppose you could inject some regex matching into the function(s) that lookup the CSS in the DOM ... but that is probably way beyond what you would want to do for an add-on. Oh, well, thanks for letting me know anyways... even if there is no easy way to implement such a thing in Adblock Plus.