native-document 1.0.89 → 1.0.91

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.
@@ -334,10 +334,10 @@ var NativeComponents = (function (exports) {
334
334
 
335
335
  ObservableChecker.prototype.__$isObservableChecker = true;
336
336
 
337
- ObservableChecker.prototype.subscribe = function(callback, context = null) {
338
- const unSubscribe = this.observable.subscribe((value, _, __) => {
339
- callback && callback(this.checker(value), _, __, context);
340
- }, context);
337
+ ObservableChecker.prototype.subscribe = function(callback) {
338
+ const unSubscribe = this.observable.subscribe((value) => {
339
+ callback && callback(this.checker(value));
340
+ });
341
341
  this.unSubscriptions.push(unSubscribe);
342
342
  return unSubscribe;
343
343
  };
@@ -369,8 +369,8 @@ var NativeComponents = (function (exports) {
369
369
 
370
370
  ObservableWhen.prototype.__$isObservableWhen = true;
371
371
 
372
- ObservableWhen.prototype.subscribe = function(callback, context = null) {
373
- return this.$observer.on(this.$target, callback, context);
372
+ ObservableWhen.prototype.subscribe = function(callback) {
373
+ return this.$observer.on(this.$target, callback);
374
374
  };
375
375
 
376
376
  ObservableWhen.prototype.val = function() {
@@ -508,7 +508,7 @@ var NativeComponents = (function (exports) {
508
508
  };
509
509
 
510
510
  ObservableItem.prototype.triggerFirstListener = function(operations) {
511
- this.$firstListener.callback(this.$currentValue, this.$previousValue, operations || {}, this.$firstListener.context);
511
+ this.$firstListener(this.$currentValue, this.$previousValue, operations || {});
512
512
  };
513
513
 
514
514
  ObservableItem.prototype.triggerListeners = function(operations) {
@@ -518,25 +518,24 @@ var NativeComponents = (function (exports) {
518
518
 
519
519
  operations = operations || DEFAULT_OPERATIONS;
520
520
  for(let i = 0, length = $listeners.length; i < length; i++) {
521
- const listener = $listeners[i];
522
- listener.callback($currentValue, $previousValue, operations, listener.context);
521
+ $listeners[i]($currentValue, $previousValue, operations);
523
522
  }
524
523
  };
525
524
 
526
525
  const handleWatcherCallback = function(callbacks, value) {
527
- if(callbacks.callback) {
528
- callbacks.callback(value, null, null, callbacks.context);
526
+ if(typeof callbacks === "function") {
527
+ callbacks(value);
529
528
  return;
530
529
  }
531
530
  if (callbacks.set) {
532
531
  callbacks.set(value);
533
532
  return;
534
533
  }
535
- callbacks.forEach(callback => {
536
- callback.callback
537
- ? callback.callback(value, null, null, callback.context)
538
- : callback.set(value);
539
- });
534
+ for(let i = 0, length = callbacks.length; i < length; i++) {
535
+ const callback = callbacks[i];
536
+ callback.set ? callback.set(value) : callback(value);
537
+
538
+ }
540
539
  };
541
540
 
542
541
  ObservableItem.prototype.triggerWatchers = function() {
@@ -548,12 +547,12 @@ var NativeComponents = (function (exports) {
548
547
  const $previousValue = this.$previousValue;
549
548
  const $currentValue = this.$currentValue;
550
549
 
551
- if($watchers.has($currentValue)) {
552
- const $currentValueCallbacks = $watchers.get($currentValue);
550
+ const $currentValueCallbacks = $watchers.get($currentValue);
551
+ const $previousValueCallbacks = $watchers.get($previousValue);
552
+ if($currentValueCallbacks) {
553
553
  handleWatcherCallback($currentValueCallbacks, true);
554
554
  }
555
- if($watchers.has($previousValue)) {
556
- const $previousValueCallbacks = $watchers.get($previousValue);
555
+ if($previousValueCallbacks) {
557
556
  handleWatcherCallback($previousValueCallbacks, false);
558
557
  }
559
558
  };
@@ -565,7 +564,7 @@ var NativeComponents = (function (exports) {
565
564
 
566
565
  ObservableItem.prototype.triggerWatchersAndFirstListener = function(operations) {
567
566
  this.triggerWatchers();
568
- this.triggerListeners(operations);
567
+ this.triggerFirstListener(operations);
569
568
  };
570
569
 
571
570
  ObservableItem.prototype.assocTrigger = function() {
@@ -658,11 +657,10 @@ var NativeComponents = (function (exports) {
658
657
  /**
659
658
  *
660
659
  * @param {Function} callback
661
- * @param {?Object} context
662
660
  * @param {any} target
663
661
  * @returns {(function(): void)}
664
662
  */
665
- ObservableItem.prototype.subscribe = function(callback, context = null, target = null) {
663
+ ObservableItem.prototype.subscribe = function(callback, target = null) {
666
664
  this.$listeners = this.$listeners ?? [];
667
665
  if (this.$isCleanedUp) {
668
666
  DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
@@ -672,34 +670,31 @@ var NativeComponents = (function (exports) {
672
670
  throw new NativeDocumentError('Callback must be a function');
673
671
  }
674
672
 
675
-
676
- const finalCallback = { callback, context };
677
- this.$listeners.push(finalCallback);
673
+ this.$listeners.push(callback);
678
674
  this.assocTrigger();
679
675
  return () => {
680
- this.unsubscribe(finalCallback);
676
+ this.unsubscribe(callback);
681
677
  this.assocTrigger();
682
678
  };
683
679
  };
684
680
 
685
- ObservableItem.prototype.on = function(value, callback, context = null) {
681
+ ObservableItem.prototype.on = function(value, callback) {
686
682
  this.$watchers = this.$watchers ?? new Map();
687
683
 
688
684
  let watchValueList = this.$watchers.get(value);
689
- const finalCallback = { callback, context };
690
685
 
691
686
  if(!watchValueList) {
692
- this.$watchers.set(value, finalCallback);
687
+ this.$watchers.set(value, callback);
693
688
  } else if(!Validator.isArray(watchValueList)) {
694
- watchValueList = [watchValueList, finalCallback];
689
+ watchValueList = [watchValueList, callback];
695
690
  this.$watchers.set(value, watchValueList);
696
691
  } else {
697
- watchValueList.push(finalCallback);
692
+ watchValueList.push(callback);
698
693
  }
699
694
 
700
695
  this.assocTrigger();
701
696
  return () => {
702
- const index = watchValueList.indexOf(finalCallback);
697
+ const index = watchValueList.indexOf(callback);
703
698
  watchValueList?.splice(index, 1);
704
699
  if(watchValueList.size === 1) {
705
700
  this.$watchers.set(value, watchValueList[0]);
@@ -754,12 +749,6 @@ var NativeComponents = (function (exports) {
754
749
  return new ObservableWhen(this, value);
755
750
  };
756
751
 
757
- ObservableItem.prototype.toString = function() {
758
- if(!this.$memoryId) {
759
- MemoryManager.register(this);
760
- }
761
- return '{{#ObItem::(' +this.$memoryId+ ')}}';
762
- };
763
752
  ObservableItem.prototype.equals = function(other) {
764
753
  if(Validator.isObservable(other)) {
765
754
  return this.$currentValue === other.$currentValue;
@@ -1431,29 +1420,22 @@ var NativeComponents = (function (exports) {
1431
1420
  setInterval(() => MemoryManager.cleanObservables(threshold), interval);
1432
1421
  };
1433
1422
 
1434
- const handleElementAttributeClass = function(shouldAdd, _, __, context) {
1435
- context.element.classes.toggle(context.className, shouldAdd);
1436
- };
1437
1423
  /**
1438
1424
  *
1439
1425
  * @param {HTMLElement} element
1440
1426
  * @param {Object} data
1441
1427
  */
1442
1428
  function bindClassAttribute(element, data) {
1443
- const classNames = Object.keys(data);
1444
-
1445
- for(let i = 0, length = classNames.length; i < length; i++) {
1446
- const className = classNames[i];
1429
+ for(const className in data) {
1447
1430
  const value = data[className];
1448
1431
  if(value.__$isObservable) {
1449
1432
  element.classes.toggle(className, value.val());
1450
- value.subscribe(handleElementAttributeClass, { element, className });
1451
- // value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
1433
+ value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
1452
1434
  continue;
1453
1435
  }
1454
1436
  if(value.__$isObservableWhen) {
1455
1437
  element.classes.toggle(className, value.isMath());
1456
- value.subscribe(handleElementAttributeClass, { element, className });
1438
+ value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
1457
1439
  continue;
1458
1440
  }
1459
1441
  if(value.$hydrate) {
@@ -1462,6 +1444,7 @@ var NativeComponents = (function (exports) {
1462
1444
  }
1463
1445
  element.classes.toggle(className, value);
1464
1446
  }
1447
+ data = null;
1465
1448
  }
1466
1449
 
1467
1450
  /**
@@ -1470,9 +1453,7 @@ var NativeComponents = (function (exports) {
1470
1453
  * @param {Object} data
1471
1454
  */
1472
1455
  function bindStyleAttribute(element, data) {
1473
- const keys = Object.keys(data);
1474
- for(let i = 0, length = keys.length; i < length; i++) {
1475
- const styleName = keys[i];
1456
+ for(const styleName in data) {
1476
1457
  const value = data[styleName];
1477
1458
  if(value.__$isObservable) {
1478
1459
  element.style[styleName] = value.val();
@@ -1492,8 +1473,7 @@ var NativeComponents = (function (exports) {
1492
1473
  function bindBooleanAttribute(element, attributeName, value) {
1493
1474
  const isObservable = value.__$isObservable;
1494
1475
  const defaultValue = isObservable? value.val() : value;
1495
- const isBoolValue = typeof defaultValue === "boolean";
1496
- if(isBoolValue) {
1476
+ if(Validator.isBoolean(defaultValue)) {
1497
1477
  element[attributeName] = defaultValue;
1498
1478
  }
1499
1479
  else {
@@ -1501,13 +1481,13 @@ var NativeComponents = (function (exports) {
1501
1481
  }
1502
1482
  if(isObservable) {
1503
1483
  if(attributeName === 'checked') {
1504
- if(isBoolValue) {
1484
+ if(typeof defaultValue === 'boolean') {
1505
1485
  element.addEventListener('input', () => value.set(element[attributeName]));
1506
- value.subscribe((newValue) => element[attributeName] = newValue);
1507
- return;
1508
1486
  }
1509
- element.addEventListener('input', () => value.set(element.value));
1510
- value.subscribe((newValue) => element[attributeName] = (newValue === element.value));
1487
+ else {
1488
+ element.addEventListener('input', () => value.set(element.value));
1489
+ }
1490
+ value.subscribe((newValue) => element[attributeName] = newValue);
1511
1491
  return;
1512
1492
  }
1513
1493
  value.subscribe((newValue) => element[attributeName] = (newValue === element.value));
@@ -1522,14 +1502,14 @@ var NativeComponents = (function (exports) {
1522
1502
  * @param {Observable} value
1523
1503
  */
1524
1504
  function bindAttributeWithObservable(element, attributeName, value) {
1505
+ const applyValue = attributeName === 'value' ? (newValue) => element.value = newValue : (newValue) => element.setAttribute(attributeName, newValue);
1506
+ value.subscribe(applyValue);
1507
+
1525
1508
  if(attributeName === 'value') {
1526
- value.subscribe((newValue) => element.value = newValue);
1527
1509
  element.value = value.val();
1528
1510
  element.addEventListener('input', () => value.set(element.value));
1529
1511
  return;
1530
1512
  }
1531
-
1532
- value.subscribe((newValue) => element.setAttribute(attributeName, newValue));
1533
1513
  element.setAttribute(attributeName, value.val());
1534
1514
  }
1535
1515
 
@@ -1539,10 +1519,8 @@ var NativeComponents = (function (exports) {
1539
1519
  * @param {Object} attributes
1540
1520
  */
1541
1521
  function AttributesWrapper(element, attributes) {
1542
- const attributeNames = Object.keys(attributes);
1543
1522
 
1544
- for(let i = 0, length = attributeNames.length; i < length; i++) {
1545
- const originalAttributeName = attributeNames[i];
1523
+ for(const originalAttributeName in attributes) {
1546
1524
  const attributeName = originalAttributeName.toLowerCase();
1547
1525
  let value = attributes[originalAttributeName];
1548
1526
  if(value == null) {
@@ -1567,10 +1545,6 @@ var NativeComponents = (function (exports) {
1567
1545
  continue;
1568
1546
  }
1569
1547
 
1570
- if(attributeName === 'value') {
1571
- element.value = value;
1572
- continue;
1573
- }
1574
1548
  element.setAttribute(attributeName, value);
1575
1549
  }
1576
1550
  return element;
@@ -113,10 +113,10 @@ var NativeDocument = (function (exports) {
113
113
 
114
114
  ObservableChecker.prototype.__$isObservableChecker = true;
115
115
 
116
- ObservableChecker.prototype.subscribe = function(callback, context = null) {
117
- const unSubscribe = this.observable.subscribe((value, _, __) => {
118
- callback && callback(this.checker(value), _, __, context);
119
- }, context);
116
+ ObservableChecker.prototype.subscribe = function(callback) {
117
+ const unSubscribe = this.observable.subscribe((value) => {
118
+ callback && callback(this.checker(value));
119
+ });
120
120
  this.unSubscriptions.push(unSubscribe);
121
121
  return unSubscribe;
122
122
  };
@@ -228,8 +228,8 @@ var NativeDocument = (function (exports) {
228
228
 
229
229
  ObservableWhen.prototype.__$isObservableWhen = true;
230
230
 
231
- ObservableWhen.prototype.subscribe = function(callback, context = null) {
232
- return this.$observer.on(this.$target, callback, context);
231
+ ObservableWhen.prototype.subscribe = function(callback) {
232
+ return this.$observer.on(this.$target, callback);
233
233
  };
234
234
 
235
235
  ObservableWhen.prototype.val = function() {
@@ -365,7 +365,7 @@ var NativeDocument = (function (exports) {
365
365
  };
366
366
 
367
367
  ObservableItem.prototype.triggerFirstListener = function(operations) {
368
- this.$firstListener.callback(this.$currentValue, this.$previousValue, operations || {}, this.$firstListener.context);
368
+ this.$firstListener(this.$currentValue, this.$previousValue, operations || {});
369
369
  };
370
370
 
371
371
  ObservableItem.prototype.triggerListeners = function(operations) {
@@ -375,25 +375,24 @@ var NativeDocument = (function (exports) {
375
375
 
376
376
  operations = operations || DEFAULT_OPERATIONS;
377
377
  for(let i = 0, length = $listeners.length; i < length; i++) {
378
- const listener = $listeners[i];
379
- listener.callback($currentValue, $previousValue, operations, listener.context);
378
+ $listeners[i]($currentValue, $previousValue, operations);
380
379
  }
381
380
  };
382
381
 
383
382
  const handleWatcherCallback = function(callbacks, value) {
384
- if(callbacks.callback) {
385
- callbacks.callback(value, null, null, callbacks.context);
383
+ if(typeof callbacks === "function") {
384
+ callbacks(value);
386
385
  return;
387
386
  }
388
387
  if (callbacks.set) {
389
388
  callbacks.set(value);
390
389
  return;
391
390
  }
392
- callbacks.forEach(callback => {
393
- callback.callback
394
- ? callback.callback(value, null, null, callback.context)
395
- : callback.set(value);
396
- });
391
+ for(let i = 0, length = callbacks.length; i < length; i++) {
392
+ const callback = callbacks[i];
393
+ callback.set ? callback.set(value) : callback(value);
394
+
395
+ }
397
396
  };
398
397
 
399
398
  ObservableItem.prototype.triggerWatchers = function() {
@@ -405,12 +404,12 @@ var NativeDocument = (function (exports) {
405
404
  const $previousValue = this.$previousValue;
406
405
  const $currentValue = this.$currentValue;
407
406
 
408
- if($watchers.has($currentValue)) {
409
- const $currentValueCallbacks = $watchers.get($currentValue);
407
+ const $currentValueCallbacks = $watchers.get($currentValue);
408
+ const $previousValueCallbacks = $watchers.get($previousValue);
409
+ if($currentValueCallbacks) {
410
410
  handleWatcherCallback($currentValueCallbacks, true);
411
411
  }
412
- if($watchers.has($previousValue)) {
413
- const $previousValueCallbacks = $watchers.get($previousValue);
412
+ if($previousValueCallbacks) {
414
413
  handleWatcherCallback($previousValueCallbacks, false);
415
414
  }
416
415
  };
@@ -422,7 +421,7 @@ var NativeDocument = (function (exports) {
422
421
 
423
422
  ObservableItem.prototype.triggerWatchersAndFirstListener = function(operations) {
424
423
  this.triggerWatchers();
425
- this.triggerListeners(operations);
424
+ this.triggerFirstListener(operations);
426
425
  };
427
426
 
428
427
  ObservableItem.prototype.assocTrigger = function() {
@@ -521,11 +520,10 @@ var NativeDocument = (function (exports) {
521
520
  /**
522
521
  *
523
522
  * @param {Function} callback
524
- * @param {?Object} context
525
523
  * @param {any} target
526
524
  * @returns {(function(): void)}
527
525
  */
528
- ObservableItem.prototype.subscribe = function(callback, context = null, target = null) {
526
+ ObservableItem.prototype.subscribe = function(callback, target = null) {
529
527
  this.$listeners = this.$listeners ?? [];
530
528
  if (this.$isCleanedUp) {
531
529
  DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
@@ -535,15 +533,13 @@ var NativeDocument = (function (exports) {
535
533
  throw new NativeDocumentError('Callback must be a function');
536
534
  }
537
535
 
538
-
539
- const finalCallback = { callback, context };
540
- this.$listeners.push(finalCallback);
536
+ this.$listeners.push(callback);
541
537
  this.assocTrigger();
542
538
  {
543
539
  PluginsManager.emit('ObservableSubscribe', this, target);
544
540
  }
545
541
  return () => {
546
- this.unsubscribe(finalCallback);
542
+ this.unsubscribe(callback);
547
543
  this.assocTrigger();
548
544
  {
549
545
  PluginsManager.emit('ObservableUnsubscribe', this);
@@ -551,24 +547,23 @@ var NativeDocument = (function (exports) {
551
547
  };
552
548
  };
553
549
 
554
- ObservableItem.prototype.on = function(value, callback, context = null) {
550
+ ObservableItem.prototype.on = function(value, callback) {
555
551
  this.$watchers = this.$watchers ?? new Map();
556
552
 
557
553
  let watchValueList = this.$watchers.get(value);
558
- const finalCallback = { callback, context };
559
554
 
560
555
  if(!watchValueList) {
561
- this.$watchers.set(value, finalCallback);
556
+ this.$watchers.set(value, callback);
562
557
  } else if(!Validator.isArray(watchValueList)) {
563
- watchValueList = [watchValueList, finalCallback];
558
+ watchValueList = [watchValueList, callback];
564
559
  this.$watchers.set(value, watchValueList);
565
560
  } else {
566
- watchValueList.push(finalCallback);
561
+ watchValueList.push(callback);
567
562
  }
568
563
 
569
564
  this.assocTrigger();
570
565
  return () => {
571
- const index = watchValueList.indexOf(finalCallback);
566
+ const index = watchValueList.indexOf(callback);
572
567
  watchValueList?.splice(index, 1);
573
568
  if(watchValueList.size === 1) {
574
569
  this.$watchers.set(value, watchValueList[0]);
@@ -623,12 +618,6 @@ var NativeDocument = (function (exports) {
623
618
  return new ObservableWhen(this, value);
624
619
  };
625
620
 
626
- ObservableItem.prototype.toString = function() {
627
- if(!this.$memoryId) {
628
- MemoryManager.register(this);
629
- }
630
- return '{{#ObItem::(' +this.$memoryId+ ')}}';
631
- };
632
621
  ObservableItem.prototype.equals = function(other) {
633
622
  if(Validator.isObservable(other)) {
634
623
  return this.$currentValue === other.$currentValue;
@@ -1354,29 +1343,22 @@ var NativeDocument = (function (exports) {
1354
1343
  setInterval(() => MemoryManager.cleanObservables(threshold), interval);
1355
1344
  };
1356
1345
 
1357
- const handleElementAttributeClass = function(shouldAdd, _, __, context) {
1358
- context.element.classes.toggle(context.className, shouldAdd);
1359
- };
1360
1346
  /**
1361
1347
  *
1362
1348
  * @param {HTMLElement} element
1363
1349
  * @param {Object} data
1364
1350
  */
1365
1351
  function bindClassAttribute(element, data) {
1366
- const classNames = Object.keys(data);
1367
-
1368
- for(let i = 0, length = classNames.length; i < length; i++) {
1369
- const className = classNames[i];
1352
+ for(const className in data) {
1370
1353
  const value = data[className];
1371
1354
  if(value.__$isObservable) {
1372
1355
  element.classes.toggle(className, value.val());
1373
- value.subscribe(handleElementAttributeClass, { element, className });
1374
- // value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
1356
+ value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
1375
1357
  continue;
1376
1358
  }
1377
1359
  if(value.__$isObservableWhen) {
1378
1360
  element.classes.toggle(className, value.isMath());
1379
- value.subscribe(handleElementAttributeClass, { element, className });
1361
+ value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
1380
1362
  continue;
1381
1363
  }
1382
1364
  if(value.$hydrate) {
@@ -1385,6 +1367,7 @@ var NativeDocument = (function (exports) {
1385
1367
  }
1386
1368
  element.classes.toggle(className, value);
1387
1369
  }
1370
+ data = null;
1388
1371
  }
1389
1372
 
1390
1373
  /**
@@ -1393,9 +1376,7 @@ var NativeDocument = (function (exports) {
1393
1376
  * @param {Object} data
1394
1377
  */
1395
1378
  function bindStyleAttribute(element, data) {
1396
- const keys = Object.keys(data);
1397
- for(let i = 0, length = keys.length; i < length; i++) {
1398
- const styleName = keys[i];
1379
+ for(const styleName in data) {
1399
1380
  const value = data[styleName];
1400
1381
  if(value.__$isObservable) {
1401
1382
  element.style[styleName] = value.val();
@@ -1415,8 +1396,7 @@ var NativeDocument = (function (exports) {
1415
1396
  function bindBooleanAttribute(element, attributeName, value) {
1416
1397
  const isObservable = value.__$isObservable;
1417
1398
  const defaultValue = isObservable? value.val() : value;
1418
- const isBoolValue = typeof defaultValue === "boolean";
1419
- if(isBoolValue) {
1399
+ if(Validator.isBoolean(defaultValue)) {
1420
1400
  element[attributeName] = defaultValue;
1421
1401
  }
1422
1402
  else {
@@ -1424,13 +1404,13 @@ var NativeDocument = (function (exports) {
1424
1404
  }
1425
1405
  if(isObservable) {
1426
1406
  if(attributeName === 'checked') {
1427
- if(isBoolValue) {
1407
+ if(typeof defaultValue === 'boolean') {
1428
1408
  element.addEventListener('input', () => value.set(element[attributeName]));
1429
- value.subscribe((newValue) => element[attributeName] = newValue);
1430
- return;
1431
1409
  }
1432
- element.addEventListener('input', () => value.set(element.value));
1433
- value.subscribe((newValue) => element[attributeName] = (newValue === element.value));
1410
+ else {
1411
+ element.addEventListener('input', () => value.set(element.value));
1412
+ }
1413
+ value.subscribe((newValue) => element[attributeName] = newValue);
1434
1414
  return;
1435
1415
  }
1436
1416
  value.subscribe((newValue) => element[attributeName] = (newValue === element.value));
@@ -1445,14 +1425,14 @@ var NativeDocument = (function (exports) {
1445
1425
  * @param {Observable} value
1446
1426
  */
1447
1427
  function bindAttributeWithObservable(element, attributeName, value) {
1428
+ const applyValue = attributeName === 'value' ? (newValue) => element.value = newValue : (newValue) => element.setAttribute(attributeName, newValue);
1429
+ value.subscribe(applyValue);
1430
+
1448
1431
  if(attributeName === 'value') {
1449
- value.subscribe((newValue) => element.value = newValue);
1450
1432
  element.value = value.val();
1451
1433
  element.addEventListener('input', () => value.set(element.value));
1452
1434
  return;
1453
1435
  }
1454
-
1455
- value.subscribe((newValue) => element.setAttribute(attributeName, newValue));
1456
1436
  element.setAttribute(attributeName, value.val());
1457
1437
  }
1458
1438
 
@@ -1463,13 +1443,9 @@ var NativeDocument = (function (exports) {
1463
1443
  */
1464
1444
  function AttributesWrapper(element, attributes) {
1465
1445
 
1466
- {
1467
- Validator.validateAttributes(attributes);
1468
- }
1469
- const attributeNames = Object.keys(attributes);
1446
+ Validator.validateAttributes(attributes);
1470
1447
 
1471
- for(let i = 0, length = attributeNames.length; i < length; i++) {
1472
- const originalAttributeName = attributeNames[i];
1448
+ for(const originalAttributeName in attributes) {
1473
1449
  const attributeName = originalAttributeName.toLowerCase();
1474
1450
  let value = attributes[originalAttributeName];
1475
1451
  if(value == null) {
@@ -1494,10 +1470,6 @@ var NativeDocument = (function (exports) {
1494
1470
  continue;
1495
1471
  }
1496
1472
 
1497
- if(attributeName === 'value') {
1498
- element.value = value;
1499
- continue;
1500
- }
1501
1473
  element.setAttribute(attributeName, value);
1502
1474
  }
1503
1475
  return element;