X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FHTML%2FZoom%2FFilterBuilder.pm;h=79a15060aa66ed55c688e66adf1bdb04094349fb;hb=f0ddc273d86f2229d0a20103206ccc7d82078289;hp=6577fd92e3dd915f78f0ac7efd92eaa961d0fecf;hpb=a5d7c5f6c5f683b801fda481884ee33892683b30;p=catagits%2FHTML-Zoom.git diff --git a/lib/HTML/Zoom/FilterBuilder.pm b/lib/HTML/Zoom/FilterBuilder.pm index 6577fd9..79a1506 100644 --- a/lib/HTML/Zoom/FilterBuilder.pm +++ b/lib/HTML/Zoom/FilterBuilder.pm @@ -24,6 +24,8 @@ sub _flatten_stream_of_streams { shift->_zconfig->stream_utils->flatten_stream_of_streams(@_) } +sub set_attr { shift->set_attribute(@_); } + sub set_attribute { my $self = shift; my ($name, $value) = $self->_parse_attribute_args(@_); @@ -43,6 +45,9 @@ sub _parse_attribute_args { my $self = shift; # allow ->add_to_attribute(name => 'value') # or ->add_to_attribute({ name => 'name', value => 'value' }) + + warn "WARNING: Long form args (name => 'class', value => 'x') will be replaced with an incompatible form in the *very near future*." + if(@_ == 1 && $_[0]->{'name'} && $_[0]->{'value'}); my ($name, $value) = @_ > 1 ? @_ : @{$_[0]}{qw(name value)}; return ($name, $self->_zconfig->parser->html_escape($value)); } @@ -51,6 +56,14 @@ sub add_attribute { die "renamed to add_to_attribute. killing this entirely for 1.0"; } +sub add_class { shift->add_to_attribute('class',@_) } + +sub remove_class { shift->remove_attribute('class',@_) } + +sub set_class { shift->set_attribute('class',@_) } + +sub set_id { shift->set_attribute('id',@_) } + sub add_to_attribute { my $self = shift; my ($name, $value) = $self->_parse_attribute_args(@_);