mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix: Fixed ui.addition MutationObserver, only apply additions to inserted nodes.
This commit is contained in:
parent
7aa591095b
commit
c71ee9c966
@ -8,6 +8,7 @@ HumHub Change Log
|
||||
- Enh: Added Registraion::EVENT_AFTER_REGISTRATION UserEvent
|
||||
- Enh: Added grunt `migrate-up` and `migrate-create` task
|
||||
- Enh: Added profile field type `CheckboxList`
|
||||
- Fix: Fixed `ui.addition` `MutationObserver`, only apply additions to inserted nodes.
|
||||
|
||||
1.2.0 (April 16, 2017)
|
||||
--------------------------------
|
||||
|
@ -253,10 +253,20 @@ humhub.module('ui.additions', function (module, require, $) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
node = (node instanceof $) ? node[0] : node;
|
||||
|
||||
var $node = $(node);
|
||||
node = $node[0];
|
||||
var observer = new MutationObserver(function (mutations) {
|
||||
module.applyTo(node);
|
||||
mutations.forEach(function(mutation) {
|
||||
var $nodes = $(mutation.addedNodes).filter(function () {
|
||||
return this.nodeType === 1; // filter out text nodes
|
||||
});
|
||||
|
||||
$nodes.each(function() {
|
||||
var $this = $(this);
|
||||
console.log('Apply additions to ', this);
|
||||
module.applyTo($this);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(node, {childList: true, subtree: true});
|
||||
|
Loading…
x
Reference in New Issue
Block a user