/** * @file prescribe * @description Tiny, forgiving HTML parser * @version v1.1.3 * @see {@link https://github.com/krux/prescribe/} * @license MIT * @author Derek Brans * @copyright 2017 Krux Digital, Inc */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["Prescribe"] = factory(); else root["Prescribe"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _HtmlParser = __webpack_require__(1); var _HtmlParser2 = _interopRequireDefault(_HtmlParser); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } module.exports = _HtmlParser2['default']; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _supports = __webpack_require__(2); var supports = _interopRequireWildcard(_supports); var _streamReaders = __webpack_require__(3); var streamReaders = _interopRequireWildcard(_streamReaders); var _fixedReadTokenFactory = __webpack_require__(6); var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory); var _utils = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 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; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Detection regular expressions. * * Order of detection matters: detection of one can only * succeed if detection of previous didn't * @type {Object} */ var detect = { comment: /^'); if (index >= 0) { return new _tokens.CommentToken(stream.substr(4, index - 1), index + 3); } } /** * Reads non-tag characters. * * @param {string} stream The input stream * @returns {CharsToken} */ function chars(stream) { var index = stream.indexOf('<'); return new _tokens.CharsToken(index >= 0 ? index : stream.length); } /** * Reads start tag token. * * @param {string} stream The input stream * @returns {StartTagToken} */ function startTag(stream) { var endTagIndex = stream.indexOf('>'); if (endTagIndex !== -1) { var match = stream.match(REGEXES.startTag); if (match) { var attrs = {}; var booleanAttrs = {}; var rest = match[2]; match[2].replace(REGEXES.attr, function (match, name) { if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) { attrs[name] = ''; } else if (arguments[5]) { attrs[arguments[5]] = ''; booleanAttrs[arguments[5]] = true; } else { attrs[name] = arguments[2] || arguments[3] || arguments[4] || REGEXES.fillAttr.test(name) && name || ''; } rest = rest.replace(match, ''); }); return new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')); } } } /** * Reads atomic tag token. * * @param {string} stream The input stream * @returns {AtomicTagToken} */ function atomicTag(stream) { var start = startTag(stream); if (start) { var rest = stream.slice(start.length); // for optimization, we check first just for the end tag if (rest.match(new RegExp('<\/\\s*' + start.tagName + '\\s*>', 'i'))) { // capturing the content is inefficient, so we do it inside the if var match = rest.match(new RegExp('([\\s\\S]*?)<\/\\s*' + start.tagName + '\\s*>', 'i')); if (match) { return new _tokens.AtomicTagToken(start.tagName, match[0].length + start.length, start.attrs, start.booleanAttrs, match[1]); } } } } /** * Reads an end tag token. * * @param {string} stream The input stream * @returns {EndTagToken} */ function endTag(stream) { var match = stream.match(REGEXES.endTag); if (match) { return new _tokens.EndTagToken(match[1], match[0].length); } } /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined; var _utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Token is a base class for all token types parsed. Note we don't actually * use intheritance due to IE8's non-existent ES5 support. */ var Token = /** * Constructor. * * @param {string} type The type of the Token. * @param {Number} length The length of the Token text. */ exports.Token = function Token(type, length) { _classCallCheck(this, Token); this.type = type; this.length = length; this.text = ''; }; /** * CommentToken represents comment tags. */ var CommentToken = exports.CommentToken = function () { /** * Constructor. * * @param {string} content The content of the comment * @param {Number} length The length of the Token text. */ function CommentToken(content, length) { _classCallCheck(this, CommentToken); this.type = 'comment'; this.length = length || (content ? content.length : 0); this.text = ''; this.content = content; } CommentToken.prototype.toString = function toString() { return '