summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-07-26 11:17:28 +0200
committerPetr Vobornik <pvoborni@redhat.com>2012-08-02 10:27:17 +0200
commitc2783b9b54ecae8299da0dc593c3813c2bd26fe2 (patch)
tree8d43ff1b23545ea58a20bbc911f82f23a455acd2 /install
parent1a94109f4ad5bcb304c4c23af868c3cf07ce92ec (diff)
downloadfreeipa-c2783b9b54ecae8299da0dc593c3813c2bd26fe2.tar.gz
freeipa-c2783b9b54ecae8299da0dc593c3813c2bd26fe2.tar.xz
freeipa-c2783b9b54ecae8299da0dc593c3813c2bd26fe2.zip
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
Diffstat (limited to 'install')
-rw-r--r--install/ui/aci.js2
-rw-r--r--install/ui/association.js4
-rw-r--r--install/ui/dns.js8
-rw-r--r--install/ui/hbactest.js12
-rw-r--r--install/ui/widget.js48
5 files changed, 33 insertions, 41 deletions
diff --git a/install/ui/aci.js b/install/ui/aci.js
index 63181efac..039e63323 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -492,7 +492,7 @@ IPA.attributes_widget = function(spec) {
type: "checkbox",
click: function() {
$('.aci-attribute', that.table).
- attr('checked', $(this).attr('checked'));
+ prop('checked', $(this).prop('checked'));
that.value_changed.notify([], that);
}
})
diff --git a/install/ui/association.js b/install/ui/association.js
index 0594ea764..be8b8459d 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -1038,9 +1038,9 @@ IPA.association_facet = function (spec, no_init) {
that.refresh = function() {
if (that.association_type == 'direct') {
- if (that.direct_radio) that.direct_radio.attr('checked', true);
+ if (that.direct_radio) that.direct_radio.prop('checked', true);
} else {
- if (that.indirect_radio) that.indirect_radio.attr('checked', true);
+ if (that.indirect_radio) that.indirect_radio.prop('checked', true);
}
var pkey = that.entity.get_primary_key();
diff --git a/install/ui/dns.js b/install/ui/dns.js
index 1f4ba8ccd..cd8cb8e19 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -512,8 +512,8 @@ IPA.add_dns_zone_name_policy = function() {
var name_from_ip_f = this.container.fields.get_field('name_from_ip');
idnsname_w.radio_clicked.attach(function() {
- idnsname_w.input.attr('disabled', false);
- name_from_ip_w.input.attr('disabled', true);
+ idnsname_w.input.prop('disabled', false);
+ name_from_ip_w.input.prop('disabled', true);
idnsname_f.set_required(true);
name_from_ip_f.set_required(false);
@@ -522,8 +522,8 @@ IPA.add_dns_zone_name_policy = function() {
});
name_from_ip_w.radio_clicked.attach(function() {
- idnsname_w.input.attr('disabled', true);
- name_from_ip_w.input.attr('disabled', false);
+ idnsname_w.input.prop('disabled', true);
+ name_from_ip_w.input.prop('disabled', false);
idnsname_f.set_required(false);
name_from_ip_f.set_required(true);
diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js
index 373ff39b0..4b666ef29 100644
--- a/install/ui/hbactest.js
+++ b/install/ui/hbactest.js
@@ -279,7 +279,7 @@ IPA.hbac.test_select_facet = function(spec) {
that.table.set_values = function(values) {
if (values && values.length && values[0] === '__external__') {
- if (that.external_radio) that.external_radio.attr('checked', true);
+ if (that.external_radio) that.external_radio.prop('checked', true);
} else {
that.table.table_set_values(values);
}
@@ -393,7 +393,7 @@ IPA.hbac.test_select_facet = function(spec) {
that.reset = function() {
delete that.selected_values;
- if (that.external_radio) that.external_radio.attr('checked', false);
+ if (that.external_radio) that.external_radio.prop('checked', false);
if (that.external_text) that.external_text.val('');
};
@@ -482,8 +482,8 @@ IPA.hbac.test_rules_facet = function(spec) {
that.reset = function() {
delete that.selected_values;
- if (that.enabled) that.enabled.attr('checked', false);
- if (that.disabled) that.disabled.attr('checked', false);
+ if (that.enabled) that.enabled.prop('checked', false);
+ if (that.disabled) that.disabled.prop('checked', false);
};
that.save = function(record) {
@@ -655,8 +655,8 @@ IPA.hbac.test_run_facet = function(spec) {
delete that.data;
that.show_matched = true;
that.show_unmatched = true;
- if (that.matched_checkbox) that.matched_checkbox.attr('checked', true);
- if (that.unmatched_checkbox) that.unmatched_checkbox.attr('checked', true);
+ if (that.matched_checkbox) that.matched_checkbox.prop('checked', true);
+ if (that.unmatched_checkbox) that.unmatched_checkbox.prop('checked', true);
that.refresh();
};
diff --git a/install/ui/widget.js b/install/ui/widget.js
index ed7fcf76c..9b15f2f1b 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<values.length; j++) {
var value = values[j];
var input = $('input[name="'+that.name+'"][value="'+value+'"]', that.container);
if (!input.length) continue;
- input.attr('checked', true);
+ input.prop('checked', true);
}
};
that.clear = function() {
- $('input[name="'+that.name+'"]').attr('checked', false);
+ $('input[name="'+that.name+'"]').prop('checked', false);
};
that.add_option = function(option) {
@@ -829,21 +825,21 @@ IPA.radio_widget = function(spec) {
var value = values && values.length ? values[0] : '';
var input = $(that.selector+'[value="'+value+'"]', that.container);
if (input.length) {
- input.attr('checked', true);
+ input.prop('checked', true);
} else if (that.default_value) {
input = $(that.selector+'[value="'+that.default_value+'"]', that.container);
- input.attr('checked', true);
+ input.prop('checked', true);
}
that.value_changed.notify([that.save()], that);
};
that.clear = function() {
- $(that.selector, that.container).attr('checked', false);
+ $(that.selector, that.container).prop('checked', false);
if (that.default_value) {
var input = $(that.selector+'[value="'+that.default_value+'"]', that.container);
- input.attr('checked', true);
+ input.prop('checked', true);
}
};
@@ -915,7 +911,7 @@ IPA.select_widget = function(spec) {
var value = values[0];
var option = $('option[value="'+value+'"]', that.select);
if (!option.length) return;
- option.attr('selected', 'selected');
+ option.prop('selected', true);
};
that.empty = function() {
@@ -923,7 +919,7 @@ IPA.select_widget = function(spec) {
};
that.clear = function() {
- $('option', that.select).attr('selected', '');
+ $('option', that.select).prop('selected', false);
};
that.set_options_enabled = function(enabled, options) {
@@ -1521,24 +1517,24 @@ IPA.table_widget = function (spec) {
};
that.select_all = function() {
- $('input[name="'+that.name+'"]', that.thead).attr('checked', true).
+ $('input[name="'+that.name+'"]', that.thead).prop('checked', true).
attr('title', IPA.messages.search.unselect_all);
- $('input[name="'+that.name+'"]', that.tbody).attr('checked', true);
+ $('input[name="'+that.name+'"]', that.tbody).prop('checked', true);
that.select_changed();
};
that.unselect_all = function() {
- $('input[name="'+that.name+'"]', that.thead).attr('checked', false).
+ $('input[name="'+that.name+'"]', that.thead).prop('checked', false).
attr('title', IPA.messages.search.select_all);
- $('input[name="'+that.name+'"]', that.tbody).attr('checked', false);
+ $('input[name="'+that.name+'"]', that.tbody).prop('checked', false);
that.select_changed();
};
that.set_values = function(values) {
- $('input[name="'+that.name+'"]', that.tbody).attr('checked', false);
+ $('input[name="'+that.name+'"]', that.tbody).prop('checked', false);
for (var i=0; values && i<values.length; i++) {
var value = values[i];
- $('input[name="'+that.name+'"][value="'+value+'"]', that.tbody).attr('checked', true);
+ $('input[name="'+that.name+'"][value="'+value+'"]', that.tbody).prop('checked', true);
}
that.select_changed();
};
@@ -1697,11 +1693,7 @@ IPA.table_widget = function (spec) {
};
that.set_enabled = function(enabled) {
- if (enabled) {
- $('input[name="'+that.name+'"]', that.table).attr('disabled', false);
- } else {
- $('input[name="'+that.name+'"]', that.table).attr('disabled', true);
- }
+ $('input[name="'+that.name+'"]', that.table).prop('disabled', !enabled);
};
that.clear = function() {
@@ -2316,7 +2308,7 @@ IPA.combobox_widget = function(spec) {
// if no option found, skip
if (!option.length) return;
- option.attr('selected', 'selected');
+ option.prop('selected', true);
that.set_value(option.val());
that.value_changed.notify([], that);