postscribe 2.0.4 → 2.0.8

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file postscribe
3
3
  * @description Asynchronously write javascript, even with document.write.
4
- * @version v2.0.4
4
+ * @version v2.0.8
5
5
  * @see {@link https://krux.github.io/postscribe}
6
6
  * @license MIT
7
7
  * @author Derek Brans
@@ -20,41 +20,41 @@
20
20
  return /******/ (function(modules) { // webpackBootstrap
21
21
  /******/ // The module cache
22
22
  /******/ var installedModules = {};
23
-
23
+ /******/
24
24
  /******/ // The require function
25
25
  /******/ function __webpack_require__(moduleId) {
26
-
26
+ /******/
27
27
  /******/ // Check if module is in cache
28
28
  /******/ if(installedModules[moduleId])
29
29
  /******/ return installedModules[moduleId].exports;
30
-
30
+ /******/
31
31
  /******/ // Create a new module (and put it into the cache)
32
32
  /******/ var module = installedModules[moduleId] = {
33
33
  /******/ exports: {},
34
34
  /******/ id: moduleId,
35
35
  /******/ loaded: false
36
36
  /******/ };
37
-
37
+ /******/
38
38
  /******/ // Execute the module function
39
39
  /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
40
-
40
+ /******/
41
41
  /******/ // Flag the module as loaded
42
42
  /******/ module.loaded = true;
43
-
43
+ /******/
44
44
  /******/ // Return the exports of the module
45
45
  /******/ return module.exports;
46
46
  /******/ }
47
-
48
-
47
+ /******/
48
+ /******/
49
49
  /******/ // expose the modules object (__webpack_modules__)
50
50
  /******/ __webpack_require__.m = modules;
51
-
51
+ /******/
52
52
  /******/ // expose the module cache
53
53
  /******/ __webpack_require__.c = installedModules;
54
-
54
+ /******/
55
55
  /******/ // __webpack_public_path__
56
56
  /******/ __webpack_require__.p = "";
57
-
57
+ /******/
58
58
  /******/ // Load entry module and return exports
59
59
  /******/ return __webpack_require__(0);
60
60
  /******/ })
@@ -64,13 +64,13 @@ return /******/ (function(modules) { // webpackBootstrap
64
64
  /***/ function(module, exports, __webpack_require__) {
65
65
 
66
66
  'use strict';
67
-
67
+
68
68
  var _postscribe = __webpack_require__(1);
69
-
69
+
70
70
  var _postscribe2 = _interopRequireDefault(_postscribe);
71
-
71
+
72
72
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
73
-
73
+
74
74
  module.exports = _postscribe2['default'];
75
75
 
76
76
  /***/ },
@@ -78,30 +78,30 @@ return /******/ (function(modules) { // webpackBootstrap
78
78
  /***/ function(module, exports, __webpack_require__) {
79
79
 
80
80
  'use strict';
81
-
81
+
82
82
  exports.__esModule = true;
83
-
83
+
84
84
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
85
-
85
+
86
86
  exports['default'] = postscribe;
87
-
87
+
88
88
  var _writeStream = __webpack_require__(2);
89
-
89
+
90
90
  var _writeStream2 = _interopRequireDefault(_writeStream);
91
-
91
+
92
92
  var _utils = __webpack_require__(4);
93
-
93
+
94
94
  var utils = _interopRequireWildcard(_utils);
95
-
95
+
96
96
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
97
-
97
+
98
98
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
99
-
99
+
100
100
  /**
101
101
  * A function that intentionally does nothing.
102
102
  */
103
103
  function doNothing() {}
104
-
104
+
105
105
  /**
106
106
  * Available options and defaults.
107
107
  *
@@ -112,32 +112,32 @@ return /******/ (function(modules) { // webpackBootstrap
112
112
  * Called when an async script has loaded.
113
113
  */
114
114
  afterAsync: doNothing,
115
-
115
+
116
116
  /**
117
117
  * Called immediately before removing from the write queue.
118
118
  */
119
119
  afterDequeue: doNothing,
120
-
120
+
121
121
  /**
122
122
  * Called sync after a stream's first thread release.
123
123
  */
124
124
  afterStreamStart: doNothing,
125
-
125
+
126
126
  /**
127
127
  * Called after writing buffered document.write calls.
128
128
  */
129
129
  afterWrite: doNothing,
130
-
130
+
131
131
  /**
132
132
  * Allows disabling the autoFix feature of prescribe
133
133
  */
134
134
  autoFix: true,
135
-
135
+
136
136
  /**
137
137
  * Called immediately before adding to the write queue.
138
138
  */
139
139
  beforeEnqueue: doNothing,
140
-
140
+
141
141
  /**
142
142
  * Called before writing a token.
143
143
  *
@@ -146,7 +146,7 @@ return /******/ (function(modules) { // webpackBootstrap
146
146
  beforeWriteToken: function beforeWriteToken(tok) {
147
147
  return tok;
148
148
  },
149
-
149
+
150
150
  /**
151
151
  * Called before writing buffered document.write calls.
152
152
  *
@@ -155,69 +155,67 @@ return /******/ (function(modules) { // webpackBootstrap
155
155
  beforeWrite: function beforeWrite(str) {
156
156
  return str;
157
157
  },
158
-
158
+
159
159
  /**
160
160
  * Called when evaluation is finished.
161
161
  */
162
162
  done: doNothing,
163
-
163
+
164
164
  /**
165
165
  * Called when a write results in an error.
166
166
  *
167
167
  * @param {Error} e The error
168
168
  */
169
169
  error: function error(e) {
170
- throw e;
170
+ throw new Error(e.msg);
171
171
  },
172
-
173
-
172
+
173
+
174
174
  /**
175
175
  * Whether to let scripts w/ async attribute set fall out of the queue.
176
176
  */
177
177
  releaseAsync: false
178
178
  };
179
-
179
+
180
180
  var nextId = 0;
181
181
  var queue = [];
182
182
  var active = null;
183
-
183
+
184
184
  function nextStream() {
185
185
  var args = queue.shift();
186
186
  if (args) {
187
187
  var options = utils.last(args);
188
-
188
+
189
189
  options.afterDequeue();
190
190
  args.stream = runStream.apply(undefined, args);
191
191
  options.afterStreamStart();
192
192
  }
193
193
  }
194
-
194
+
195
195
  function runStream(el, html, options) {
196
- active = new
197
- // Expose internal classes.
198
- _writeStream2['default'](el, options);
199
-
196
+ active = new _writeStream2['default'](el, options);
197
+
200
198
  // Identify this stream.
201
199
  active.id = nextId++;
202
200
  active.name = options.name || active.id;
203
201
  postscribe.streams[active.name] = active;
204
-
202
+
205
203
  // Override document.write.
206
204
  var doc = el.ownerDocument;
207
-
205
+
208
206
  var stash = {
209
207
  close: doc.close,
210
208
  open: doc.open,
211
209
  write: doc.write,
212
210
  writeln: doc.writeln
213
211
  };
214
-
212
+
215
213
  function _write(str) {
216
214
  str = options.beforeWrite(str);
217
215
  active.write(str);
218
216
  options.afterWrite(str);
219
217
  }
220
-
218
+
221
219
  _extends(doc, {
222
220
  close: doNothing,
223
221
  open: doNothing,
@@ -225,44 +223,44 @@ return /******/ (function(modules) { // webpackBootstrap
225
223
  for (var _len = arguments.length, str = Array(_len), _key = 0; _key < _len; _key++) {
226
224
  str[_key] = arguments[_key];
227
225
  }
228
-
226
+
229
227
  return _write(str.join(''));
230
228
  },
231
229
  writeln: function writeln() {
232
230
  for (var _len2 = arguments.length, str = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
233
231
  str[_key2] = arguments[_key2];
234
232
  }
235
-
233
+
236
234
  return _write(str.join('') + '\n');
237
235
  }
238
236
  });
239
-
237
+
240
238
  // Override window.onerror
241
239
  var oldOnError = active.win.onerror || doNothing;
242
-
240
+
243
241
  // This works together with the try/catch around WriteStream::insertScript
244
242
  // In modern browsers, exceptions in tag scripts go directly to top level
245
243
  active.win.onerror = function (msg, url, line) {
246
244
  options.error({ msg: msg + ' - ' + url + ': ' + line });
247
245
  oldOnError.apply(active.win, [msg, url, line]);
248
246
  };
249
-
247
+
250
248
  // Write to the stream
251
249
  active.write(html, function () {
252
250
  // restore document.write
253
251
  _extends(doc, stash);
254
-
252
+
255
253
  // restore window.onerror
256
254
  active.win.onerror = oldOnError;
257
-
255
+
258
256
  options.done();
259
257
  active = null;
260
258
  nextStream();
261
259
  });
262
-
260
+
263
261
  return active;
264
262
  }
265
-
263
+
266
264
  function postscribe(el, html, options) {
267
265
  if (utils.isFunction(options)) {
268
266
  options = { done: options };
@@ -272,18 +270,18 @@ return /******/ (function(modules) { // webpackBootstrap
272
270
  nextId = 0;
273
271
  return;
274
272
  }
275
-
273
+
276
274
  options = utils.defaults(options, OPTIONS);
277
-
275
+
278
276
  // id selector
279
277
  if (/^#/.test(el)) {
280
278
  el = window.document.getElementById(el.substr(1));
281
279
  } else {
282
280
  el = el.jquery ? el[0] : el;
283
281
  }
284
-
282
+
285
283
  var args = [el, html, options];
286
-
284
+
287
285
  el.postscribe = {
288
286
  cancel: function cancel() {
289
287
  if (args.stream) {
@@ -293,22 +291,24 @@ return /******/ (function(modules) { // webpackBootstrap
293
291
  }
294
292
  }
295
293
  };
296
-
294
+
297
295
  options.beforeEnqueue(args);
298
296
  queue.push(args);
299
-
297
+
300
298
  if (!active) {
301
299
  nextStream();
302
300
  }
303
-
301
+
304
302
  return el.postscribe;
305
303
  }
306
-
304
+
307
305
  _extends(postscribe, {
308
306
  // Streams by name.
309
307
  streams: {},
310
308
  // Queue of streams.
311
- queue: queue, WriteStream: _writeStream2['default']
309
+ queue: queue,
310
+ // Expose internal classes.
311
+ WriteStream: _writeStream2['default']
312
312
  });
313
313
 
314
314
  /***/ },
@@ -316,49 +316,49 @@ return /******/ (function(modules) { // webpackBootstrap
316
316
  /***/ function(module, exports, __webpack_require__) {
317
317
 
318
318
  'use strict';
319
-
319
+
320
320
  exports.__esModule = true;
321
-
321
+
322
322
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
323
-
323
+
324
324
  var _prescribe = __webpack_require__(3);
325
-
325
+
326
326
  var _prescribe2 = _interopRequireDefault(_prescribe);
327
-
327
+
328
328
  var _utils = __webpack_require__(4);
329
-
329
+
330
330
  var utils = _interopRequireWildcard(_utils);
331
-
331
+
332
332
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
333
-
333
+
334
334
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
335
-
335
+
336
336
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
337
-
337
+
338
338
  /**
339
339
  * Turn on to debug how each chunk affected the DOM.
340
340
  * @type {boolean}
341
341
  */
342
342
  var DEBUG_CHUNK = false;
343
-
343
+
344
344
  /**
345
345
  * Prefix for data attributes on DOM elements.
346
346
  * @type {string}
347
347
  */
348
348
  var BASEATTR = 'data-ps-';
349
-
349
+
350
350
  /**
351
351
  * ID for the style proxy
352
352
  * @type {string}
353
353
  */
354
354
  var PROXY_STYLE = 'ps-style';
355
-
355
+
356
356
  /**
357
357
  * ID for the script proxy
358
358
  * @type {string}
359
359
  */
360
360
  var PROXY_SCRIPT = 'ps-script';
361
-
361
+
362
362
  /**
363
363
  * Get data attributes
364
364
  *
@@ -368,13 +368,13 @@ return /******/ (function(modules) { // webpackBootstrap
368
368
  */
369
369
  function getData(el, name) {
370
370
  var attr = BASEATTR + name;
371
-
371
+
372
372
  var val = el.getAttribute(attr);
373
-
373
+
374
374
  // IE 8 returns a number if it's a number
375
375
  return !utils.existy(val) ? val : String(val);
376
376
  }
377
-
377
+
378
378
  /**
379
379
  * Set data attributes
380
380
  *
@@ -383,17 +383,17 @@ return /******/ (function(modules) { // webpackBootstrap
383
383
  * @param {null|*} value The attribute value.
384
384
  */
385
385
  function setData(el, name) {
386
- var value = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
387
-
386
+ var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
387
+
388
388
  var attr = BASEATTR + name;
389
-
389
+
390
390
  if (utils.existy(value) && value !== '') {
391
391
  el.setAttribute(attr, value);
392
392
  } else {
393
393
  el.removeAttribute(attr);
394
394
  }
395
395
  }
396
-
396
+
397
397
  /**
398
398
  * Stream static html to an element, where "static html" denotes "html
399
399
  * without scripts".
@@ -417,7 +417,7 @@ return /******/ (function(modules) { // webpackBootstrap
417
417
  * `data-id` attribute into each start tag in `staticHtml`.
418
418
  *
419
419
  */
420
-
420
+
421
421
  var WriteStream = function () {
422
422
  /**
423
423
  * Constructor.
@@ -425,52 +425,51 @@ return /******/ (function(modules) { // webpackBootstrap
425
425
  * @param {Object} root The root element
426
426
  * @param {?Object} options The options
427
427
  */
428
-
429
428
  function WriteStream(root) {
430
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
431
-
429
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
430
+
432
431
  _classCallCheck(this, WriteStream);
433
-
432
+
434
433
  this.root = root;
435
434
  this.options = options;
436
435
  this.doc = root.ownerDocument;
437
436
  this.win = this.doc.defaultView || this.doc.parentWindow;
438
437
  this.parser = new _prescribe2['default']('', { autoFix: options.autoFix });
439
-
438
+
440
439
  // Actual elements by id.
441
440
  this.actuals = [root];
442
-
441
+
443
442
  // Embodies the "structure" of what's been written so far,
444
443
  // devoid of attributes.
445
444
  this.proxyHistory = '';
446
-
445
+
447
446
  // Create a proxy of the root element.
448
447
  this.proxyRoot = this.doc.createElement(root.nodeName);
449
-
448
+
450
449
  this.scriptStack = [];
451
450
  this.writeQueue = [];
452
-
451
+
453
452
  setData(this.proxyRoot, 'proxyof', 0);
454
453
  }
455
-
454
+
456
455
  /**
457
456
  * Writes the given strings.
458
457
  *
459
458
  * @param {...String} str The strings to write
460
459
  */
461
-
462
-
460
+
461
+
463
462
  WriteStream.prototype.write = function write() {
464
463
  var _writeQueue;
465
-
464
+
466
465
  (_writeQueue = this.writeQueue).push.apply(_writeQueue, arguments);
467
-
466
+
468
467
  // Process writes
469
468
  // When new script gets pushed or pending this will stop
470
469
  // because new writeQueue gets pushed
471
470
  while (!this.deferredRemote && this.writeQueue.length) {
472
471
  var arg = this.writeQueue.shift();
473
-
472
+
474
473
  if (utils.isFunction(arg)) {
475
474
  this._callFunction(arg);
476
475
  } else {
@@ -478,94 +477,94 @@ return /******/ (function(modules) { // webpackBootstrap
478
477
  }
479
478
  }
480
479
  };
481
-
480
+
482
481
  /**
483
482
  * Calls the given function.
484
483
  *
485
484
  * @param {Function} fn The function to call
486
485
  * @private
487
486
  */
488
-
489
-
487
+
488
+
490
489
  WriteStream.prototype._callFunction = function _callFunction(fn) {
491
490
  var tok = { type: 'function', value: fn.name || fn.toString() };
492
491
  this._onScriptStart(tok);
493
492
  fn.call(this.win, this.doc);
494
493
  this._onScriptDone(tok);
495
494
  };
496
-
495
+
497
496
  /**
498
497
  * The write implementation
499
498
  *
500
499
  * @param {String} html The HTML to write.
501
500
  * @private
502
501
  */
503
-
504
-
502
+
503
+
505
504
  WriteStream.prototype._writeImpl = function _writeImpl(html) {
506
505
  this.parser.append(html);
507
-
506
+
508
507
  var tok = void 0;
509
508
  var script = void 0;
510
509
  var style = void 0;
511
510
  var tokens = [];
512
-
511
+
513
512
  // stop if we see a script token
514
513
  while ((tok = this.parser.readToken()) && !(script = utils.isScript(tok)) && !(style = utils.isStyle(tok))) {
515
514
  tok = this.options.beforeWriteToken(tok);
516
-
515
+
517
516
  if (tok) {
518
517
  tokens.push(tok);
519
518
  }
520
519
  }
521
-
520
+
522
521
  if (tokens.length > 0) {
523
522
  this._writeStaticTokens(tokens);
524
523
  }
525
-
524
+
526
525
  if (script) {
527
526
  this._handleScriptToken(tok);
528
527
  }
529
-
528
+
530
529
  if (style) {
531
530
  this._handleStyleToken(tok);
532
531
  }
533
532
  };
534
-
533
+
535
534
  /**
536
- * Write a contiguous non-script tokens (a chunk)
535
+ * Write contiguous non-script tokens (a chunk)
537
536
  *
538
537
  * @param {Array<Object>} tokens The tokens
539
538
  * @returns {{tokens, raw, actual, proxy}|null}
540
539
  * @private
541
540
  */
542
-
543
-
541
+
542
+
544
543
  WriteStream.prototype._writeStaticTokens = function _writeStaticTokens(tokens) {
545
544
  var chunk = this._buildChunk(tokens);
546
-
545
+
547
546
  if (!chunk.actual) {
548
547
  // e.g., no tokens, or a noscript that got ignored
549
548
  return null;
550
549
  }
551
-
550
+
552
551
  chunk.html = this.proxyHistory + chunk.actual;
553
552
  this.proxyHistory += chunk.proxy;
554
553
  this.proxyRoot.innerHTML = chunk.html;
555
-
554
+
556
555
  if (DEBUG_CHUNK) {
557
556
  chunk.proxyInnerHTML = this.proxyRoot.innerHTML;
558
557
  }
559
-
558
+
560
559
  this._walkChunk();
561
-
560
+
562
561
  if (DEBUG_CHUNK) {
563
562
  chunk.actualInnerHTML = this.root.innerHTML;
564
563
  }
565
-
564
+
566
565
  return chunk;
567
566
  };
568
-
567
+
569
568
  /**
570
569
  * Build a chunk.
571
570
  *
@@ -573,36 +572,36 @@ return /******/ (function(modules) { // webpackBootstrap
573
572
  * @returns {{tokens: *, raw: string, actual: string, proxy: string}}
574
573
  * @private
575
574
  */
576
-
577
-
575
+
576
+
578
577
  WriteStream.prototype._buildChunk = function _buildChunk(tokens) {
579
578
  var nextId = this.actuals.length;
580
-
579
+
581
580
  // The raw html of this chunk.
582
581
  var raw = [];
583
-
582
+
584
583
  // The html to create the nodes in the tokens (with id's injected).
585
584
  var actual = [];
586
-
585
+
587
586
  // Html that can later be used to proxy the nodes in the tokens.
588
587
  var proxy = [];
589
-
588
+
590
589
  var len = tokens.length;
591
590
  for (var i = 0; i < len; i++) {
592
591
  var tok = tokens[i];
593
592
  var tokenRaw = tok.toString();
594
-
593
+
595
594
  raw.push(tokenRaw);
596
-
595
+
597
596
  if (tok.attrs) {
598
597
  // tok.attrs <==> startTag or atomicTag or cursor
599
598
  // Ignore noscript tags. They are atomic, so we don't have to worry about children.
600
599
  if (!/^noscript$/i.test(tok.tagName)) {
601
600
  var id = nextId++;
602
-
601
+
603
602
  // Actual: inject id attribute: replace '>' at end of start tag with id attribute + '>'
604
603
  actual.push(tokenRaw.replace(/(\/?>)/, ' ' + BASEATTR + 'id=' + id + ' $1'));
605
-
604
+
606
605
  // Don't proxy scripts: they have no bearing on DOM structure.
607
606
  if (tok.attrs.id !== PROXY_SCRIPT && tok.attrs.id !== PROXY_STYLE) {
608
607
  // Proxy: strip all attributes and inject proxyof attribute
@@ -615,12 +614,12 @@ return /******/ (function(modules) { // webpackBootstrap
615
614
  // Visit any other type of token
616
615
  // Actual: append.
617
616
  actual.push(tokenRaw);
618
-
617
+
619
618
  // Proxy: append endTags. Ignore everything else.
620
619
  proxy.push(tok.type === 'endTag' ? tokenRaw : '');
621
620
  }
622
621
  }
623
-
622
+
624
623
  return {
625
624
  tokens: tokens,
626
625
  raw: raw.join(''),
@@ -628,24 +627,23 @@ return /******/ (function(modules) { // webpackBootstrap
628
627
  proxy: proxy.join('')
629
628
  };
630
629
  };
631
-
630
+
632
631
  /**
633
632
  * Walk the chunks.
634
633
  *
635
634
  * @private
636
635
  */
637
-
638
-
636
+
637
+
639
638
  WriteStream.prototype._walkChunk = function _walkChunk() {
640
639
  var node = void 0;
641
640
  var stack = [this.proxyRoot];
642
-
641
+
643
642
  // use shift/unshift so that children are walked in document order
644
-
645
643
  while (utils.existy(node = stack.shift())) {
646
644
  var isElement = node.nodeType === 1;
647
645
  var isProxy = isElement && getData(node, 'proxyof');
648
-
646
+
649
647
  // Ignore proxies
650
648
  if (!isProxy) {
651
649
  if (isElement) {
@@ -653,7 +651,7 @@ return /******/ (function(modules) { // webpackBootstrap
653
651
  this.actuals[getData(node, 'id')] = node;
654
652
  setData(node, 'id');
655
653
  }
656
-
654
+
657
655
  // Is node's parent a proxy?
658
656
  var parentIsProxyOf = node.parentNode && getData(node.parentNode, 'proxyof');
659
657
  if (parentIsProxyOf) {
@@ -661,37 +659,37 @@ return /******/ (function(modules) { // webpackBootstrap
661
659
  this.actuals[parentIsProxyOf].appendChild(node);
662
660
  }
663
661
  }
664
-
662
+
665
663
  // prepend childNodes to stack
666
664
  stack.unshift.apply(stack, utils.toArray(node.childNodes));
667
665
  }
668
666
  };
669
-
667
+
670
668
  /**
671
669
  * Handles Script tokens
672
670
  *
673
671
  * @param {Object} tok The token
674
672
  */
675
-
676
-
673
+
674
+
677
675
  WriteStream.prototype._handleScriptToken = function _handleScriptToken(tok) {
678
676
  var _this = this;
679
-
677
+
680
678
  var remainder = this.parser.clear();
681
-
679
+
682
680
  if (remainder) {
683
681
  // Write remainder immediately behind this script.
684
682
  this.writeQueue.unshift(remainder);
685
683
  }
686
-
684
+
687
685
  tok.src = tok.attrs.src || tok.attrs.SRC;
688
-
686
+
689
687
  tok = this.options.beforeWriteToken(tok);
690
688
  if (!tok) {
691
689
  // User has removed this token
692
690
  return;
693
691
  }
694
-
692
+
695
693
  if (tok.src && this.scriptStack.length) {
696
694
  // Defer this script until scriptStack is empty.
697
695
  // Assumption 1: This script will not start executing until
@@ -700,54 +698,54 @@ return /******/ (function(modules) { // webpackBootstrap
700
698
  } else {
701
699
  this._onScriptStart(tok);
702
700
  }
703
-
701
+
704
702
  // Put the script node in the DOM.
705
703
  this._writeScriptToken(tok, function () {
706
704
  _this._onScriptDone(tok);
707
705
  });
708
706
  };
709
-
707
+
710
708
  /**
711
709
  * Handles style tokens
712
710
  *
713
711
  * @param {Object} tok The token
714
712
  */
715
-
716
-
713
+
714
+
717
715
  WriteStream.prototype._handleStyleToken = function _handleStyleToken(tok) {
718
716
  var remainder = this.parser.clear();
719
-
717
+
720
718
  if (remainder) {
721
719
  // Write remainder immediately behind this style.
722
720
  this.writeQueue.unshift(remainder);
723
721
  }
724
-
722
+
725
723
  tok.type = tok.attrs.type || tok.attrs.TYPE || 'text/css';
726
-
724
+
727
725
  tok = this.options.beforeWriteToken(tok);
728
-
726
+
729
727
  if (tok) {
730
728
  // Put the style node in the DOM.
731
729
  this._writeStyleToken(tok);
732
730
  }
733
-
731
+
734
732
  if (remainder) {
735
733
  this.write();
736
734
  }
737
735
  };
738
-
736
+
739
737
  /**
740
738
  * Build a style and insert it into the DOM.
741
739
  *
742
740
  * @param {Object} tok The token
743
741
  */
744
-
745
-
742
+
743
+
746
744
  WriteStream.prototype._writeStyleToken = function _writeStyleToken(tok) {
747
745
  var el = this._buildStyle(tok);
748
-
749
- this._insertStyle(el);
750
-
746
+
747
+ this._insertCursor(el, PROXY_STYLE);
748
+
751
749
  // Set content
752
750
  if (tok.content) {
753
751
  if (el.styleSheet && !el.sheet) {
@@ -757,112 +755,83 @@ return /******/ (function(modules) { // webpackBootstrap
757
755
  }
758
756
  }
759
757
  };
760
-
758
+
761
759
  /**
762
760
  * Build a style element from an atomic style token.
763
761
  *
764
762
  * @param {Object} tok The token
765
763
  * @returns {Element}
766
764
  */
767
-
768
-
765
+
766
+
769
767
  WriteStream.prototype._buildStyle = function _buildStyle(tok) {
770
768
  var el = this.doc.createElement(tok.tagName);
771
-
769
+
772
770
  el.setAttribute('type', tok.type);
773
-
771
+
774
772
  // Set attributes
775
773
  utils.eachKey(tok.attrs, function (name, value) {
776
774
  el.setAttribute(name, value);
777
775
  });
778
-
776
+
779
777
  return el;
780
778
  };
781
-
779
+
782
780
  /**
783
781
  * Append a span to the stream. That span will act as a cursor
784
- * (i.e. insertion point) for the style.
785
- *
786
- * @param {String} id The ID of the span.
787
- * @private
788
- */
789
-
790
-
791
- WriteStream.prototype._insertSpan = function _insertSpan(id) {
792
- this._writeImpl('<span id="' + id + '"/>');
793
-
794
- // Grab that span from the DOM.
795
- return this.doc.getElementById(id);
796
- };
797
-
798
- /**
799
- * Insert style into DOM where it would naturally be written.
800
- *
801
- * @param {Object} el The element
802
- */
803
-
804
-
805
- WriteStream.prototype._insertStyle = function _insertStyle(el) {
806
- var cursor = this._insertSpan(PROXY_STYLE);
807
-
808
- // Replace cursor with style.
809
- if (cursor) {
810
- cursor.parentNode.replaceChild(el, cursor);
811
- }
812
- };
813
-
814
- /**
815
- * Insert script into DOM where it would naturally be written.
782
+ * (i.e. insertion point) for the element.
816
783
  *
817
784
  * @param {Object} el The element
785
+ * @param {string} which The type of proxy element
818
786
  */
819
-
820
-
821
- WriteStream.prototype._insertScript = function _insertScript(el) {
822
- var cursor = this._insertSpan(PROXY_SCRIPT);
823
-
824
- // Replace cursor with script.
787
+
788
+
789
+ WriteStream.prototype._insertCursor = function _insertCursor(el, which) {
790
+ this._writeImpl('<span id="' + which + '"/>');
791
+
792
+ var cursor = this.doc.getElementById(which);
793
+
825
794
  if (cursor) {
826
795
  cursor.parentNode.replaceChild(el, cursor);
827
796
  }
828
797
  };
829
-
798
+
830
799
  /**
831
800
  * Called when a script is started.
832
801
  *
833
802
  * @param {Object} tok The token
834
803
  * @private
835
804
  */
836
-
837
-
805
+
806
+
838
807
  WriteStream.prototype._onScriptStart = function _onScriptStart(tok) {
839
808
  tok.outerWrites = this.writeQueue;
840
809
  this.writeQueue = [];
841
810
  this.scriptStack.unshift(tok);
842
811
  };
843
-
812
+
844
813
  /**
845
814
  * Called when a script is done.
846
815
  *
847
816
  * @param {Object} tok The token
848
817
  * @private
849
818
  */
850
-
851
-
819
+
820
+
852
821
  WriteStream.prototype._onScriptDone = function _onScriptDone(tok) {
853
822
  // Pop script and check nesting.
854
823
  if (tok !== this.scriptStack[0]) {
855
- this.options.error({ message: 'Bad script nesting or script finished twice' });
824
+ this.options.error({ msg: 'Bad script nesting or script finished twice' });
856
825
  return;
857
826
  }
858
-
827
+
859
828
  this.scriptStack.shift();
860
-
829
+
861
830
  // Append outer writes to queue and process them.
862
831
  this.write.apply(this, tok.outerWrites);
863
-
832
+
864
833
  // Check for pending remote
865
-
834
+
866
835
  // Assumption 2: if remote_script1 writes remote_script2 then
867
836
  // the we notice remote_script1 finishes before remote_script2 starts.
868
837
  // I think this is equivalent to assumption 1
@@ -871,7 +840,7 @@ return /******/ (function(modules) { // webpackBootstrap
871
840
  this.deferredRemote = null;
872
841
  }
873
842
  };
874
-
843
+
875
844
  /**
876
845
  * Build a script and insert it into the DOM.
877
846
  * Done is called once script has executed.
@@ -879,13 +848,13 @@ return /******/ (function(modules) { // webpackBootstrap
879
848
  * @param {Object} tok The token
880
849
  * @param {Function} done The callback when complete
881
850
  */
882
-
883
-
851
+
852
+
884
853
  WriteStream.prototype._writeScriptToken = function _writeScriptToken(tok, done) {
885
854
  var el = this._buildScript(tok);
886
855
  var asyncRelease = this._shouldRelease(el);
887
856
  var afterAsync = this.options.afterAsync;
888
-
857
+
889
858
  if (tok.src) {
890
859
  // Fix for attribute "SRC" (capitalized). IE does not recognize it.
891
860
  el.src = tok.src;
@@ -894,9 +863,9 @@ return /******/ (function(modules) { // webpackBootstrap
894
863
  afterAsync();
895
864
  } : afterAsync);
896
865
  }
897
-
866
+
898
867
  try {
899
- this._insertScript(el);
868
+ this._insertCursor(el, PROXY_SCRIPT);
900
869
  if (!el.src || asyncRelease) {
901
870
  done();
902
871
  }
@@ -905,31 +874,31 @@ return /******/ (function(modules) { // webpackBootstrap
905
874
  done();
906
875
  }
907
876
  };
908
-
877
+
909
878
  /**
910
879
  * Build a script element from an atomic script token.
911
880
  *
912
881
  * @param {Object} tok The token
913
882
  * @returns {Element}
914
883
  */
915
-
916
-
884
+
885
+
917
886
  WriteStream.prototype._buildScript = function _buildScript(tok) {
918
887
  var el = this.doc.createElement(tok.tagName);
919
-
888
+
920
889
  // Set attributes
921
890
  utils.eachKey(tok.attrs, function (name, value) {
922
891
  el.setAttribute(name, value);
923
892
  });
924
-
893
+
925
894
  // Set content
926
895
  if (tok.content) {
927
896
  el.text = tok.content;
928
897
  }
929
-
898
+
930
899
  return el;
931
900
  };
932
-
901
+
933
902
  /**
934
903
  * Setup the script load handler on an element.
935
904
  *
@@ -937,44 +906,72 @@ return /******/ (function(modules) { // webpackBootstrap
937
906
  * @param {Function} done The callback
938
907
  * @private
939
908
  */
940
-
941
-
909
+
910
+
942
911
  WriteStream.prototype._scriptLoadHandler = function _scriptLoadHandler(el, done) {
943
912
  function cleanup() {
944
913
  el = el.onload = el.onreadystatechange = el.onerror = null;
945
914
  }
946
-
915
+
947
916
  var error = this.options.error;
948
-
917
+
949
918
  function success() {
950
919
  cleanup();
951
- done();
920
+ if (done != null) {
921
+ done();
922
+ }
923
+ done = null;
952
924
  }
953
-
925
+
954
926
  function failure(err) {
955
927
  cleanup();
956
928
  error(err);
957
- done();
929
+ if (done != null) {
930
+ done();
931
+ }
932
+ done = null;
958
933
  }
959
-
960
- // Set handlers
934
+
935
+ function reattachEventListener(el, evt) {
936
+ var handler = el['on' + evt];
937
+ if (handler != null) {
938
+ el['_on' + evt] = handler;
939
+ }
940
+ }
941
+
942
+ reattachEventListener(el, 'load');
943
+ reattachEventListener(el, 'error');
944
+
961
945
  _extends(el, {
962
946
  onload: function onload() {
963
- return success();
947
+ if (el._onload) {
948
+ try {
949
+ el._onload.apply(this, Array.prototype.slice.call(arguments, 0));
950
+ } catch (err) {
951
+ failure({ msg: 'onload handler failed ' + err + ' @ ' + el.src });
952
+ }
953
+ }
954
+ success();
955
+ },
956
+ onerror: function onerror() {
957
+ if (el._onerror) {
958
+ try {
959
+ el._onerror.apply(this, Array.prototype.slice.call(arguments, 0));
960
+ } catch (err) {
961
+ failure({ msg: 'onerror handler failed ' + err + ' @ ' + el.src });
962
+ return;
963
+ }
964
+ }
965
+ failure({ msg: 'remote script failed ' + el.src });
964
966
  },
965
-
966
967
  onreadystatechange: function onreadystatechange() {
967
968
  if (/^(loaded|complete)$/.test(el.readyState)) {
968
969
  success();
969
970
  }
970
- },
971
-
972
- onerror: function onerror() {
973
- return failure({ message: 'remote script failed ' + el.src });
974
971
  }
975
972
  });
976
973
  };
977
-
974
+
978
975
  /**
979
976
  * Determines whether to release.
980
977
  *
@@ -982,16 +979,16 @@ return /******/ (function(modules) { // webpackBootstrap
982
979
  * @returns {boolean}
983
980
  * @private
984
981
  */
985
-
986
-
982
+
983
+
987
984
  WriteStream.prototype._shouldRelease = function _shouldRelease(el) {
988
985
  var isScript = /^script$/i.test(el.nodeName);
989
986
  return !isScript || !!(this.options.releaseAsync && el.src && el.hasAttribute('async'));
990
987
  };
991
-
988
+
992
989
  return WriteStream;
993
990
  }();
994
-
991
+
995
992
  exports['default'] = WriteStream;
996
993
 
997
994
  /***/ },
@@ -1001,7 +998,7 @@ return /******/ (function(modules) { // webpackBootstrap
1001
998
  /**
1002
999
  * @file prescribe
1003
1000
  * @description Tiny, forgiving HTML parser
1004
- * @version v1.0.8
1001
+ * @version vundefined
1005
1002
  * @see {@link https://github.com/krux/prescribe/}
1006
1003
  * @license MIT
1007
1004
  * @author Derek Brans
@@ -1020,41 +1017,41 @@ return /******/ (function(modules) { // webpackBootstrap
1020
1017
  return /******/ (function(modules) { // webpackBootstrap
1021
1018
  /******/ // The module cache
1022
1019
  /******/ var installedModules = {};
1023
-
1020
+
1024
1021
  /******/ // The require function
1025
1022
  /******/ function __webpack_require__(moduleId) {
1026
-
1023
+
1027
1024
  /******/ // Check if module is in cache
1028
1025
  /******/ if(installedModules[moduleId])
1029
1026
  /******/ return installedModules[moduleId].exports;
1030
-
1027
+
1031
1028
  /******/ // Create a new module (and put it into the cache)
1032
1029
  /******/ var module = installedModules[moduleId] = {
1033
1030
  /******/ exports: {},
1034
1031
  /******/ id: moduleId,
1035
1032
  /******/ loaded: false
1036
1033
  /******/ };
1037
-
1034
+
1038
1035
  /******/ // Execute the module function
1039
1036
  /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1040
-
1037
+
1041
1038
  /******/ // Flag the module as loaded
1042
1039
  /******/ module.loaded = true;
1043
-
1040
+
1044
1041
  /******/ // Return the exports of the module
1045
1042
  /******/ return module.exports;
1046
1043
  /******/ }
1047
-
1048
-
1044
+
1045
+
1049
1046
  /******/ // expose the modules object (__webpack_modules__)
1050
1047
  /******/ __webpack_require__.m = modules;
1051
-
1048
+
1052
1049
  /******/ // expose the module cache
1053
1050
  /******/ __webpack_require__.c = installedModules;
1054
-
1051
+
1055
1052
  /******/ // __webpack_public_path__
1056
1053
  /******/ __webpack_require__.p = "";
1057
-
1054
+
1058
1055
  /******/ // Load entry module and return exports
1059
1056
  /******/ return __webpack_require__(0);
1060
1057
  /******/ })
@@ -1062,51 +1059,51 @@ return /******/ (function(modules) { // webpackBootstrap
1062
1059
  /******/ ([
1063
1060
  /* 0 */
1064
1061
  /***/ function(module, exports, __webpack_require__) {
1065
-
1062
+
1066
1063
  'use strict';
1067
-
1064
+
1068
1065
  var _HtmlParser = __webpack_require__(1);
1069
-
1066
+
1070
1067
  var _HtmlParser2 = _interopRequireDefault(_HtmlParser);
1071
-
1068
+
1072
1069
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1073
-
1070
+
1074
1071
  module.exports = _HtmlParser2['default'];
1075
-
1072
+
1076
1073
  /***/ },
1077
1074
  /* 1 */
1078
1075
  /***/ function(module, exports, __webpack_require__) {
1079
-
1076
+
1080
1077
  'use strict';
1081
-
1078
+
1082
1079
  exports.__esModule = true;
1083
-
1080
+
1084
1081
  var _supports = __webpack_require__(2);
1085
-
1082
+
1086
1083
  var supports = _interopRequireWildcard(_supports);
1087
-
1084
+
1088
1085
  var _streamReaders = __webpack_require__(3);
1089
-
1086
+
1090
1087
  var streamReaders = _interopRequireWildcard(_streamReaders);
1091
-
1088
+
1092
1089
  var _fixedReadTokenFactory = __webpack_require__(6);
1093
-
1090
+
1094
1091
  var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory);
1095
-
1092
+
1096
1093
  var _utils = __webpack_require__(5);
1097
-
1094
+
1098
1095
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1099
-
1096
+
1100
1097
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
1101
-
1098
+
1102
1099
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1103
-
1100
+
1104
1101
  /**
1105
1102
  * Detection regular expressions.
1106
1103
  *
1107
1104
  * Order of detection matters: detection of one can only
1108
1105
  * succeed if detection of previous didn't
1109
-
1106
+
1110
1107
  * @type {Object}
1111
1108
  */
1112
1109
  var detect = {
@@ -1116,12 +1113,12 @@ return /******/ (function(modules) { // webpackBootstrap
1116
1113
  startTag: /^</,
1117
1114
  chars: /^[^<]/
1118
1115
  };
1119
-
1116
+
1120
1117
  /**
1121
1118
  * HtmlParser provides the capability to parse HTML and return tokens
1122
1119
  * representing the tags and content.
1123
1120
  */
1124
-
1121
+
1125
1122
  var HtmlParser = function () {
1126
1123
  /**
1127
1124
  * Constructor.
@@ -1130,20 +1127,19 @@ return /******/ (function(modules) { // webpackBootstrap
1130
1127
  * @param {Object} options The options
1131
1128
  * @param {boolean} options.autoFix Set to true to automatically fix errors
1132
1129
  */
1133
-
1134
1130
  function HtmlParser() {
1135
1131
  var _this = this;
1136
-
1137
- var stream = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
1138
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1139
-
1132
+
1133
+ var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1134
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1135
+
1140
1136
  _classCallCheck(this, HtmlParser);
1141
-
1137
+
1142
1138
  this.stream = stream;
1143
-
1139
+
1144
1140
  var fix = false;
1145
1141
  var fixedTokenOptions = {};
1146
-
1142
+
1147
1143
  for (var key in supports) {
1148
1144
  if (supports.hasOwnProperty(key)) {
1149
1145
  if (options.autoFix) {
@@ -1152,60 +1148,97 @@ return /******/ (function(modules) { // webpackBootstrap
1152
1148
  fix = fix || fixedTokenOptions[key + 'Fix'];
1153
1149
  }
1154
1150
  }
1155
-
1151
+
1156
1152
  if (fix) {
1157
- this._fixedReadToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {
1153
+ this._readToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {
1158
1154
  return _this._readTokenImpl();
1159
1155
  });
1156
+ this._peekToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {
1157
+ return _this._peekTokenImpl();
1158
+ });
1159
+ } else {
1160
+ this._readToken = this._readTokenImpl;
1161
+ this._peekToken = this._peekTokenImpl;
1160
1162
  }
1161
1163
  }
1162
-
1164
+
1163
1165
  /**
1164
1166
  * Appends the given string to the parse stream.
1165
1167
  *
1166
1168
  * @param {string} str The string to append
1167
1169
  */
1168
-
1169
-
1170
+
1171
+
1170
1172
  HtmlParser.prototype.append = function append(str) {
1171
1173
  this.stream += str;
1172
1174
  };
1173
-
1175
+
1174
1176
  /**
1175
1177
  * Prepends the given string to the parse stream.
1176
1178
  *
1177
1179
  * @param {string} str The string to prepend
1178
1180
  */
1179
-
1180
-
1181
+
1182
+
1181
1183
  HtmlParser.prototype.prepend = function prepend(str) {
1182
1184
  this.stream = str + this.stream;
1183
1185
  };
1184
-
1186
+
1185
1187
  /**
1186
1188
  * The implementation of the token reading.
1187
1189
  *
1188
1190
  * @private
1189
- * @returns {Token}
1191
+ * @returns {?Token}
1190
1192
  */
1191
-
1192
-
1193
+
1194
+
1193
1195
  HtmlParser.prototype._readTokenImpl = function _readTokenImpl() {
1194
- // Enumerate detects in order
1196
+ var token = this._peekTokenImpl();
1197
+ if (token) {
1198
+ this.stream = this.stream.slice(token.length);
1199
+ return token;
1200
+ }
1201
+ };
1202
+
1203
+ /**
1204
+ * The implementation of token peeking.
1205
+ *
1206
+ * @returns {?Token}
1207
+ */
1208
+
1209
+
1210
+ HtmlParser.prototype._peekTokenImpl = function _peekTokenImpl() {
1195
1211
  for (var type in detect) {
1196
1212
  if (detect.hasOwnProperty(type)) {
1197
1213
  if (detect[type].test(this.stream)) {
1198
1214
  var token = streamReaders[type](this.stream);
1215
+
1199
1216
  if (token) {
1200
- token.text = this.stream.substr(0, token.length);
1201
- this.stream = this.stream.slice(token.length);
1202
- return token;
1217
+ if (token.type === 'startTag' && /script|style/i.test(token.tagName)) {
1218
+ return null;
1219
+ } else {
1220
+ token.text = this.stream.substr(0, token.length);
1221
+ return token;
1222
+ }
1203
1223
  }
1204
1224
  }
1205
1225
  }
1206
1226
  }
1207
1227
  };
1208
-
1228
+
1229
+ /**
1230
+ * The public token peeking interface. Delegates to the basic token peeking
1231
+ * or a version that performs fixups depending on the `autoFix` setting in
1232
+ * options.
1233
+ *
1234
+ * @returns {object}
1235
+ */
1236
+
1237
+
1238
+ HtmlParser.prototype.peekToken = function peekToken() {
1239
+ return this._peekToken();
1240
+ };
1241
+
1209
1242
  /**
1210
1243
  * The public token reading interface. Delegates to the basic token reading
1211
1244
  * or a version that performs fixups depending on the `autoFix` setting in
@@ -1213,23 +1246,19 @@ return /******/ (function(modules) { // webpackBootstrap
1213
1246
  *
1214
1247
  * @returns {object}
1215
1248
  */
1216
-
1217
-
1249
+
1250
+
1218
1251
  HtmlParser.prototype.readToken = function readToken() {
1219
- if (this._fixedReadToken) {
1220
- return this._fixedReadToken();
1221
- } else {
1222
- return this._readTokenImpl();
1223
- }
1252
+ return this._readToken();
1224
1253
  };
1225
-
1254
+
1226
1255
  /**
1227
1256
  * Read tokens and hand to the given handlers.
1228
1257
  *
1229
1258
  * @param {Object} handlers The handlers to use for the different tokens.
1230
1259
  */
1231
-
1232
-
1260
+
1261
+
1233
1262
  HtmlParser.prototype.readTokens = function readTokens(handlers) {
1234
1263
  var tok = void 0;
1235
1264
  while (tok = this.readToken()) {
@@ -1239,73 +1268,73 @@ return /******/ (function(modules) { // webpackBootstrap
1239
1268
  }
1240
1269
  }
1241
1270
  };
1242
-
1271
+
1243
1272
  /**
1244
1273
  * Clears the parse stream.
1245
1274
  *
1246
1275
  * @returns {string} The contents of the parse stream before clearing.
1247
1276
  */
1248
-
1249
-
1277
+
1278
+
1250
1279
  HtmlParser.prototype.clear = function clear() {
1251
1280
  var rest = this.stream;
1252
1281
  this.stream = '';
1253
1282
  return rest;
1254
1283
  };
1255
-
1284
+
1256
1285
  /**
1257
1286
  * Returns the rest of the parse stream.
1258
1287
  *
1259
1288
  * @returns {string} The contents of the parse stream.
1260
1289
  */
1261
-
1262
-
1290
+
1291
+
1263
1292
  HtmlParser.prototype.rest = function rest() {
1264
1293
  return this.stream;
1265
1294
  };
1266
-
1295
+
1267
1296
  return HtmlParser;
1268
1297
  }();
1269
-
1298
+
1270
1299
  exports['default'] = HtmlParser;
1271
-
1272
-
1300
+
1301
+
1273
1302
  HtmlParser.tokenToString = function (tok) {
1274
1303
  return tok.toString();
1275
1304
  };
1276
-
1305
+
1277
1306
  HtmlParser.escapeAttributes = function (attrs) {
1278
1307
  var escapedAttrs = {};
1279
-
1308
+
1280
1309
  for (var name in attrs) {
1281
1310
  if (attrs.hasOwnProperty(name)) {
1282
1311
  escapedAttrs[name] = (0, _utils.escapeQuotes)(attrs[name], null);
1283
1312
  }
1284
1313
  }
1285
-
1314
+
1286
1315
  return escapedAttrs;
1287
1316
  };
1288
-
1317
+
1289
1318
  HtmlParser.supports = supports;
1290
-
1319
+
1291
1320
  for (var key in supports) {
1292
1321
  if (supports.hasOwnProperty(key)) {
1293
1322
  HtmlParser.browserHasFlaw = HtmlParser.browserHasFlaw || !supports[key] && key;
1294
1323
  }
1295
1324
  }
1296
-
1325
+
1297
1326
  /***/ },
1298
1327
  /* 2 */
1299
1328
  /***/ function(module, exports) {
1300
-
1329
+
1301
1330
  'use strict';
1302
-
1331
+
1303
1332
  exports.__esModule = true;
1304
1333
  var tagSoup = false;
1305
1334
  var selfClose = false;
1306
-
1335
+
1307
1336
  var work = window.document.createElement('div');
1308
-
1337
+
1309
1338
  try {
1310
1339
  var html = '<P><I></P></I>';
1311
1340
  work.innerHTML = html;
@@ -1313,37 +1342,37 @@ return /******/ (function(modules) { // webpackBootstrap
1313
1342
  } catch (e) {
1314
1343
  exports.tagSoup = tagSoup = false;
1315
1344
  }
1316
-
1345
+
1317
1346
  try {
1318
1347
  work.innerHTML = '<P><i><P></P></i></P>';
1319
1348
  exports.selfClose = selfClose = work.childNodes.length === 2;
1320
1349
  } catch (e) {
1321
1350
  exports.selfClose = selfClose = false;
1322
1351
  }
1323
-
1352
+
1324
1353
  work = null;
1325
-
1354
+
1326
1355
  exports.tagSoup = tagSoup;
1327
1356
  exports.selfClose = selfClose;
1328
-
1357
+
1329
1358
  /***/ },
1330
1359
  /* 3 */
1331
1360
  /***/ function(module, exports, __webpack_require__) {
1332
-
1361
+
1333
1362
  'use strict';
1334
-
1363
+
1335
1364
  exports.__esModule = true;
1336
-
1337
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
1338
-
1365
+
1366
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1367
+
1339
1368
  exports.comment = comment;
1340
1369
  exports.chars = chars;
1341
1370
  exports.startTag = startTag;
1342
1371
  exports.atomicTag = atomicTag;
1343
1372
  exports.endTag = endTag;
1344
-
1373
+
1345
1374
  var _tokens = __webpack_require__(4);
1346
-
1375
+
1347
1376
  /**
1348
1377
  * Regular Expressions for parsing tags and attributes
1349
1378
  *
@@ -1355,7 +1384,7 @@ return /******/ (function(modules) { // webpackBootstrap
1355
1384
  attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,
1356
1385
  fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i
1357
1386
  };
1358
-
1387
+
1359
1388
  /**
1360
1389
  * Reads a comment token
1361
1390
  *
@@ -1368,7 +1397,7 @@ return /******/ (function(modules) { // webpackBootstrap
1368
1397
  return new _tokens.CommentToken(stream.substr(4, index - 1), index + 3);
1369
1398
  }
1370
1399
  }
1371
-
1400
+
1372
1401
  /**
1373
1402
  * Reads non-tag characters.
1374
1403
  *
@@ -1379,7 +1408,7 @@ return /******/ (function(modules) { // webpackBootstrap
1379
1408
  var index = stream.indexOf('<');
1380
1409
  return new _tokens.CharsToken(index >= 0 ? index : stream.length);
1381
1410
  }
1382
-
1411
+
1383
1412
  /**
1384
1413
  * Reads start tag token.
1385
1414
  *
@@ -1395,7 +1424,7 @@ return /******/ (function(modules) { // webpackBootstrap
1395
1424
  var attrs = {};
1396
1425
  var booleanAttrs = {};
1397
1426
  var rest = match[2];
1398
-
1427
+
1399
1428
  match[2].replace(REGEXES.attr, function (match, name) {
1400
1429
  if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) {
1401
1430
  attrs[name] = '';
@@ -1405,20 +1434,20 @@ return /******/ (function(modules) { // webpackBootstrap
1405
1434
  } else {
1406
1435
  attrs[name] = arguments[2] || arguments[3] || arguments[4] || REGEXES.fillAttr.test(name) && name || '';
1407
1436
  }
1408
-
1437
+
1409
1438
  rest = rest.replace(match, '');
1410
1439
  });
1411
-
1440
+
1412
1441
  return {
1413
1442
  v: new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''))
1414
1443
  };
1415
1444
  }();
1416
-
1445
+
1417
1446
  if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
1418
1447
  }
1419
1448
  }
1420
1449
  }
1421
-
1450
+
1422
1451
  /**
1423
1452
  * Reads atomic tag token.
1424
1453
  *
@@ -1439,7 +1468,7 @@ return /******/ (function(modules) { // webpackBootstrap
1439
1468
  }
1440
1469
  }
1441
1470
  }
1442
-
1471
+
1443
1472
  /**
1444
1473
  * Reads an end tag token.
1445
1474
  *
@@ -1452,25 +1481,24 @@ return /******/ (function(modules) { // webpackBootstrap
1452
1481
  return new _tokens.EndTagToken(match[1], match[0].length);
1453
1482
  }
1454
1483
  }
1455
-
1484
+
1456
1485
  /***/ },
1457
1486
  /* 4 */
1458
1487
  /***/ function(module, exports, __webpack_require__) {
1459
-
1488
+
1460
1489
  'use strict';
1461
-
1490
+
1462
1491
  exports.__esModule = true;
1463
1492
  exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined;
1464
-
1493
+
1465
1494
  var _utils = __webpack_require__(5);
1466
-
1495
+
1467
1496
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1468
-
1497
+
1469
1498
  /**
1470
1499
  * Token is a base class for all token types parsed. Note we don't actually
1471
1500
  * use intheritance due to IE8's non-existent ES5 support.
1472
1501
  */
1473
-
1474
1502
  var Token =
1475
1503
  /**
1476
1504
  * Constructor.
@@ -1480,17 +1508,17 @@ return /******/ (function(modules) { // webpackBootstrap
1480
1508
  */
1481
1509
  exports.Token = function Token(type, length) {
1482
1510
  _classCallCheck(this, Token);
1483
-
1511
+
1484
1512
  this.type = type;
1485
1513
  this.length = length;
1486
1514
  this.text = '';
1487
1515
  };
1488
-
1516
+
1489
1517
  /**
1490
1518
  * CommentToken represents comment tags.
1491
1519
  */
1492
-
1493
-
1520
+
1521
+
1494
1522
  var CommentToken = exports.CommentToken = function () {
1495
1523
  /**
1496
1524
  * Constructor.
@@ -1498,55 +1526,53 @@ return /******/ (function(modules) { // webpackBootstrap
1498
1526
  * @param {string} content The content of the comment
1499
1527
  * @param {Number} length The length of the Token text.
1500
1528
  */
1501
-
1502
1529
  function CommentToken(content, length) {
1503
1530
  _classCallCheck(this, CommentToken);
1504
-
1531
+
1505
1532
  this.type = 'comment';
1506
1533
  this.length = length || (content ? content.length : 0);
1507
1534
  this.text = '';
1508
1535
  this.content = content;
1509
1536
  }
1510
-
1537
+
1511
1538
  CommentToken.prototype.toString = function toString() {
1512
1539
  return '<!--' + this.content;
1513
1540
  };
1514
-
1541
+
1515
1542
  return CommentToken;
1516
1543
  }();
1517
-
1544
+
1518
1545
  /**
1519
1546
  * CharsToken represents non-tag characters.
1520
1547
  */
1521
-
1522
-
1548
+
1549
+
1523
1550
  var CharsToken = exports.CharsToken = function () {
1524
1551
  /**
1525
1552
  * Constructor.
1526
1553
  *
1527
1554
  * @param {Number} length The length of the Token text.
1528
1555
  */
1529
-
1530
1556
  function CharsToken(length) {
1531
1557
  _classCallCheck(this, CharsToken);
1532
-
1558
+
1533
1559
  this.type = 'chars';
1534
1560
  this.length = length;
1535
1561
  this.text = '';
1536
1562
  }
1537
-
1563
+
1538
1564
  CharsToken.prototype.toString = function toString() {
1539
1565
  return this.text;
1540
1566
  };
1541
-
1567
+
1542
1568
  return CharsToken;
1543
1569
  }();
1544
-
1570
+
1545
1571
  /**
1546
1572
  * TagToken is a base class for all tag-based Tokens.
1547
1573
  */
1548
-
1549
-
1574
+
1575
+
1550
1576
  var TagToken = exports.TagToken = function () {
1551
1577
  /**
1552
1578
  * Constructor.
@@ -1558,10 +1584,9 @@ return /******/ (function(modules) { // webpackBootstrap
1558
1584
  * @param {Object} booleanAttrs If an entry has 'true' then the attribute
1559
1585
  * is a boolean attribute
1560
1586
  */
1561
-
1562
1587
  function TagToken(type, tagName, length, attrs, booleanAttrs) {
1563
1588
  _classCallCheck(this, TagToken);
1564
-
1589
+
1565
1590
  this.type = type;
1566
1591
  this.length = length;
1567
1592
  this.text = '';
@@ -1571,7 +1596,7 @@ return /******/ (function(modules) { // webpackBootstrap
1571
1596
  this.unary = false;
1572
1597
  this.html5Unary = false;
1573
1598
  }
1574
-
1599
+
1575
1600
  /**
1576
1601
  * Formats the given token tag.
1577
1602
  *
@@ -1579,48 +1604,48 @@ return /******/ (function(modules) { // webpackBootstrap
1579
1604
  * @param {?string} [content=null] The content of the token.
1580
1605
  * @returns {string} The formatted tag.
1581
1606
  */
1582
-
1583
-
1607
+
1608
+
1584
1609
  TagToken.formatTag = function formatTag(tok) {
1585
- var content = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
1586
-
1610
+ var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1611
+
1587
1612
  var str = '<' + tok.tagName;
1588
1613
  for (var key in tok.attrs) {
1589
1614
  if (tok.attrs.hasOwnProperty(key)) {
1590
1615
  str += ' ' + key;
1591
-
1616
+
1592
1617
  var val = tok.attrs[key];
1593
1618
  if (typeof tok.booleanAttrs === 'undefined' || typeof tok.booleanAttrs[key] === 'undefined') {
1594
1619
  str += '="' + (0, _utils.escapeQuotes)(val) + '"';
1595
1620
  }
1596
1621
  }
1597
1622
  }
1598
-
1623
+
1599
1624
  if (tok.rest) {
1600
1625
  str += ' ' + tok.rest;
1601
1626
  }
1602
-
1627
+
1603
1628
  if (tok.unary && !tok.html5Unary) {
1604
1629
  str += '/>';
1605
1630
  } else {
1606
1631
  str += '>';
1607
1632
  }
1608
-
1633
+
1609
1634
  if (content !== undefined && content !== null) {
1610
1635
  str += content + '</' + tok.tagName + '>';
1611
1636
  }
1612
-
1637
+
1613
1638
  return str;
1614
1639
  };
1615
-
1640
+
1616
1641
  return TagToken;
1617
1642
  }();
1618
-
1643
+
1619
1644
  /**
1620
1645
  * StartTagToken represents a start token.
1621
1646
  */
1622
-
1623
-
1647
+
1648
+
1624
1649
  var StartTagToken = exports.StartTagToken = function () {
1625
1650
  /**
1626
1651
  * Constructor.
@@ -1633,10 +1658,9 @@ return /******/ (function(modules) { // webpackBootstrap
1633
1658
  * @param {boolean} unary True if the tag is a unary tag
1634
1659
  * @param {string} rest The rest of the content.
1635
1660
  */
1636
-
1637
1661
  function StartTagToken(tagName, length, attrs, booleanAttrs, unary, rest) {
1638
1662
  _classCallCheck(this, StartTagToken);
1639
-
1663
+
1640
1664
  this.type = 'startTag';
1641
1665
  this.length = length;
1642
1666
  this.text = '';
@@ -1647,19 +1671,19 @@ return /******/ (function(modules) { // webpackBootstrap
1647
1671
  this.unary = unary;
1648
1672
  this.rest = rest;
1649
1673
  }
1650
-
1674
+
1651
1675
  StartTagToken.prototype.toString = function toString() {
1652
1676
  return TagToken.formatTag(this);
1653
1677
  };
1654
-
1678
+
1655
1679
  return StartTagToken;
1656
1680
  }();
1657
-
1681
+
1658
1682
  /**
1659
1683
  * AtomicTagToken represents an atomic tag.
1660
1684
  */
1661
-
1662
-
1685
+
1686
+
1663
1687
  var AtomicTagToken = exports.AtomicTagToken = function () {
1664
1688
  /**
1665
1689
  * Constructor.
@@ -1671,10 +1695,9 @@ return /******/ (function(modules) { // webpackBootstrap
1671
1695
  * is a boolean attribute
1672
1696
  * @param {string} content The content of the tag.
1673
1697
  */
1674
-
1675
1698
  function AtomicTagToken(tagName, length, attrs, booleanAttrs, content) {
1676
1699
  _classCallCheck(this, AtomicTagToken);
1677
-
1700
+
1678
1701
  this.type = 'atomicTag';
1679
1702
  this.length = length;
1680
1703
  this.text = '';
@@ -1685,19 +1708,19 @@ return /******/ (function(modules) { // webpackBootstrap
1685
1708
  this.html5Unary = false;
1686
1709
  this.content = content;
1687
1710
  }
1688
-
1711
+
1689
1712
  AtomicTagToken.prototype.toString = function toString() {
1690
1713
  return TagToken.formatTag(this, this.content);
1691
1714
  };
1692
-
1715
+
1693
1716
  return AtomicTagToken;
1694
1717
  }();
1695
-
1718
+
1696
1719
  /**
1697
1720
  * EndTagToken represents an end tag.
1698
1721
  */
1699
-
1700
-
1722
+
1723
+
1701
1724
  var EndTagToken = exports.EndTagToken = function () {
1702
1725
  /**
1703
1726
  * Constructor.
@@ -1705,32 +1728,31 @@ return /******/ (function(modules) { // webpackBootstrap
1705
1728
  * @param {string} tagName The name of the tag.
1706
1729
  * @param {Number} length The length of the tag text.
1707
1730
  */
1708
-
1709
1731
  function EndTagToken(tagName, length) {
1710
1732
  _classCallCheck(this, EndTagToken);
1711
-
1733
+
1712
1734
  this.type = 'endTag';
1713
1735
  this.length = length;
1714
1736
  this.text = '';
1715
1737
  this.tagName = tagName;
1716
1738
  }
1717
-
1739
+
1718
1740
  EndTagToken.prototype.toString = function toString() {
1719
1741
  return '</' + this.tagName + '>';
1720
1742
  };
1721
-
1743
+
1722
1744
  return EndTagToken;
1723
1745
  }();
1724
-
1746
+
1725
1747
  /***/ },
1726
1748
  /* 5 */
1727
1749
  /***/ function(module, exports) {
1728
-
1750
+
1729
1751
  'use strict';
1730
-
1752
+
1731
1753
  exports.__esModule = true;
1732
1754
  exports.escapeQuotes = escapeQuotes;
1733
-
1755
+
1734
1756
  /**
1735
1757
  * Escape quotes in the given value.
1736
1758
  *
@@ -1739,8 +1761,8 @@ return /******/ (function(modules) { // webpackBootstrap
1739
1761
  * @returns {string}
1740
1762
  */
1741
1763
  function escapeQuotes(value) {
1742
- var defaultValue = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];
1743
-
1764
+ var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1765
+
1744
1766
  // There's no lookback in JS, so /(^|[^\\])"/ only matches the first of two `"`s.
1745
1767
  // Instead, just match anything before a double-quote and escape if it's not already escaped.
1746
1768
  return !value ? defaultValue : value.replace(/([^"]*)"/g, function (_, prefix) {
@@ -1748,13 +1770,13 @@ return /******/ (function(modules) { // webpackBootstrap
1748
1770
  );
1749
1771
  });
1750
1772
  }
1751
-
1773
+
1752
1774
  /***/ },
1753
1775
  /* 6 */
1754
1776
  /***/ function(module, exports) {
1755
-
1777
+
1756
1778
  'use strict';
1757
-
1779
+
1758
1780
  exports.__esModule = true;
1759
1781
  exports['default'] = fixedReadTokenFactory;
1760
1782
  /**
@@ -1763,14 +1785,14 @@ return /******/ (function(modules) { // webpackBootstrap
1763
1785
  * @type {RegExp}
1764
1786
  */
1765
1787
  var EMPTY = /^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i;
1766
-
1788
+
1767
1789
  /**
1768
1790
  * Elements that you can intentionally leave open (and which close themselves)
1769
1791
  *
1770
1792
  * @type {RegExp}
1771
1793
  */
1772
1794
  var CLOSESELF = /^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;
1773
-
1795
+
1774
1796
  /**
1775
1797
  * Corrects a token.
1776
1798
  *
@@ -1784,7 +1806,7 @@ return /******/ (function(modules) { // webpackBootstrap
1784
1806
  }
1785
1807
  return tok;
1786
1808
  }
1787
-
1809
+
1788
1810
  /**
1789
1811
  * Peeks at the next token in the parser.
1790
1812
  *
@@ -1798,7 +1820,7 @@ return /******/ (function(modules) { // webpackBootstrap
1798
1820
  parser.stream = tmp;
1799
1821
  return tok;
1800
1822
  }
1801
-
1823
+
1802
1824
  /**
1803
1825
  * Closes the last token.
1804
1826
  *
@@ -1807,11 +1829,11 @@ return /******/ (function(modules) { // webpackBootstrap
1807
1829
  */
1808
1830
  function closeLast(parser, stack) {
1809
1831
  var tok = stack.pop();
1810
-
1832
+
1811
1833
  // prepend close tag to stream.
1812
1834
  parser.prepend('</' + tok.tagName + '>');
1813
1835
  }
1814
-
1836
+
1815
1837
  /**
1816
1838
  * Create a new token stack.
1817
1839
  *
@@ -1819,16 +1841,16 @@ return /******/ (function(modules) { // webpackBootstrap
1819
1841
  */
1820
1842
  function newStack() {
1821
1843
  var stack = [];
1822
-
1844
+
1823
1845
  stack.last = function () {
1824
1846
  return this[this.length - 1];
1825
1847
  };
1826
-
1848
+
1827
1849
  stack.lastTagNameEq = function (tagName) {
1828
1850
  var last = this.last();
1829
1851
  return last && last.tagName && last.tagName.toUpperCase() === tagName.toUpperCase();
1830
1852
  };
1831
-
1853
+
1832
1854
  stack.containsTagName = function (tagName) {
1833
1855
  for (var i = 0, tok; tok = this[i]; i++) {
1834
1856
  if (tok.tagName === tagName) {
@@ -1837,10 +1859,10 @@ return /******/ (function(modules) { // webpackBootstrap
1837
1859
  }
1838
1860
  return false;
1839
1861
  };
1840
-
1862
+
1841
1863
  return stack;
1842
1864
  }
1843
-
1865
+
1844
1866
  /**
1845
1867
  * Return a readToken implementation that fixes input.
1846
1868
  *
@@ -1853,11 +1875,11 @@ return /******/ (function(modules) { // webpackBootstrap
1853
1875
  */
1854
1876
  function fixedReadTokenFactory(parser, options, readTokenImpl) {
1855
1877
  var stack = newStack();
1856
-
1878
+
1857
1879
  var handlers = {
1858
1880
  startTag: function startTag(tok) {
1859
1881
  var tagName = tok.tagName;
1860
-
1882
+
1861
1883
  if (tagName.toUpperCase() === 'TR' && stack.lastTagNameEq('TABLE')) {
1862
1884
  parser.prepend('<TBODY>');
1863
1885
  prepareNextToken();
@@ -1888,20 +1910,20 @@ return /******/ (function(modules) { // webpackBootstrap
1888
1910
  }
1889
1911
  }
1890
1912
  };
1891
-
1913
+
1892
1914
  function prepareNextToken() {
1893
1915
  var tok = peekToken(parser, readTokenImpl);
1894
1916
  if (tok && handlers[tok.type]) {
1895
1917
  handlers[tok.type](tok);
1896
1918
  }
1897
1919
  }
1898
-
1920
+
1899
1921
  return function fixedReadToken() {
1900
1922
  prepareNextToken();
1901
1923
  return correct(readTokenImpl());
1902
1924
  };
1903
1925
  }
1904
-
1926
+
1905
1927
  /***/ }
1906
1928
  /******/ ])
1907
1929
  });
@@ -1912,11 +1934,11 @@ return /******/ (function(modules) { // webpackBootstrap
1912
1934
  /***/ function(module, exports) {
1913
1935
 
1914
1936
  'use strict';
1915
-
1937
+
1916
1938
  exports.__esModule = true;
1917
-
1918
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
1919
-
1939
+
1940
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1941
+
1920
1942
  exports.existy = existy;
1921
1943
  exports.isFunction = isFunction;
1922
1944
  exports.each = each;
@@ -1936,7 +1958,7 @@ return /******/ (function(modules) { // webpackBootstrap
1936
1958
  function existy(thing) {
1937
1959
  return thing !== void 0 && thing !== null;
1938
1960
  }
1939
-
1961
+
1940
1962
  /**
1941
1963
  * Is this a function?
1942
1964
  *
@@ -1946,7 +1968,7 @@ return /******/ (function(modules) { // webpackBootstrap
1946
1968
  function isFunction(x) {
1947
1969
  return 'function' === typeof x;
1948
1970
  }
1949
-
1971
+
1950
1972
  /**
1951
1973
  * Loop over each item in an array-like value.
1952
1974
  *
@@ -1961,7 +1983,7 @@ return /******/ (function(modules) { // webpackBootstrap
1961
1983
  fn.call(target, arr[i], i);
1962
1984
  }
1963
1985
  }
1964
-
1986
+
1965
1987
  /**
1966
1988
  * Loop over each key/value pair in a hash.
1967
1989
  *
@@ -1976,7 +1998,7 @@ return /******/ (function(modules) { // webpackBootstrap
1976
1998
  }
1977
1999
  }
1978
2000
  }
1979
-
2001
+
1980
2002
  /**
1981
2003
  * Set default options where some option was not specified.
1982
2004
  *
@@ -1993,7 +2015,7 @@ return /******/ (function(modules) { // webpackBootstrap
1993
2015
  });
1994
2016
  return options;
1995
2017
  }
1996
-
2018
+
1997
2019
  /**
1998
2020
  * Convert value (e.g., a NodeList) to an array.
1999
2021
  *
@@ -2013,11 +2035,11 @@ return /******/ (function(modules) { // webpackBootstrap
2013
2035
  v: ret
2014
2036
  };
2015
2037
  }();
2016
-
2038
+
2017
2039
  if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
2018
2040
  }
2019
2041
  }
2020
-
2042
+
2021
2043
  /**
2022
2044
  * Get the last item in an array
2023
2045
  *
@@ -2027,7 +2049,7 @@ return /******/ (function(modules) { // webpackBootstrap
2027
2049
  function last(array) {
2028
2050
  return array[array.length - 1];
2029
2051
  }
2030
-
2052
+
2031
2053
  /**
2032
2054
  * Test if token is a script tag.
2033
2055
  *
@@ -2036,9 +2058,9 @@ return /******/ (function(modules) { // webpackBootstrap
2036
2058
  * @returns {boolean} True if the token is a script tag
2037
2059
  */
2038
2060
  function isTag(tok, tag) {
2039
- return !tok || !(tok.type === 'startTag' || tok.type === 'atomicTag') || !('tagName' in tok) ? !1 : !! ~tok.tagName.toLowerCase().indexOf(tag);
2061
+ return !tok || !(tok.type === 'startTag' || tok.type === 'atomicTag') || !('tagName' in tok) ? !1 : !!~tok.tagName.toLowerCase().indexOf(tag);
2040
2062
  }
2041
-
2063
+
2042
2064
  /**
2043
2065
  * Test if token is a script tag.
2044
2066
  *
@@ -2048,7 +2070,7 @@ return /******/ (function(modules) { // webpackBootstrap
2048
2070
  function isScript(tok) {
2049
2071
  return isTag(tok, 'script');
2050
2072
  }
2051
-
2073
+
2052
2074
  /**
2053
2075
  * Test if token is a style tag.
2054
2076
  *
@@ -2062,4 +2084,5 @@ return /******/ (function(modules) { // webpackBootstrap
2062
2084
  /***/ }
2063
2085
  /******/ ])
2064
2086
  });
2065
- ;
2087
+ ;
2088
+ //# sourceMappingURL=postscribe.js.map