Permalink
Browse files

Merge pull request #89 from iamnoah/patch-1

Don't hookup val() or text(). Neither of these operations will produce an element to hookup to. Fixes a bug where text() or val() incorrectly attempts to insert a DOMElement when the text is HTML-like.
  • Loading branch information...
2 parents 303d820 + 31bd4e5 commit d283189959f8c267c346068444c236f8204e3811 @polgfred polgfred committed Nov 16, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 view/view.js
View
@@ -587,7 +587,9 @@ steal("jquery").then(function( $ ) {
//---- ADD jQUERY HELPERS -----
//converts jquery functions to use views
- var convert, modify, isTemplate, isHTML, isDOM, getCallback, hookupView, funcs;
+ var convert, modify, isTemplate, isHTML, isDOM, getCallback, hookupView, funcs,
+ // text and val cannot produce an element, so don't run hookups on them
+ noHookup = {'val':true,'text':true};
convert = function( func_name ) {
// save the old jQuery helper
@@ -639,8 +641,8 @@ steal("jquery").then(function( $ ) {
return this;
}
}
- return modify.call(this, args, old);
-
+ return noHookup[func_name] ? old.apply(this,args) :
+ modify.call(this, args, old);
};
};

0 comments on commit d283189

Please sign in to comment.