diff --git a/src/mm-list-item/index.html b/src/mm-list-item/index.html index d66477e8..4e2435cd 100644 --- a/src/mm-list-item/index.html +++ b/src/mm-list-item/index.html @@ -1,19 +1,68 @@ - + - - - - + + + + + + + - Item here 00 - I am a moderate amount of text. Just a bit but not too much - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. - - + Item here 00 + I am a moderate amount of text. Just a bit but not too much + Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + + + + + diff --git a/src/mm-list-item/mm-list-item.js b/src/mm-list-item/mm-list-item.js index 839a759f..521c2b25 100644 --- a/src/mm-list-item/mm-list-item.js +++ b/src/mm-list-item/mm-list-item.js @@ -78,9 +78,9 @@ } }, - elementResize: function() { - this.debounce("update-title", this.updateTitle, 0); - }, + // elementResize: function() { + // this.debounce("update-title", this.updateTitle, 0); + // }, updateTitle: function() { var m = StrandLib.Measure; diff --git a/src/shared/behaviors/autoclosable.html b/src/shared/behaviors/autoclosable.html index 47a4a6da..b4775c85 100644 --- a/src/shared/behaviors/autoclosable.html +++ b/src/shared/behaviors/autoclosable.html @@ -8,14 +8,14 @@ */ (function (scope) { - var _instances = []; + var _instances = new Set(); function _addInstance(instance) { - _instances.push(instance); + _instances.add(instance); } function _removeInstance(instance) { - _instances.splice(_instances.indexOf(instance), 1); + _instances.delete(instance); } document.addEventListener("mouseup", function(e) { @@ -23,8 +23,7 @@ var instance; var scope; var filter; - for(var i in _instances) { - instance = _instances[i]; + for (var instance of _instances) { filter = instance._closeFilter; scope = typeof instance.scope === "object" ? instance.scope : instance; filter.apply(scope, [instance, normalized, e]); diff --git a/src/shared/behaviors/resizable.html b/src/shared/behaviors/resizable.html index 32a5c200..b11d5046 100644 --- a/src/shared/behaviors/resizable.html +++ b/src/shared/behaviors/resizable.html @@ -8,38 +8,41 @@ (function (scope) { - var _instances = []; + var _instances = new Set(); var _il = 0; var _backoff = 0; var _backoff_inc = 200; var _backoff_max = 2000; function _addInstance(instance, target) { - _instances.push({ - target:target, + var meta = { + target: target, instance: instance, - width:target.offsetWidth, - height:target.offsetHeight, - }); + width: target.offsetWidth, + height: target.offsetHeight, + }; + _instances.add(meta); _il++; requestAnimationFrame(_measure); } function _removeInstance(instance) { - _instances.filter(function(meta) { - return meta.instance === instance; - }).forEach(function(target) { - _instances.splice(_instances.indexOf(target), 1); - _il--; + var metaArr = Array.from(_instances); + var meta = metaArr.filter(function(item){ + return item.instance === instance; }); + _instances.delete(meta); + _il--; } function _measure() { _backoff += _backoff_inc; if (_backoff > _backoff_max) _backoff = _backoff_max; + var _instArr = Array.from(_instances); + for(var i=0; i<_il; i++) { - var meta = _instances[i]; + var meta = _instArr[i]; var w = meta.target.offsetWidth; var h = meta.target.offsetHeight; if (meta.width !== w) { @@ -74,6 +77,7 @@ }, detached:function() { + console.log('detached', this); _removeInstance(this); }, diff --git a/src/shared/behaviors/stackable.html b/src/shared/behaviors/stackable.html index 92045bd5..66dc1723 100644 --- a/src/shared/behaviors/stackable.html +++ b/src/shared/behaviors/stackable.html @@ -12,19 +12,19 @@ modal:{ base:1*_w, max:2*_w, - items:[], + items: new Set(), topIndex:1*_w }, ui:{ base:2*_w, max:3*_w, - items:[], + items: new Set, topIndex:2*_w }, tooltip:{ base:3*_w, max:4*_w, - items:[], + items: new Set(), topIndex:3*_w } }; @@ -33,11 +33,10 @@ var cat = _instances[type], inst = !instance ? host : instance; - if (cat && cat.items.length < cat.max) { - cat.items.push(inst); + if (cat && cat.items.size < cat.max) { + cat.items.add(inst); host._setDepth(cat.topIndex); cat.topIndex++; - // instance._setDepth(cat.items.length + cat.base); } else { throw(new Error("Could not add item at " + cat.max)); } @@ -48,7 +47,7 @@ inst = !instance ? host : instance; if (cat) { - cat.items.splice(cat.items.indexOf(inst), 1); + cat.items.delete(inst); } } diff --git a/src/shared/behaviors/windownotifier.html b/src/shared/behaviors/windownotifier.html index 7cdeec76..0247a291 100644 --- a/src/shared/behaviors/windownotifier.html +++ b/src/shared/behaviors/windownotifier.html @@ -7,27 +7,25 @@ */ (function (scope) { - var _instances = []; + var _instances = new Set(); function _addInstance(instance) { - _instances.push(instance); + _instances.add(instance); } function _removeInstance(instance) { - _instances.splice(_instances.indexOf(instance), 1); + _instances.delete(instance); } function _resizeHandler() { - var i; - for (i = _instances.length - 1; i >= 0; i--) { - if (_instances[i].resize) { _instances[i].resize(); } + for (var instance of _instances) { + if (instance.resize) instance.resize(); } } function _scrollHandler (argument) { - var i; - for (i = _instances.length - 1; i >= 0; i--) { - if (_instances[i].scroll) { _instances[i].scroll(); } + for (var instance of _instances) { + if (instance.scroll) instance.scroll(); } }