Opened 6 years ago

Last modified 6 years ago

#1527 closed defect

Generated CSS selectors aren't always correctly escaped — at Version 1

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-1.8.8-for-Chrome-Opera-Safari
Module: Platform Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

Description (last modified by sebastian)


Some of the element hiding filters generated by the "Block element" dialog use improperly escaped CSS selectors, breaking those filters, or element hiding all together when those filters are used.

What to change

Properly escape CSS selectors when generating element hiding filters, considering following rules:

  • Non-alpha numeric ascii characters, except for the - (dash) and _ (underscore), must be escaped everywhere in an id or class.
  • Digits must be escaped when in the first place of an id or class.
  • Dashes (-) must be escaped when in the first place of an id or class, and not followed by a character which isn't another dash or digit.
  • Colons (:) must be escaped in tag names (other characters that would need escaping can not occur in a tag name).
  • Quoted attribute values must also escape \r (carriage return), \n (new line), \f (new page) and \0 (null).
  • Control characters and numbers must be escaped based on their code point (e.g. \n -> \0a ). Other characters can be escaped by prepending a \ (backslash).

Change History (1)

comment:1 Changed 6 years ago by sebastian

  • Description modified (diff)
Note: See TracTickets for help on using tickets.