Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/CSS/Inliner.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sponsoring entity, MailerMailer LLC, has been sold to j2 Global.
=cut

BEGIN {
my $members = ['stylesheet','css','html','html_tree','query','strip_attrs','relaxed','leave_style','warns_as_errors','content_warnings','agent','fixlatin','encode_entities','ignore_style_type_attr'];
my $members = ['stylesheet','css','html','html_tree','query','strip_attrs','relaxed','leave_style','warns_as_errors','content_warnings','agent','fixlatin','encode_entities','ignore_style_type_attr','ignore_selectors'];

#generate all the getter/setter we need
foreach my $member (@{$members}) {
Expand Down Expand Up @@ -84,6 +84,8 @@ ignore_style_type_attr - (optional) Ignore the deprecated type attribute of "sty

NOTE: This argument is not compatible with passing an html_tree.

ignore_selectors - (optional) Specifies a list of CSS selectors. Any style rules targeting these selectors will be ignored.

agent - (optional) Pass in a string containing a preferred user-agent, overrides the internal default provided by the module for handling remote documents

=cut
Expand Down Expand Up @@ -120,6 +122,7 @@ sub new {
fixlatin => eval { require Encoding::FixLatin; return 1; } ? 1 : 0,
encode_entities => (defined($$params{encode_entities}) && $$params{encode_entities}) ? 1 : 0,
ignore_style_type_attr => (defined($$params{ignore_style_type_attr}) && $$params{ignore_style_type_attr}) ? 1 : 0,
ignore_selectors => $$params{ignore_selectors},
};

bless $self, $class;
Expand Down Expand Up @@ -435,6 +438,7 @@ sub inlinify {
next unless exists $$entry{selector} && $$entry{declarations};

my $selector = $$entry{selector};
next if $self->_ignore_selectors && grep { $selector eq $_ } @{$self->_ignore_selectors};
my $declarations = $$entry{declarations};

#skip over the following pseudo selectors, these particular ones are not inlineable
Expand Down