Skip to content

Instantly share code, notes, and snippets.

@darkwing
Last active December 14, 2015 14:29
Show Gist options
  • Save darkwing/5101258 to your computer and use it in GitHub Desktop.
Save darkwing/5101258 to your computer and use it in GitHub Desktop.
function boolSet(attr) {
return function(state) {
!!state ? this.setAttribute(attr, null) : this.removeAttribute(attr);
}
}
function boolGet(attr) {
return function() {
return typeof this.getAttribute(attr) != 'undefined';
}
}
xtag.register('x-dragbox', {
accessors: {
sortable: {
get: boolGet('sortable'),
set: boolSet('sortable')
},
droppable: {
get: boolGet('droppable'),
set: boolSet('droppable')
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment