@danielgindi/selectbox 1.0.103 → 1.0.104

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.
package/dist/lib.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 1.0.103
2
+ * @danielgindi/selectbox 1.0.104
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -10053,20 +10053,31 @@ var SelectBox = /*#__PURE__*/function () {
10053
10053
  p.sink.add(window, 'orientationchange', function () {return _this._resizeInput();});
10054
10054
 
10055
10055
  if (window.ResizeObserver !== undefined) {
10056
- p.resizeObserver = new ResizeObserver(function () {
10057
- p.resizeObserver.unobserve(p.el); // avoid ResizeObserver infinite loop
10058
-
10056
+ var lastSize = {
10057
+ borderBoxSize: {
10058
+ blockSize: null,
10059
+ inlineSize: null
10060
+ },
10061
+ contentBoxSize: {
10062
+ blockSize: null,
10063
+ inlineSize: null
10064
+ }
10065
+ };
10066
+ p.resizeObserver = new ResizeObserver(function (entries) {
10059
10067
  if (_this[DestroyedSymbol])
10060
10068
  return;
10061
10069
 
10062
- _this._resizeInput();
10070
+ var entry = entries[0];
10071
+ if (!lastSize ||
10072
+ entry.borderBoxSize[0].blockSize !== lastSize.borderBoxSize.blockSize ||
10073
+ entry.borderBoxSize[0].inlineSize !== lastSize.borderBoxSize.inlineSize ||
10074
+ entry.contentBoxSize[0].blockSize !== lastSize.contentBoxSize.blockSize ||
10075
+ entry.contentBoxSize[0].inlineSize !== lastSize.contentBoxSize.inlineSize) {
10076
+ _this._resizeInput();
10077
+ }
10063
10078
 
10064
- // avoid ResizeObserver infinite loop - only renew the observation after the new layout has settled
10065
- requestAnimationFrame(function () {
10066
- if (_this[DestroyedSymbol])
10067
- return;
10068
- p.resizeObserver.observe(p.el);
10069
- });
10079
+ lastSize.borderBoxSize = entry.borderBoxSize[0];
10080
+ lastSize.contentBoxSize = entry.contentBoxSize[0];
10070
10081
  });
10071
10082
  p.resizeObserver.observe(p.el);
10072
10083
  }