# HG changeset patch # User Sylvain Thénault # Date 1245862741 -7200 # Node ID 14088bb1a103a5b76089044e93448c4f1bb148df # Parent 200481e7b156aa8742c7db121981728d54e54334 reindent, fix obscur perf pb w/ ff 3.0.11 by performing search on the form instead of the whole document diff -r 200481e7b156 -r 14088bb1a103 web/data/cubicweb.preferences.js --- a/web/data/cubicweb.preferences.js Wed Jun 24 18:04:27 2009 +0200 +++ b/web/data/cubicweb.preferences.js Wed Jun 24 18:59:01 2009 +0200 @@ -114,36 +114,37 @@ function setCurrentValues(form){ jQuery(form).find('[name^=value]').each(function () { - var input = jQuery(this); - var name = input.attr('name'); - if(input.attr('type') == 'radio'){ - // NOTE: there seems to be a bug with jQuery(input).attr('checked') - // in our case, we can't rely on its value, we use - // the DOM API instead. - if(input[0].checked){ - prefsValues[name] = input.val(); - } - }else{ + var input = jQuery(this); + var name = input.attr('name'); + if(input.attr('type') == 'radio'){ + // NOTE: there seems to be a bug with jQuery(input).attr('checked') + // in our case, we can't rely on its value, we use + // the DOM API instead. + if(input[0].checked){ prefsValues[name] = input.val(); } - jQuery('[name=edits-'+ name + ']').val(prefsValues[name]); - }); + }else{ + prefsValues[name] = input.val(); + } + jQuery(form).find('input[name=edits-'+ name + ']').val(prefsValues[name]); + }); } function initEvents(){ - jQuery('form').each(function() { - var form = jQuery(this); - freezeFormButtons(form.attr('id')); - form.find('input[type=text]').keyup(function(){ - checkValues(form); - }); - form.find('input[type=radio]').change(function(){ - checkValues(form); - }); - form.find('select').change(function(){ - checkValues(form); - }); - setCurrentValues(form); + jQuery('form').each(function() { + var form = jQuery(this); + //freezeFormButtons(form.attr('id')); + form.find('input.validateButton').attr('disabled', 'disabled'); + form.find('input[type=text]').keyup(function(){ + checkValues(form); + }); + form.find('input[type=radio]').change(function(){ + checkValues(form); + }); + form.find('select').change(function(){ + checkValues(form); + }); + setCurrentValues(form); }); }