From 31bd4e560aefb9ef2391b1c1163a467acd7425e1 Mon Sep 17 00:00:00 2001 From: noah Date: Tue, 15 Nov 2011 14:14:56 -0600 Subject: [PATCH] Don't hookup val() or text(). The value passed to either of these must be HTML encoded, so it should not produce an element to hookup to. $(args[0]) causes problems when the value or text contains HTML (which should be encoded). See http://jsfiddle.net/mUxPq/ --- view/view.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/view/view.js b/view/view.js index b2f10ce4..befdfec2 100644 --- a/view/view.js +++ b/view/view.js @@ -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); }; };