actually fix weird checkbox logic, and lint compliance
parent
dc783ce3e4
commit
bd6b6dcb49
|
@ -371,11 +371,11 @@ define([
|
|||
common.getAttribute(['general', 'share'], function (err, val) {
|
||||
val = val || {};
|
||||
if (val.edit === false) {
|
||||
$(link).find('#cp-share-editable-false').attr('checked', true);
|
||||
$(link).find('#cp-share-editable-false').prop('checked', true);
|
||||
}
|
||||
else { $(link).find('#cp-share-editable-true').attr('checked', true); }
|
||||
if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); }
|
||||
if (val.present) { $(link).find('#cp-share-present').attr('checked', true); }
|
||||
else { $(link).find('#cp-share-editable-true').prop('checked', true); }
|
||||
if (val.embed) { $(link).find('#cp-share-embed').prop('checked', true); }
|
||||
if (val.present) { $(link).find('#cp-share-present').prop('checked', true); }
|
||||
$(link).find('#cp-share-link-preview').val(getLinkValue(val));
|
||||
});
|
||||
common.getMetadataMgr().onChange(function () {
|
||||
|
|
|
@ -249,8 +249,16 @@ define([], function () {
|
|||
Util.isChecked = function (el) {
|
||||
// could be nothing...
|
||||
if (!el) { return false; }
|
||||
// jquery or dom elements should both be fine with this
|
||||
return Boolean($(el).prop('checked'));
|
||||
// check if it's a dom element
|
||||
if (typeof(el.tagName) !== 'undefined') {
|
||||
return Boolean(el.checked);
|
||||
}
|
||||
// sketchy test to see if it's jquery
|
||||
if (typeof(el.prop) === 'function') {
|
||||
return Boolean(el.prop('checked'));
|
||||
}
|
||||
// else just say it's not checked
|
||||
return false;
|
||||
};
|
||||
|
||||
return Util;
|
||||
|
|
Loading…
Reference in New Issue