Skip to content

Commit

Permalink
Fix to prevent calls to .tmpl being able to modify data.
Browse files Browse the repository at this point in the history
With the fix you cannot pass in data as a data field of the options map which you pass to .tmpl or $.tmpl.
See http://bugs.jquery.com/ticket/7115.
  • Loading branch information
BorisMoore committed Nov 23, 2010
1 parent e9c0d80 commit 180211f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jquery.tmpl.js
@@ -1,5 +1,5 @@
/*!
* jQuery Templates Plugin
* jQuery Templates Plugin preBeta1.0.1
* http://github.com/jquery/jquery-tmpl
*
* Copyright Software Freedom Conservancy, Inc.
Expand Down Expand Up @@ -27,7 +27,7 @@
update: tiUpdate
};
if ( options ) {
jQuery.extend( newItem, options, { nodes: [], parent: parentItem } );
jQuery.extend( newItem, options, { nodes: [], parent: parentItem, data: newItem.data });
}
if ( fn ) {
// Build the hierarchical content to be used during insertion into DOM
Expand Down Expand Up @@ -407,7 +407,7 @@
if ( !(tmplItem = newTmplItems[key]) ) {
// The item is for wrapped content, and was copied from the temporary parent wrappedItem.
tmplItem = wrappedItems[key];
tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode], null, true );
tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode] );
tmplItem.key = ++itemKey;
newTmplItems[itemKey] = tmplItem;
}
Expand Down Expand Up @@ -443,7 +443,7 @@
function cloneTmplItem( key ) {
key = key + keySuffix;
tmplItem = newClonedItems[key] =
(newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent, null, true ));
(newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent ));
}
}
}
Expand Down

0 comments on commit 180211f

Please sign in to comment.