Permalink
Browse files

Changed callback names.

onTagAdding > beforeAdding
onTagAdded > afterAdding
onTagRemoving > beforeRemoving
onTagRemoved > afterRemoving
  • Loading branch information...
chemass committed Feb 14, 2012
1 parent 0d86b5f commit 92535ac4d7da4ee92bf116b31723403dd7193279
Showing with 14 additions and 14 deletions.
  1. +6 −6 examples.html
  2. +8 −8 js/tag-it.js
View
@@ -69,11 +69,11 @@
var eventTags = $('#eventTags');
eventTags.tagit({
availableTags: sampleTags,
- onTagRemoving: function(evt, tag) {
+ beforeRemoving: function(evt, tag) {
console.log(evt);
alert('This tag is being removed: ' + eventTags.tagit('tagLabel', tag));
},
- onTagRemoved: function(evt, tag) {
+ afterRemoving: function(evt, tag) {
console.log(evt);
alert('This tag has been removed: ' + eventTags.tagit('tagLabel', tag));
},
@@ -82,13 +82,13 @@
alert('This tag was clicked: ' + eventTags.tagit('tagLabel', tag));
},
onBlur: function(){ alert('Blur event'); }
- }).tagit('option', 'onTagAdding', function(evt, tag) {
+ }).tagit('option', 'beforeAdding', function(evt, tag) {
// Add this callbackafter we initialize the widget,
- // so that onTagAdding doesn't get called on page load.
+ // so that beforeAdding doesn't get called on page load.
alert('This tag is being added: ' + eventTags.tagit('tagLabel', tag));
- }).tagit('option', 'onTagAdded', function(evt, tag) {
+ }).tagit('option', 'afterAdding', function(evt, tag) {
// Add this callbackafter we initialize the widget,
- // so that onTagAdded doesn't get called on page load.
+ // so that afterAdding doesn't get called on page load.
alert('This tag has been added: ' + eventTags.tagit('tagLabel', tag));
});
View
@@ -74,10 +74,10 @@
// Event callbacks.
- onTagAdding: null,
- onTagAdded: null,
- onTagRemoving: null,
- onTagRemoved: null,
+ beforeAdding: null,
+ afterAdding: null,
+ beforeRemoving: null,
+ afterRemoving: null,
onTagClicked: null,
onBlur: null
},
@@ -346,23 +346,23 @@
tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.itemName + '[' + this.options.fieldName + '][]" />');
}
- this._trigger('onTagAdding', null, tag);
+ this._trigger('beforeAdding', null, tag);
// Cleaning the input.
this._tagInput.val('');
// insert tag
this._tagInput.parent().before(tag);
- this._trigger('onTagAdded', null, tag);
+ this._trigger('afterAdding', null, tag);
},
removeTag: function(tag, animate) {
animate = animate || this.options.animate;
tag = $(tag);
- this._trigger('onTagRemoving', null, tag);
+ this._trigger('beforeRemoving', null, tag);
if (this.options.singleField) {
var tags = this.assignedTags();
@@ -381,7 +381,7 @@
tag.remove();
}
- this._trigger('onTagRemoved', null, tag);
+ this._trigger('afterRemoving', null, tag);
},
removeAll: function() {

0 comments on commit 92535ac

Please sign in to comment.