@clappr/player 0.12.4 → 0.12.6

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/clappr.js CHANGED
@@ -311,9 +311,9 @@
311
311
  'z-index': 1,
312
312
  'zoom': 1
313
313
  },
314
- fragmentRE = /^\s*<(\w+|!)[^>]*>/,
314
+ fragmentRE = /^\s*<(!|\w+(?!\w))[^>]*>/,
315
315
  singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
316
- tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
316
+ tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)(?![\w:])(?:"[^"]*"|'[^']*'|\/(?!>)|[^>"'\/])*)\/>/ig,
317
317
  rootNodeRE = /^(?:body|html)$/i,
318
318
  capitalRE = /([A-Z])/g,
319
319
  // special attributes that should be get/set via method calls
@@ -449,14 +449,18 @@
449
449
  // This function can be overridden in plugins for example to make
450
450
  // it compatible with browsers that don't support the DOM fully.
451
451
  zepto.fragment = function (html, name, properties) {
452
- var dom, nodes, container;
452
+ var dom, nodes, container, match;
453
453
 
454
454
  // A special case optimization for a single tag
455
- if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1));
455
+ if (match = singleTagRE.exec(html)) dom = $(document.createElement(match[1]));
456
456
  if (!dom) {
457
457
  if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>");
458
- if (name === undefined$1) name = fragmentRE.test(html) && RegExp.$1;
459
- if (!(name in containers)) name = '*';
458
+ // exec() yields null without a match; previously test() && RegExp.$1
459
+ // yielded false. Both fall through to name = '*' below.
460
+ if (name === undefined$1) name = (match = fragmentRE.exec(html)) && match[1];
461
+ // Own-property check: `in` walks the prototype (`toString`, etc.) and
462
+ // would make container a function — childNodes then throws TypeError.
463
+ if (!Object.prototype.hasOwnProperty.call(containers, name)) name = '*';
460
464
  container = containers[name];
461
465
  container.innerHTML = '' + html;
462
466
  dom = $.each(slice.call(container.childNodes), function () {
@@ -490,7 +494,7 @@
490
494
  // special cases).
491
495
  // This method can be overridden in plugins.
492
496
  zepto.init = function (selector, context) {
493
- var dom;
497
+ var dom, match;
494
498
  // If nothing given, return an empty Zepto collection
495
499
  if (!selector) return zepto.Z();
496
500
  // Optimize for string selectors
@@ -499,7 +503,7 @@
499
503
  // If it's a html fragment, create nodes from it
500
504
  // Note: In both Chrome 21 and Firefox 15, DOM error 12
501
505
  // is thrown if the fragment doesn't begin with <
502
- if (selector[0] == '<' && fragmentRE.test(selector)) dom = zepto.fragment(selector, RegExp.$1, context), selector = null;
506
+ if (selector[0] == '<' && (match = fragmentRE.exec(selector))) dom = zepto.fragment(selector, match[1], context), selector = null;
503
507
  // If there's a context, create a collection on that context first, and select
504
508
  // nodes from there
505
509
  else if (context !== undefined$1) return $(context).find(selector);
@@ -515,7 +519,7 @@
515
519
  // Wrap DOM nodes.
516
520
  else if (isObject(selector)) dom = [selector], selector = null;
517
521
  // If it's a html fragment, create nodes from it
518
- else if (fragmentRE.test(selector)) dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null;
522
+ else if (match = fragmentRE.exec(selector)) dom = zepto.fragment(selector.trim(), match[1], context), selector = null;
519
523
  // If there's a context, create a collection on that context first, and select
520
524
  // nodes from there
521
525
  else if (context !== undefined$1) return $(context).find(selector);
@@ -1203,7 +1207,6 @@
1203
1207
  document = window.document,
1204
1208
  key,
1205
1209
  name,
1206
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
1207
1210
  scriptTypeRE = /^(?:text|application)\/javascript/i,
1208
1211
  xmlTypeRE = /^(?:text|application)\/xml/i,
1209
1212
  jsonType = 'application/json',
@@ -1304,7 +1307,13 @@
1304
1307
  window[callbackName] = function () {
1305
1308
  responseData = arguments;
1306
1309
  };
1307
- script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName);
1310
+
1311
+ // Rewrite the last `=?` after `?` without a regex (avoids ReDoS on `.+`).
1312
+ // `i > q + 1` preserves the original `.+` requirement of at least one
1313
+ // character between `?` and `=?`.
1314
+ var q = options.url.indexOf('?'),
1315
+ i = q > -1 ? options.url.lastIndexOf('=?') : -1;
1316
+ script.src = i > q + 1 ? options.url.slice(0, i + 1) + callbackName + options.url.slice(i + 2) : options.url;
1308
1317
  document.head.appendChild(script);
1309
1318
  if (options.timeout > 0) abortTimeout = setTimeout(function () {
1310
1319
  abort('timeout');
@@ -1492,7 +1501,17 @@
1492
1501
  callback = options.success;
1493
1502
  if (parts.length > 1) options.url = parts[0], selector = parts[1];
1494
1503
  options.success = function (response) {
1495
- self.html(selector ? $('<div>').html(response.replace(rscript, "")).find(selector) : response);
1504
+ // With a selector, parse into a detached container and drop <script>
1505
+ // nodes structurally before finding matches. Without a selector the
1506
+ // response is inserted as-is (same asymmetry as jQuery). This is not
1507
+ // a sanitizer: event-handler attrs and javascript: URLs still pass.
1508
+ if (selector) {
1509
+ var container = $('<div>').html(response);
1510
+ container.find('script').remove();
1511
+ self.html(container.find(selector));
1512
+ } else {
1513
+ self.html(response);
1514
+ }
1496
1515
  callback && callback.apply(self, arguments);
1497
1516
  };
1498
1517
  $.ajax(options);
@@ -1753,7 +1772,9 @@
1753
1772
  isString = function (obj) {
1754
1773
  return typeof obj == 'string';
1755
1774
  },
1756
- handlers = {},
1775
+ // Prototype-less map: handlers['__proto__'] must never resolve to
1776
+ // Object.prototype (CodeQL js/prototype-polluting-assignment).
1777
+ handlers = Object.create(null),
1757
1778
  specialEvents = {},
1758
1779
  focusinSupported = 'onfocusin' in window,
1759
1780
  focus = {
@@ -1766,7 +1787,11 @@
1766
1787
  };
1767
1788
  specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents';
1768
1789
  function zid(element) {
1769
- return element._zid || (element._zid = _zid++);
1790
+ // Always a number — a forged element._zid string must not become a
1791
+ // dynamic key into handlers.
1792
+ var id = element._zid;
1793
+ if (typeof id !== 'number') element._zid = id = _zid++;
1794
+ return id;
1770
1795
  }
1771
1796
  function findHandlers(element, event, fn, selector) {
1772
1797
  event = parse(event);
@@ -1823,6 +1848,7 @@
1823
1848
  var id = zid(element);
1824
1849
  (events || '').split(/\s/).forEach(function (event) {
1825
1850
  findHandlers(element, event, fn, selector).forEach(function (handler) {
1851
+ // Keep delete (not splice) so handler.i remains a stable index for off().
1826
1852
  delete handlers[id][handler.i];
1827
1853
  if ('removeEventListener' in element) element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
1828
1854
  });
@@ -1982,9 +2008,12 @@
1982
2008
  return result;
1983
2009
  }
1984
2010
 
1985
- // shortcut methods for `.bind(event, fn)` for each event type
2011
+ // shortcut methods for `.bind(event, fn)` for each event type.
2012
+ // Skip names already defined (e.g. ajax $.fn.load) — this fork concatenates
2013
+ // ajax before event, unlike upstream's default `event ajax` order.
1986
2014
  ;
1987
2015
  ('focusin focusout focus blur load resize scroll unload click dblclick ' + 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave ' + 'change select keydown keypress keyup error').split(' ').forEach(function (event) {
2016
+ if ($.fn[event]) return;
1988
2017
  $.fn[event] = function (callback) {
1989
2018
  return 0 in arguments ? this.bind(event, callback) : this.trigger(event);
1990
2019
  };
@@ -6722,7 +6751,7 @@
6722
6751
  plugins: {},
6723
6752
  playbacks: []
6724
6753
  };
6725
- var currentVersion = "0.14.4";
6754
+ var currentVersion = "0.14.5";
6726
6755
  return /*#__PURE__*/function () {
6727
6756
  /**
6728
6757
  * builds the loader
@@ -7900,7 +7929,7 @@
7900
7929
  key: "supportedVersion",
7901
7930
  get: function get() {
7902
7931
  return {
7903
- min: "0.14.4"
7932
+ min: "0.14.5"
7904
7933
  };
7905
7934
  }
7906
7935
  }, {
@@ -8704,7 +8733,7 @@
8704
8733
  key: "supportedVersion",
8705
8734
  get: function get() {
8706
8735
  return {
8707
- min: "0.14.4"
8736
+ min: "0.14.5"
8708
8737
  };
8709
8738
  }
8710
8739
  }, {
@@ -8759,7 +8788,7 @@
8759
8788
  key: "supportedVersion",
8760
8789
  get: function get() {
8761
8790
  return {
8762
- min: "0.14.4"
8791
+ min: "0.14.5"
8763
8792
  };
8764
8793
  }
8765
8794
  }, {
@@ -8839,7 +8868,7 @@
8839
8868
  key: "supportedVersion",
8840
8869
  get: function get() {
8841
8870
  return {
8842
- min: "0.14.4"
8871
+ min: "0.14.5"
8843
8872
  };
8844
8873
  }
8845
8874
  }, {
@@ -8971,7 +9000,7 @@
8971
9000
  key: "supportedVersion",
8972
9001
  get: function get() {
8973
9002
  return {
8974
- min: "0.14.4"
9003
+ min: "0.14.5"
8975
9004
  };
8976
9005
  }
8977
9006
  }, {
@@ -9112,7 +9141,7 @@
9112
9141
  key: "supportedVersion",
9113
9142
  get: function get() {
9114
9143
  return {
9115
- min: "0.14.4"
9144
+ min: "0.14.5"
9116
9145
  };
9117
9146
  }
9118
9147
  }, {
@@ -9141,7 +9170,7 @@
9141
9170
  @type {string}
9142
9171
  @default
9143
9172
  */
9144
- var version$2 = "0.14.4";
9173
+ var version$2 = "0.14.5";
9145
9174
 
9146
9175
  // Built-in Plugins/Playbacks
9147
9176
 
@@ -9290,7 +9319,7 @@
9290
9319
  key: "supportedVersion",
9291
9320
  get: function get() {
9292
9321
  return {
9293
- min: "0.14.4"
9322
+ min: "0.14.5"
9294
9323
  };
9295
9324
  }
9296
9325
  }, {
@@ -9353,7 +9382,7 @@
9353
9382
  key: "supportedVersion",
9354
9383
  get: function get() {
9355
9384
  return {
9356
- min: "0.14.4"
9385
+ min: "0.14.5"
9357
9386
  };
9358
9387
  }
9359
9388
  }, {
@@ -9518,7 +9547,7 @@
9518
9547
  key: "supportedVersion",
9519
9548
  get: function get() {
9520
9549
  return {
9521
- min: "0.14.4"
9550
+ min: "0.14.5"
9522
9551
  };
9523
9552
  }
9524
9553
  }, {
@@ -9649,7 +9678,7 @@
9649
9678
  key: "supportedVersion",
9650
9679
  get: function get() {
9651
9680
  return {
9652
- min: "0.14.4"
9681
+ min: "0.14.5"
9653
9682
  };
9654
9683
  }
9655
9684
  }, {
@@ -9699,7 +9728,7 @@
9699
9728
  key: "supportedVersion",
9700
9729
  get: function get() {
9701
9730
  return {
9702
- min: "0.14.4"
9731
+ min: "0.14.5"
9703
9732
  };
9704
9733
  }
9705
9734
  }, {
@@ -9819,7 +9848,7 @@
9819
9848
  key: "supportedVersion",
9820
9849
  get: function get() {
9821
9850
  return {
9822
- min: "0.14.4"
9851
+ min: "0.14.5"
9823
9852
  };
9824
9853
  }
9825
9854
  }, {
@@ -9942,7 +9971,7 @@
9942
9971
  key: "supportedVersion",
9943
9972
  get: function get() {
9944
9973
  return {
9945
- min: "0.14.4"
9974
+ min: "0.14.5"
9946
9975
  };
9947
9976
  }
9948
9977
  }, {
@@ -10443,7 +10472,7 @@
10443
10472
  key: "supportedVersion",
10444
10473
  get: function get() {
10445
10474
  return {
10446
- min: "0.14.4"
10475
+ min: "0.14.5"
10447
10476
  };
10448
10477
  }
10449
10478
  }, {
@@ -11273,7 +11302,7 @@
11273
11302
  key: "supportedVersion",
11274
11303
  get: function get() {
11275
11304
  return {
11276
- min: "0.14.4"
11305
+ min: "0.14.5"
11277
11306
  };
11278
11307
  }
11279
11308
  }, {
@@ -11492,7 +11521,7 @@
11492
11521
  key: "supportedVersion",
11493
11522
  get: function get() {
11494
11523
  return {
11495
- min: "0.14.4"
11524
+ min: "0.14.5"
11496
11525
  };
11497
11526
  }
11498
11527
  }, {
@@ -11696,7 +11725,7 @@
11696
11725
  key: "supportedVersion",
11697
11726
  get: function get() {
11698
11727
  return {
11699
- min: "0.14.4"
11728
+ min: "0.14.5"
11700
11729
  };
11701
11730
  }
11702
11731
  }, {
@@ -11778,7 +11807,7 @@
11778
11807
  key: "supportedVersion",
11779
11808
  get: function get() {
11780
11809
  return {
11781
- min: "0.14.4"
11810
+ min: "0.14.5"
11782
11811
  };
11783
11812
  }
11784
11813
  }, {
@@ -11905,7 +11934,7 @@
11905
11934
  key: "supportedVersion",
11906
11935
  get: function get() {
11907
11936
  return {
11908
- min: "0.14.4"
11937
+ min: "0.14.5"
11909
11938
  };
11910
11939
  }
11911
11940
  }, {
@@ -11979,7 +12008,7 @@
11979
12008
  WaterMark: WaterMarkPlugin
11980
12009
  };
11981
12010
 
11982
- var version$1 = "0.12.4";
12011
+ var version$1 = "0.12.6";
11983
12012
  for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) {
11984
12013
  var plugin = _Object$values[_i];
11985
12014
  Loader.registerPlugin(plugin);
@@ -48737,7 +48766,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))} pos: ${this.timeline
48737
48766
  key: "supportedVersion",
48738
48767
  get: function get() {
48739
48768
  return {
48740
- min: "0.14.4"
48769
+ min: "0.14.5"
48741
48770
  };
48742
48771
  }
48743
48772
  }, {