X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FClientJS.pm;h=335bf8163107cdfcf383cd7c7e19a9de039d36cd;hb=9af3ce1ca10555dff25e4762d2eb1e7fa0c1e877;hp=f1c949e5fef2b2226dd3229650430d7ebd650604;hpb=3a94c2e211df64dbcbd2b396a12e4bf1f3cf59aa;p=kivitendo-erp.git diff --git a/SL/ClientJS.pm b/SL/ClientJS.pm index f1c949e5f..335bf8163 100644 --- a/SL/ClientJS.pm +++ b/SL/ClientJS.pm @@ -122,6 +122,8 @@ my %supported_methods = ( scroll_into_view => 1, # $()[0].scrollIntoView() ); +my %trim_target_for = map { ($_ => 1) } qw(insertAfter insertBefore appendTo prependTo); + sub AUTOLOAD { our $AUTOLOAD; @@ -154,6 +156,11 @@ sub action { $args[$idx] = "" . $args[$idx] if ref($args[$idx]) eq 'SL::Presenter::EscapedText'; } + # Trim leading whitespaces for certain jQuery functions that operate + # on HTML code: $("

test

").appendTo('#some-id'). jQuery croaks + # on leading whitespaces, e.g. on $("

test

"). + $args[0] =~ s{^\s+}{} if $trim_target_for{$method}; + push @{ $self->_actions }, [ $method, @args ]; return $self;