UserStyleSheet#
Added in version 2.6.
- class UserStyleSheet(**kwargs)#
A CSS style sheet which can be injected in loaded pages.
Constructors#
- class UserStyleSheet
- classmethod new(source: str, injected_frames: UserContentInjectedFrames, level: UserStyleLevel, allow_list: list[str] | None = None, block_list: list[str] | None = None) UserStyleSheet #
Creates a new user style sheet.
Style sheets can be applied to some URIs only by passing non-null values for
allow_list
orblock_list
. Passing aNone
allow_list implies that all URIs are on the allow_list. The style sheet is applied if an URI matches the allow_list and not the block_list. URI patterns must be of the form[protocol]://[host]/[path]
, where the host and path components can contain the wildcard character (*
) to represent zero or more other characters.Added in version 2.6.
- Parameters:
source – Source code of the user style sheet.
injected_frames – A
UserContentInjectedFrames
valuelevel – A
UserStyleLevel
allow_list – An allow_list of URI patterns or
None
block_list – A block_list of URI patterns or
None
- classmethod new_for_world(source: str, injected_frames: UserContentInjectedFrames, level: UserStyleLevel, world_name: str, allow_list: list[str] | None = None, block_list: list[str] | None = None) UserStyleSheet #
Creates a new user style sheet for script world.
Creates a new user style sheet for script world with name
world_name
. Seenew()
for a full description.Added in version 2.22.
- Parameters:
source – Source code of the user style sheet.
injected_frames – A
UserContentInjectedFrames
valuelevel – A
UserStyleLevel
world_name – the name of a
WebKitScriptWorld
allow_list – An allow_list of URI patterns or
None
block_list – A block_list of URI patterns or
None