@pendo/agent 2.334.1 → 2.335.0

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/dom.esm.js CHANGED
@@ -7523,7 +7523,7 @@ function applyMatrix2dRect(matrix2d, rect) {
7523
7523
  return transformedRect;
7524
7524
  }
7525
7525
 
7526
- var VERSION = '2.334.1_';
7526
+ var VERSION = '2.335.0_';
7527
7527
 
7528
7528
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7529
7529
 
@@ -10200,7 +10200,7 @@ function trimSurrogate(s) {
10200
10200
  var ElementGetter = /** @class */ (function () {
10201
10201
  function ElementGetter(cssSelector) {
10202
10202
  this.listeners = {}; // callbacks to be called when an event of type occurs
10203
- this.events = []; // event types this element listens for
10203
+ this.events = []; // [{ type, capture }] events this element listens for
10204
10204
  this.cssSelector = cssSelector;
10205
10205
  }
10206
10206
  ElementGetter.prototype.get = function () {
@@ -10216,8 +10216,9 @@ var ElementGetter = /** @class */ (function () {
10216
10216
  if (!el) {
10217
10217
  return undefined;
10218
10218
  }
10219
- _.each(this.events, function (evtType) {
10220
- el.addEventListener(evtType, function (e) { return _this.onEvent(e); });
10219
+ _.each(this.events, function (_a) {
10220
+ var type = _a.type, capture = _a.capture;
10221
+ el.addEventListener(type, function (e) { return _this.onEvent(e); }, capture);
10221
10222
  });
10222
10223
  this.elRef = new WeakRef(el);
10223
10224
  return el;
@@ -10227,13 +10228,15 @@ var ElementGetter = /** @class */ (function () {
10227
10228
  // XXX not sure about size limit
10228
10229
  return getTextValue(this.get(), limit);
10229
10230
  };
10230
- ElementGetter.prototype.addEventListener = function (event, callback) {
10231
+ ElementGetter.prototype.addEventListener = function (event, callback, capture) {
10231
10232
  var _this = this;
10233
+ if (capture === void 0) { capture = false; }
10232
10234
  var el = this.get();
10233
- if (this.events.indexOf(event) < 0) {
10234
- this.events.push(event);
10235
+ var alreadyRegistered = _.find(this.events, function (e) { return e.type === event && e.capture === capture; });
10236
+ if (!alreadyRegistered) {
10237
+ this.events.push({ type: event, capture: capture });
10235
10238
  if (el) {
10236
- el.addEventListener(event, function (e) { return _this.onEvent(e); });
10239
+ el.addEventListener(event, function (e) { return _this.onEvent(e); }, capture);
10237
10240
  }
10238
10241
  }
10239
10242
  this.listeners[event] = this.listeners[event] || [];
@@ -10247,7 +10250,10 @@ var ElementGetter = /** @class */ (function () {
10247
10250
  var _this = this;
10248
10251
  if (el === void 0) { el = this.get(); }
10249
10252
  if (el) {
10250
- _.each(this.events, function (evtType) { return el.removeEventListener(evtType, _this.onEvent); });
10253
+ _.each(this.events, function (_a) {
10254
+ var type = _a.type, capture = _a.capture;
10255
+ return el.removeEventListener(type, _this.onEvent, capture);
10256
+ });
10251
10257
  }
10252
10258
  };
10253
10259
  return ElementGetter;