Skip to content

Commit

Permalink
Fix to no longer set $item as the context for function calls in fnPar…
Browse files Browse the repository at this point in the history
…ams of template tags.

This resolves https://github.com/jquery/jquery-tmpl/issues#issue/38.
This does not yet address all the aspects of https://github.com/nje/jquery-tmpl/issues#issue/29,
which I hope we will address in a future commit.
  • Loading branch information
BorisMoore committed Jan 5, 2011
1 parent 9b05e4a commit 4a6578d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demos/samplesCore/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@

<ul><li class="multiple">first</li><li class="multiple">last</li></ul>

<div class="target">Target</div>
<div class="target"></div>
8 changes: 1 addition & 7 deletions jquery.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,7 @@
.split( "$notnull_1" ).join( target ? "typeof(" + target + ")!=='undefined' && (" + target + ")!=null" : "true" )
.split( "$1a" ).join( exprAutoFnDetect )
.split( "$1" ).join( expr )
.split( "$2" ).join( fnargs ?
fnargs.replace( /\s*([^\(]+)\s*(\((.*?)\))?/g, function( all, name, parens, params ) {
params = params ? ("," + params + ")") : (parens ? ")" : "");
return params ? ("(" + name + ").call($item" + params) : all;
})
: (def.$2||"")
) +
.split( "$2" ).join( fnargs || def.$2 || "" ) +
"_.push('";
}) +
"');}return _;"
Expand Down

0 comments on commit 4a6578d

Please sign in to comment.