From c2783b9b54ecae8299da0dc593c3813c2bd26fe2 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 26 Jul 2012 11:17:28 +0200 Subject: Replace use of attr with prop for booleans Recommened way of setting boolean HTML attributes is by $.prop(boolean) method not $.attr(boolean) because it sets DOM object property not an attribute. Latter works because of jquery's backward compatibility. This patch makes things clearer. Some info about prop and attr: http://stackoverflow.com/a/5876747 https://fedorahosted.org/freeipa/ticket/2817 --- install/ui/widget.js | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'install/ui/widget.js') diff --git a/install/ui/widget.js b/install/ui/widget.js index ed7fcf76..9b15f2f1 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -297,11 +297,7 @@ IPA.text_widget = function(spec) { that.set_enabled = function(value) { - if(value) { - that.input.removeAttr('disabled'); - } else { - that.input.attr('disabled', 'disabled'); - } + that.input.prop('disabled', !value); }; that.clear = function() { @@ -669,11 +665,11 @@ IPA.checkbox_widget = function (spec) { value = that.checked; } - that.input.attr('checked', value); + that.input.prop('checked', value); }; that.clear = function() { - that.input.attr('checked', false); + that.input.prop('checked', false); }; that.checkbox_save = that.save; @@ -741,18 +737,18 @@ IPA.checkboxes_widget = function (spec) { that.update = function(values) { var inputs = $('input[name="'+that.name+'"]', that.container); - inputs.attr('checked', false); + inputs.prop('checked', false); for (var j=0; values && j