native-document 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -985,20 +985,14 @@ var NativeDocument = (function (exports) {
985
985
  let value = attributes[attributeName];
986
986
  if(Validator.isString(value) && Validator.isFunction(value.resolveObservableTemplate)) {
987
987
  value = value.resolveObservableTemplate();
988
- if(Validator.isArray(value)) {
989
- const observables = value.filter(item => Validator.isObservable(item));
990
- value = Observable.computed(() => {
991
- return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
992
- }, observables);
988
+ if(Validator.isString(value)) {
989
+ element.setAttribute(attributeName, value);
990
+ continue;
993
991
  }
994
- }
995
- if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
996
- bindBooleanAttribute(element, attributeName, value);
997
- continue;
998
- }
999
- if(Validator.isObservable(value)) {
1000
- bindAttributeWithObservable(element, attributeName, value);
1001
- continue;
992
+ const observables = value.filter(item => Validator.isObservable(item));
993
+ value = Observable.computed(() => {
994
+ return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
995
+ }, observables);
1002
996
  }
1003
997
  if(attributeName === 'class' && Validator.isJson(value)) {
1004
998
  bindClassAttribute(element, value);
@@ -1008,6 +1002,14 @@ var NativeDocument = (function (exports) {
1008
1002
  bindStyleAttribute(element, value);
1009
1003
  continue;
1010
1004
  }
1005
+ if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1006
+ bindBooleanAttribute(element, attributeName, value);
1007
+ continue;
1008
+ }
1009
+ if(Validator.isObservable(value)) {
1010
+ bindAttributeWithObservable(element, attributeName, value);
1011
+ continue;
1012
+ }
1011
1013
  element.setAttribute(attributeName, value);
1012
1014
 
1013
1015
  }
@@ -1770,6 +1772,7 @@ var NativeDocument = (function (exports) {
1770
1772
 
1771
1773
  let cache = new Map();
1772
1774
  let lastNumberOfItems = 0;
1775
+ const isIndexRequired = callback.length >= 2;
1773
1776
 
1774
1777
  const keysCache = new WeakMap();
1775
1778
 
@@ -1789,7 +1792,7 @@ var NativeDocument = (function (exports) {
1789
1792
  };
1790
1793
 
1791
1794
  const updateIndexObservers = (items, startFrom = 0) => {
1792
- if(callback.length < 2) {
1795
+ if(!isIndexRequired) {
1793
1796
  return;
1794
1797
  }
1795
1798
  let index = startFrom;
@@ -1842,7 +1845,7 @@ var NativeDocument = (function (exports) {
1842
1845
  }
1843
1846
 
1844
1847
  try {
1845
- const indexObserver = callback.length >= 2 ? Observable(indexKey) : null;
1848
+ const indexObserver = isIndexRequired ? Observable(indexKey) : null;
1846
1849
  let child = ElementCreator.getChild(callback(item, indexObserver));
1847
1850
  cache.set(keyId, {
1848
1851
  keyId,