query buttons on every click to not worry about weird edge case scenarios

remotes/origin/ldap_group_count
Bernhard Posselt 11 years ago
parent 8a30fe8ce3
commit 9112386cbf
  1. 24
      core/js/app.js

@ -7,23 +7,10 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
(function (document, $, exports) {
'use strict';
var buttons = $();
/**
* Allow apps to register buttons at runtime to not impact performance
* negatively on document click
* @param $ button wrapped in jquery result
*/
exports.App = {
registerSlideToggleButton: function (button) {
buttons = buttons.add(button);
}
};
(function (document, $) {
'use strict';
/**
* Provides a way to slide down a target area through a button and slide it
@ -35,11 +22,10 @@
* <div class=".slide-area" class="hidden">I'm sliding up</div>
*/
var registerAppsSlideToggle = function () {
// use only buttons that are already in the dom
buttons = buttons.add($('[data-apps-slide-toggle]'));
$(document).click(function (event) {
var buttons = $('[data-apps-slide-toggle]');
buttons.each(function (index, button) {
var areaSelector = $(button).data('apps-slide-toggle');
@ -75,4 +61,4 @@
registerAppsSlideToggle();
});
}(document, jQuery, OC));
}(document, jQuery));
Loading…
Cancel
Save