Skip to content

Commit

Permalink
Recompile dist
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-brown committed May 27, 2016
1 parent 2343fd4 commit 24a8d73
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 18 deletions.
3 changes: 3 additions & 0 deletions dist/js/i18n/el.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 69 additions & 7 deletions dist/js/select2.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -5213,10 +5213,11 @@ S2.define('select2/core',[
self.trigger('focus', evt);
});

this._sync = Utils.bind(this._syncAttributes, this);
this._syncA = Utils.bind(this._syncAttributes, this);
this._syncS = Utils.bind(this._syncSubtree, this);

if (this.$element[0].attachEvent) {
this.$element[0].attachEvent('onpropertychange', this._sync);
this.$element[0].attachEvent('onpropertychange', this._syncA);
}

var observer = window.MutationObserver ||
Expand All @@ -5226,14 +5227,30 @@ S2.define('select2/core',[

if (observer != null) {
this._observer = new observer(function (mutations) {
$.each(mutations, self._sync);
$.each(mutations, self._syncA);
$.each(mutations, self._syncS);
});
this._observer.observe(this.$element[0], {
attributes: true,
childList: true,
subtree: false
});
} else if (this.$element[0].addEventListener) {
this.$element[0].addEventListener('DOMAttrModified', self._sync, false);
this.$element[0].addEventListener(
'DOMAttrModified',
self._syncA,
false
);
this.$element[0].addEventListener(
'DOMNodeInserted',
self._syncS,
false
);
this.$element[0].addEventListener(
'DOMNodeRemoved',
self._syncS,
false
);
}
};

Expand Down Expand Up @@ -5378,6 +5395,46 @@ S2.define('select2/core',[
}
};

Select2.prototype._syncSubtree = function (evt, mutations) {
var changed = false;
var self = this;

// Ignore any mutation events raised for elements that aren't options or
// optgroups. This handles the case when the select element is destroyed
if (
evt && evt.target && (
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
)
) {
return;
}

if (!mutations) {
// If mutation events aren't supported, then we can only assume that the
// change affected the selections
changed = true;
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
for (var n = 0; n < mutations.addedNodes.length; n++) {
var node = mutations.addedNodes[n];

if (node.selected) {
changed = true;
}
}
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
changed = true;
}

// Only re-pull the data if we think there is a change
if (changed) {
this.dataAdapter.current(function (currentData) {
self.trigger('selection:update', {
data: currentData
});
});
}
};

/**
* Override the trigger method to automatically trigger pre-events when
* there are events that can be prevented.
Expand Down Expand Up @@ -5524,18 +5581,23 @@ S2.define('select2/core',[
this.$container.remove();

if (this.$element[0].detachEvent) {
this.$element[0].detachEvent('onpropertychange', this._sync);
this.$element[0].detachEvent('onpropertychange', this._syncA);
}

if (this._observer != null) {
this._observer.disconnect();
this._observer = null;
} else if (this.$element[0].removeEventListener) {
this.$element[0]
.removeEventListener('DOMAttrModified', this._sync, false);
.removeEventListener('DOMAttrModified', this._syncA, false);
this.$element[0]
.removeEventListener('DOMNodeInserted', this._syncS, false);
this.$element[0]
.removeEventListener('DOMNodeRemoved', this._syncS, false);
}

this._sync = null;
this._syncA = null;
this._syncS = null;

this.$element.off('.select2');
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
Expand Down
4 changes: 2 additions & 2 deletions dist/js/select2.full.min.js

Large diffs are not rendered by default.

76 changes: 69 additions & 7 deletions dist/js/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5213,10 +5213,11 @@ S2.define('select2/core',[
self.trigger('focus', evt);
});

this._sync = Utils.bind(this._syncAttributes, this);
this._syncA = Utils.bind(this._syncAttributes, this);
this._syncS = Utils.bind(this._syncSubtree, this);

if (this.$element[0].attachEvent) {
this.$element[0].attachEvent('onpropertychange', this._sync);
this.$element[0].attachEvent('onpropertychange', this._syncA);
}

var observer = window.MutationObserver ||
Expand All @@ -5226,14 +5227,30 @@ S2.define('select2/core',[

if (observer != null) {
this._observer = new observer(function (mutations) {
$.each(mutations, self._sync);
$.each(mutations, self._syncA);
$.each(mutations, self._syncS);
});
this._observer.observe(this.$element[0], {
attributes: true,
childList: true,
subtree: false
});
} else if (this.$element[0].addEventListener) {
this.$element[0].addEventListener('DOMAttrModified', self._sync, false);
this.$element[0].addEventListener(
'DOMAttrModified',
self._syncA,
false
);
this.$element[0].addEventListener(
'DOMNodeInserted',
self._syncS,
false
);
this.$element[0].addEventListener(
'DOMNodeRemoved',
self._syncS,
false
);
}
};

Expand Down Expand Up @@ -5378,6 +5395,46 @@ S2.define('select2/core',[
}
};

Select2.prototype._syncSubtree = function (evt, mutations) {
var changed = false;
var self = this;

// Ignore any mutation events raised for elements that aren't options or
// optgroups. This handles the case when the select element is destroyed
if (
evt && evt.target && (
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
)
) {
return;
}

if (!mutations) {
// If mutation events aren't supported, then we can only assume that the
// change affected the selections
changed = true;
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
for (var n = 0; n < mutations.addedNodes.length; n++) {
var node = mutations.addedNodes[n];

if (node.selected) {
changed = true;
}
}
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
changed = true;
}

// Only re-pull the data if we think there is a change
if (changed) {
this.dataAdapter.current(function (currentData) {
self.trigger('selection:update', {
data: currentData
});
});
}
};

/**
* Override the trigger method to automatically trigger pre-events when
* there are events that can be prevented.
Expand Down Expand Up @@ -5524,18 +5581,23 @@ S2.define('select2/core',[
this.$container.remove();

if (this.$element[0].detachEvent) {
this.$element[0].detachEvent('onpropertychange', this._sync);
this.$element[0].detachEvent('onpropertychange', this._syncA);
}

if (this._observer != null) {
this._observer.disconnect();
this._observer = null;
} else if (this.$element[0].removeEventListener) {
this.$element[0]
.removeEventListener('DOMAttrModified', this._sync, false);
.removeEventListener('DOMAttrModified', this._syncA, false);
this.$element[0]
.removeEventListener('DOMNodeInserted', this._syncS, false);
this.$element[0]
.removeEventListener('DOMNodeRemoved', this._syncS, false);
}

this._sync = null;
this._syncA = null;
this._syncS = null;

this.$element.off('.select2');
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
Expand Down
4 changes: 2 additions & 2 deletions dist/js/select2.min.js

Large diffs are not rendered by default.

0 comments on commit 24a8d73

Please sign in to comment.