wed
Version:
Wed is a schema-aware editor for XML documents.
1 lines • 93.3 kB
JavaScript
{"version":3,"sources":["webpack://salve-dom/webpack/universalModuleDefinition","webpack://salve-dom/webpack/bootstrap","webpack://salve-dom/./build/dist/lib/main.js","webpack://salve-dom/external \"salve\"","webpack://salve-dom/./build/dist/lib/event_emitter.js","webpack://salve-dom/./build/dist/lib/tools.js"],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE__1__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","salve_1","event_emitter_1","tools_1","_indexOf","parent","needle","Array","indexOf","version","attrNodeType","Node","ATTRIBUTE_NODE","WorkingState","isAttr","undefined","it","nodeType","Attr","ProgressState","[object Object]","partDone","portion","this","EventIndexException","Error","super","fixPrototype","Validator","schema","options","_cycleEntered","_timeout","_maxTimespan","_resetting","_errors","_errorsSeen","_boundWrapper","_workWrapper","_validationEvents","_workingState","INCOMPLETE","_partDone","_validationStage","_previousChild","_validationStack","_walkerCache","_walkerCacheMax","_prefix","_walkerCacheGap","_events","EventEmitter","keys","prefix","_curEl","_setNodeProperty","length","_setWorkingState","_validationWalker","newWalker","DefaultNameResolver","events","node","makeKey","anode","_timeoutId","_stop","WORKING","setTimeout","getNamespaces","ret","_process","attrIxLim","attributes","attrIx","attr","lastIndexOf","slice","array","push","child","firstChild","ELEMENT_NODE","nextSibling","_work","startDate","Date","now","_cycle","walker","stack","stage","stage_change","curEl","unshift","_fireAndProcessEvent","uri","tagName","parentNode","curElIndex","childNodes","ename","nameResolver","resolveName","_processEventResult","ValidationError","EName","_setPossibleDueToWildcard","_fireAttributeEvents","textAccumulatorNode","textAccumulator","flushText","eventResult","fireEvent","TEXT_NODE","data","childElementCount","COMMENT_NODE","end","_runDocumentValidation","INVALID","VALID","originalElement","nextDone","shift","first","state","clearTimeout","resetTo","start","_resetTo","el","_clearNodeProperties","firstElementChild","_erase","nextElementSibling","_emit","at","newState","newDone","changed","errors","results","index","result","_processError","error","String","nodeGettingId","oldId","getNodeProperty","ensureErrorId","toString","_fireAttributeNameEvent","attrName","params","ix","enterContext","leaveContext","definePrefix","container","toInspect","dataKey","ownerElement","previousElementSibling","DOCUMENT_FRAGMENT_NODE","DOCUMENT_NODE","prev","lastElementChild","_validateUpTo","fireTextEvent","textNode","readyWalker","clone","getFrom","propName","prevSibling","previousSibling","eventIndex","cache","max","searchIx","Math","_getWalkerAt","possible","event","param","eventString","hasNamePattern","possibleAt","candidate","match","toParse","ownerDocument","createDocumentFragment","insertBefore","cloneNode","createElement","speculativelyValidateFragment","dup","errorData","eventName","previous","evs","matched","ev","namePattern","wildcardMatch","isPossibleDueToWildcard","attribute","unresolveName","ParsingError","xmlErrors","err","message","XML_NAMESPACE","MOZILLA_NAMESPACE","safeParse","source","win","parser","DOMParser","doc","parseFromString","ex","code","getElementsByTagNameNS","documentElement","outerHTML","_eventListeners","_generalListeners","_trace","listener","listeners","me","args","removeEventListener","apply","addEventListener","splice","console","log","obj","getPrototypeOf","__proto__","setPrototypeOf"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,UACA,mBAAAC,eAAAC,IACAD,QAAA,SAAAJ,GACA,iBAAAC,QACAA,QAAA,aAAAD,EAAAG,QAAA,UAEAJ,EAAA,aAAAC,EAAAD,EAAA,OARA,CASCO,OAAA,SAAAC,GACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAT,QAGA,IAAAC,EAAAM,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAX,YAUA,OANAY,EAAAH,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAU,GAAA,EAGAV,EAAAD,QA0DA,OArDAQ,EAAAM,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AA1L,IAAA0N,KAAAjL,OAAA,GAGAiL,IAAA5J,QACA,UAAA2J,KAAAC,EAEA,QADAD,EAAApQ,UAAA2C,EAAA8L,GAEA,yCCnHAlO,OAAAC,eAAArB,EAAA,cAA8C2B,OAAA,IAuB9C3B,EAAAoE,aAbA,SAAAuN,EAAA7O,SACAU,IAAApC,OAAAwQ,eACAxQ,OAAAwQ,eAAAD,GACAA,EAAAE,aACA/O,SACAU,IAAApC,OAAA0Q,eACA1Q,OAAA0Q,eAAAH,EAAA7O,EAAAR,WAGAqP,EAAAE,UAAA/O,EAAAR","file":"salve-dom.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"salve\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"salve\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"salve-dom\"] = factory(require(\"salve\"));\n\telse\n\t\troot[\"salve-dom\"] = factory(root[\"salve\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE__1__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Main module of salve-dom.\n * @author Louis-Dominique Dubeau\n * @license MPL 2.0\n * @copyright Mangalam Research Center for Buddhist Languages\n */\nconst salve_1 = require(\"salve\");\nconst event_emitter_1 = require(\"./event_emitter\");\nconst tools_1 = require(\"./tools\");\nexports.version = \"5.0.1\";\nfunction _indexOf(parent, needle) {\n return Array.prototype.indexOf.call(parent, needle);\n}\n// We check that ``Node.ATTRIBUTE_NODE`` is not undefined because eventually\n// ``ATTRIBUTE_NODE`` will be removed from the ``Node`` interface, and then we\n// could be testing ``undefined === undefined`` for objects which are not\n// attributes, which would return ``true``. The function is not very strict but\n// it should not be too lax either.\nconst attrNodeType = Node.ATTRIBUTE_NODE;\nexports.isAttr = attrNodeType !== undefined ?\n (it) => it.nodeType === attrNodeType :\n (it) => it instanceof Attr;\n// Working state values\nvar WorkingState;\n(function (WorkingState) {\n /**\n * The validator is stopped but has not completed a validation pass yet.\n */\n WorkingState[WorkingState[\"INCOMPLETE\"] = 1] = \"INCOMPLETE\";\n /**\n * The validator is working on validating the document.\n */\n WorkingState[WorkingState[\"WORKING\"] = 2] = \"WORKING\";\n /**\n * The validator is stopped and has found the document invalid. Note that this\n * state happens *only* if the whole document was validated.\n */\n WorkingState[WorkingState[\"INVALID\"] = 3] = \"INVALID\";\n /**\n * The validator is stopped and has found the document valid. Note that this\n * state happens *only* if the whole document was validated.\n */\n WorkingState[WorkingState[\"VALID\"] = 4] = \"VALID\";\n})(WorkingState = exports.WorkingState || (exports.WorkingState = {}));\n/**\n * Data structure for recording progress.\n *\n * @private\n *\n * @param partDone The part of the document done so far.\n *\n * @param portion A ProgressState object is created in relation to an\n * element. The element covers portion X of the total document. This parameter\n * should be X.\n */\nclass ProgressState {\n constructor(partDone, portion) {\n this.partDone = partDone;\n this.portion = portion;\n }\n}\n//\n// Note: the Validator class adds information to the Element nodes it is working\n// with by adding expando properties that start with \"wed_event_\". This deemed\n// acceptable here because:\n//\n// * The tree on which a Validator object operates is not supposed to be open to\n// third party software. Even if it were, the chance of a clash is small.\n//\n// * The values of the expando properties are primitives (not objects or other\n// elements).\n//\n// * We don't care about browsers or situations where expando properties are not\n// supported.\n//\n/**\n * Exception to be raised if we can't find our place in the events list. It is\n * only to be raised by code in this module but the documentation is left public\n * for diagnosis purposes.\n */\nclass EventIndexException extends Error {\n constructor() {\n super(\"undefined event_index; _validateUpTo should have taken care of that\");\n tools_1.fixPrototype(this, EventIndexException);\n }\n}\n// This private utility function checks whether an event is possible *only*\n// because there is a name_pattern wildcard that allows it.\nfunction isPossibleDueToWildcard(walker, eventName, ns, name) {\n const evs = walker.possible();\n let matched = false;\n for (const ev of evs) {\n if (ev.params[0] !== eventName) {\n continue;\n }\n const namePattern = ev.params[1];\n if (namePattern.match(ns, name)) {\n // We already know that it matches, and this is not merely due to a\n // wildcard.\n if (!namePattern.wildcardMatch(ns, name)) {\n return false;\n }\n // Keep track of whether it ever matched anything.\n matched = true;\n }\n }\n // If it never matched any pattern at all, then we must return false. If we\n // get here and matched is true then it means that it matched all patterns due\n // to wildcards.\n return matched;\n}\n/**\n * A document validator. The validator assumes that the DOM tree it uses for\n * validation is always normalized: that is, there are no empty text nodes and\n * there cannot be two adjacent text nodes.\n *\n * This validator operates by scheduling work cycles. Given the way JavaScript\n * works, if the validator just validated the whole document in one shot, it\n * would take all processing power until done, and everything else would\n * block. Rather than do this, it performs a bit of work, stops, and performs\n * another bit, etc. Each bit of work is called a \"cycle\". The options passed to\n * the validator at creation determine how long a cycle may last and how much\n * time elapses between cycles. (Yes, using ``Worker``s has been considered as\n * an option but it would complicate the whole deal by quite a bit due to\n * communication costs between a ``Worker`` and the main process.)\n *\n * @param schema A ``Grammar`` object that has already been produced from\n * ``salve``.\n *\n * @param root The root of the DOM tree to validate. This root contains the\n * document to validate but is not part of the document itself.\n *\n * @param options Some options driving how the validator works.\n */\nclass Validator {\n constructor(schema, root, options = {}) {\n this.schema = schema;\n this.root = root;\n this._cycleEntered = 0;\n this._timeout = 200;\n this._maxTimespan = 100;\n this._resetting = false;\n this._errors = [];\n this._errorsSeen = Object.create(null);\n this._boundWrapper = this._workWrapper.bind(this);\n // Validation state\n this._validationEvents = [];\n this._workingState = WorkingState.INCOMPLETE;\n this._partDone = 0;\n this._validationStage = 2 /* CONTENTS */;\n this._previousChild = null;\n this._validationStack = [new ProgressState(0, 1)];\n this._walkerCache = Object.create(null);\n this._walkerCacheMax = -1;\n this._prefix = \"salveDom\";\n // The distance between walkers under which we skip saving a walker in the\n // cache.\n this._walkerCacheGap = 100;\n this._events = new event_emitter_1.EventEmitter();\n const keys = [\"timeout\", \"maxTimespan\",\n \"walkerCacheGap\"];\n for (const key of keys) {\n const value = options[key];\n if (value === undefined) {\n continue;\n }\n if (value < 0) {\n throw new Error(`the value for ${key} cannot be negative`);\n }\n this[`_${key}`] = options[key];\n }\n if (options.prefix !== undefined) {\n this._prefix = options.prefix;\n }\n this._curEl = this.root;\n // This prevents an infinite loop when speculativelyValidate is called to\n // validate a text node.\n this._setNodeProperty(this._curEl, \"EventIndexAfterStart\", this._validationEvents.length);\n this._setWorkingState(WorkingState.INCOMPLETE, 0);\n this._validationWalker = this.schema.newWalker(new salve_1.DefaultNameResolver());\n this.events = this._events;\n }\n makeKey(key) {\n return `${this._prefix}${key}`;\n }\n /**\n * Function allowing to get a custom properties set on ``Node`` objects by\n * this class.\n */\n getNodeProperty(node, key) {\n return node[this.makeKey(key)];\n }\n /**\n * Function allowing to set a custom properties set on ``Node`` objects by\n * this class.\n */\n _setNodeProperty(node, key, value) {\n node[this.makeKey(key)] = value;\n }\n _clearNodeProperties(node) {\n const anode = node;\n delete anode[this.makeKey(\"EventIndexAfter\")];\n delete anode[this.makeKey(\"EventIndexAfterStart\")];\n delete anode[this.makeKey(\"EventIndexBeforeAttributes\")];\n delete anode[this.makeKey(\"EventIndexAfterAttributes\")];\n delete anode[this.makeKey(\"PossibleDueToWildcard\")];\n delete anode[this.makeKey(\"ErrorId\")];\n }\n /**\n * Starts the background validation process.\n */\n start() {\n if (this._timeoutId !== undefined) {\n this._stop(WorkingState.WORKING);\n }\n // When we call ``this.start``, we want the validation to start ASAP. So we\n // do not use ``this._timeout`` here. However, we do not call\n // ``this._workWrapper`` directly because we want to be able to call\n // ``this.start`` from event handlers. If we did call ``this._workWrapper``\n // directly, we'd be calling this._cycle from inside this._cycle, which is\n // results in an internal error.\n this._timeoutId = setTimeout(this._boundWrapper, 0);\n }\n /**\n * Get the namespaces defined in the schema passed to the Validator.\n *\n * @returns The namespaces known to the schema.\n */\n getSchemaNamespaces() {\n return this.schema.getNamespaces();\n }\n /**\n * Get the namespaces used in the document. This method does not cache its\n * information and scan the whole document independently of the current\n * validation status.\n *\n * @returns An object whose keys are namespace prefixes and values are lists\n * of namespace URIs. The values are lists because prefixes can be redefined\n * in a document.\n */\n getDocumentNamespaces() {\n const ret = {};\n function _process(node) {\n if (node === null) {\n return;\n }\n const attrIxLim = node.attributes.length;\n for (let attrIx = 0; attrIx < attrIxLim; ++attrIx) {\n const attr = node.attributes[attrIx];\n if (attr.name.lastIndexOf(\"xmlns\", 0) === 0) {\n const key = attr.name.slice(6);\n let array = ret[key];\n if (array === undefined) {\n array = ret[key] = [];\n }\n array.push(attr.value);\n }\n }\n let child = node.firstChild;\n while (child !== null) {\n if (child.nodeType === Node.ELEMENT_NODE) {\n _process(child);\n }\n child = child.nextSibling;\n }\n }\n _process(this.root.firstChild);\n return ret;\n }\n /**\n * Convenience method. The bound version of this method\n * (``this._boundWrapper``) is what is called by the timeouts to perform the\n * background validation.\n */\n _workWrapper() {\n if (this._work()) {\n this._timeoutId = setTimeout(this._boundWrapper, this._timeout);\n }\n }\n /**\n * Controller method for the background validation. Keeps the validator\n * running only until done or until the maximum time span for one run\n * of the validator is reached.\n *\n * @returns False if there is no more work to do. True otherwise.\n */\n _work() {\n const startDate = Date.now();\n while (true) { // tslint:disable-line: no-constant-condition\n // Give a chance to other operations to work.\n if ((this._maxTimespan > 0) &&\n (Date.now() - startDate) >= this._maxTimespan) {\n return true;\n }\n const ret = this._cycle();\n if (!ret) {\n return false;\n }\n }\n }\n /**\n * Performs one cycle of validation. \"One cycle\" is an arbitrarily small unit\n * of work.\n *\n * @returns False if there is no more work to be done. True otherwise.\n *\n * @throws {Error} When there is an internal error.\n */\n // tslint:disable-next-line:max-func-body-length cyclomatic-complexity\n _cycle() {\n // If we got here after a reset, then we've finished resetting. If we were\n // not resetting, then this is a noop.\n this._resetting = false;\n //\n // This check is meant to catch problems that could be hard to diagnose if\n // wed or one of its modes had a bug such that `_cycle` is reentered from\n // `_cycle`. This could happen during error processing, for instance. Error\n // processing causes wed to process the errors, which causes changes in the\n // GUI tree, which *could* (this would be a bug) cause the code of a mode to\n // execute something like `getErrorsFor`, which could cause `_cycle` to be\n // reentered.\n //\n if (this._cycleEntered > 0) {\n throw new Error(\"internal error: _cycle is being reentered\");\n }\n if (this._cycleEntered < 0) {\n throw new Error(\"internal error: _cycleEntered negative\");\n }\n //\n // IMPORTANT: This variable must be decremented before exiting this\n // method. A try...finally statement is not used here because it would\n // prevent some virtual machines from optimizing this function.\n //\n this._cycleEntered++;\n const walker = this._validationWalker;\n const stack = this._validationStack;\n const events = this._validationEvents;\n let portion = stack[0].portion;\n let stage = this._validationStage;\n stage_change: while (true) { // tslint:disable-line: no-constant-condition\n let curEl = this._curEl;\n switch (stage) {\n case 1 /* START_TAG */: {\n // The logic is such that if we get here curEl must be an Element.\n curEl = curEl;\n stack.unshift(new ProgressState(this._partDone, portion));\n // Handle namespace declarations. Yes, this must happen before we deal\n // with the tag name.\n this._fireAndProcessEvent(walker, \"enterContext\", [], curEl, 0);\n const attrIxLim = curEl.attributes.length;\n for (let attrIx = 0; attrIx < attrIxLim; ++attrIx) {\n const attr = curEl.attributes[attrIx];\n let uri;\n if (attr.name === \"xmlns\") {\n uri = \"\";\n }\n else if (attr.name.lastIndexOf(\"xmlns:\", 0) === 0) {\n uri = attr.name.slice(6);\n }\n if (uri !== undefined) {\n this._fireAndProcessEvent(walker, \"definePrefix\", [uri, attr.value], curEl, 0);\n }\n }\n const tagName = curEl.tagName;\n // tslint:disable-next-line:no-non-null-assertion\n const parent = curEl.parentNode;\n const curElIndex = _indexOf(parent.childNodes, curEl);\n let ename = walker.nameResolver.resolveName(tagName, false);\n if (ename === undefined) {\n this._processEventResult([new salve_1.ValidationError(`cannot resolve the name ${tagName}`)], parent, curElIndex);\n // This allows us to move forward. It will certainly cause a\n // validation error, and send salve into its recovery mode for unknown\n // elements.\n ename = new salve_1.EName(\"\", tagName);\n }\n // Check whether this element is going to be allowed only due to a\n // wildcard.\n this._setPossibleDueToWildcard(curEl, walker, \"enterStartTag\", ename.ns, ename.name);\n this._fireAndProcessEvent(walker, \"enterStartTag\", [ename.ns, ename.name], parent, curElIndex);\n this._setNodeProperty(curEl, \"EventIndexBeforeAttributes\", events.length);\n this._fireAttributeEvents(walker, curEl);\n this._setNodeProperty(curEl, \"EventIndexAfterAttributes\", events.length);\n // Leave the start tag.\n this._fireAndProcessEvent(walker, \"leaveStartTag\", [], curEl, 0);\n stage = this._validationStage = 2 /* CONTENTS */;\n this._setNodeProperty(curEl, \"EventIndexAfterStart\", events.length);\n this._cycleEntered--;\n return true; // state change\n // break would be unreachable.\n }\n case 2 /* CONTENTS */: {\n let node = (this._previousChild === null) ?\n // starting from scratch\n curEl.firstChild :\n // already validation contents\n this._previousChild.nextSibling;\n let textAccumulator = \"\";\n let textAccumulatorNode;\n const flushText = () => {\n if (textAccumulator !== \"\") {\n const eventResult = walker.fireEvent(\"text\", [textAccumulator]);\n if (eventResult instanceof Array) {\n if (textAccumulatorNode === undefined) {\n throw new Error(\"flushText running with undefined node\");\n }\n // We are never without a parentNode here.\n // tslint:disable-next-line:no-non-null-assertion\n const parent = textAccumulatorNode.parentNode;\n this._processEventResult(eventResult, parent, _indexOf(parent.childNodes, textAccumulatorNode));\n }\n }\n textAccumulator = \"\";\n textAccumulatorNode = undefined;\n };\n while (node !== null) {\n switch (node.nodeType) {\n case Node.TEXT_NODE:\n // Salve does not allow multiple text events in a row. If text is\n // encountered, then all the text must be passed to salve as a\n // single event. We record the text and will flush it to salve\n // later.\n textAccumulator += node.data;\n if (textAccumulatorNode === undefined) {\n textAccumulatorNode = node;\n }\n break;\n case Node.ELEMENT_NODE:\n flushText();\n portion /= curEl.childElementCount;\n this._curEl = curEl = node;\n stage = this._validationStage = 1 /* START_TAG */;\n this._previousChild = null;\n continue stage_change;\n case Node.COMMENT_NODE:\n break; // We just skip over comment nodes.\n default:\n throw new Error(`unexpected node type: ${node.nodeType}`);\n }\n node = node.nextSibling;\n }\n flushText();\n stage = this._validationStage = 3 /* END_TAG */;\n break;\n }\n case 3 /* END_TAG */: {\n // We've reached the end...\n if (curEl === this.root) {\n const eventResult = walker.end();\n if (eventResult instanceof Array) {\n this._processEventResult(eventResult, curEl, curEl.childNodes.length);\n }\n this._runDocumentValidation();\n this._setNodeProperty(curEl, \"EventIndexAfter\", events.length);\n this._partDone = 1;\n this._stop(this._errors.length > 0 ? WorkingState.INVALID :\n WorkingState.VALID);\n this._cycleEntered--;\n return false;\n }\n // we need it later\n const originalElement = curEl;\n const tagName = curEl.tagName;\n let ename = walker.nameResolver.resolveName(tagName, false);\n if (ename === undefined) {\n // We just produce the name name we produced when we encountered the\n // start tag.\n ename = new salve_1.EName(\"\", tagName);\n }\n this._fireAndProcessEvent(walker, \"endTag\", [ename.ns, ename.name], curEl, curEl.childNodes.length);\n this._fireAndProcessEvent(walker, \"leaveContext\", [], curEl, curEl.childNodes.length);\n // Go back to the parent\n this._previousChild = curEl;\n // We are never without a parentNode here.\n // tslint:disable-next-line:no-non-null-assertion\n this._curEl = curEl = curEl.parentNode;\n let nextDone = this._partDone;\n if (curEl !== this.root) {\n stack.shift();\n const first = stack[0];\n nextDone = first.partDone += portion;\n portion = first.portion;\n }\n this._setWorkingState(WorkingState.WORKING, nextDone);\n this._setNodeProperty(originalElement, \"EventIndexAfter\", this._validationEvents.length);\n stage = this._validationStage = 2 /* CONTENTS */;\n this._cycleEntered--;\n return true; // state_change\n }\n // break; would be unreachable\n default:\n throw new Error(\"unexpected state\");\n }\n }\n }\n /**\n * Stops background validation.\n */\n stop() {\n this._stop();\n }\n /**\n * This private method takes an argument that allows setting the working state\n * to a specific value. This is useful to reduce the number of\n * ``state-update`` events emitted when some internal operations are\n * performed. The alternative would be to perform a state change before or\n * after the call to ``stop``, which would result in more events being\n * emitted.\n *\n * If the parameter is unused, then the logic is that if we were not yet in a\n * VALID or INVALID state, the stopping now leads to the INCOMPLETE state.\n *\n * @param state The state with which to stop.\n */\n _stop(state) {\n if (this._timeoutId !== undefined) {\n clearTimeout(this._timeoutId);\n }\n this._timeoutId = undefined;\n if (state === undefined) {\n // We are stopping prematurely, update the state\n if (this._workingState === WorkingState.WORKING) {\n this._setWorkingState(WorkingState.INCOMPLETE, this._partDone);\n }\n }\n else {\n this._setWorkingState(state, this._partDone);\n }\n }\n /**\n * Run document-level validation that cannot be modeled by Relax NG. The\n * default implementation does nothing. Deriving classes may override it to\n * call [[_processError]].\n */\n _runDocumentValidation() { } // tslint:disable-line: no-empty\n /**\n * Restarts validation from a specific point. After the call returns, the\n * background validation will be in effect. (So calling it on a stopped\n * validator has the side effect of starting it.)\n *\n * @param node The element to start validation from.\n */\n restartAt(node) {\n this.resetTo(node);\n this.start();\n }\n /**\n * Reset validation to continue from a certain point.\n *\n * @param node The element to start validation from.\n */\n resetTo(node) {\n // We use `this._resetting` to avoid a costly reinitialization if this\n // method is called twice in a row before any work has had a chance to be\n // done.\n if (!this._resetting) {\n this._resetting = true;\n this._resetTo(node);\n }\n }\n _erase(el) {\n this._clearNodeProperties(el);\n let child = el.firstElementChild;\n while (child !== null) {\n this._erase(child);\n child = child.nextElementSibling;\n }\n }\n /**\n * Resets validation to continue from a specific point. Any further work done\n * by the validator will start from the point specified.\n *\n * @param node The element to start validation from.\n *\n * @emits module:validator~Validator#reset-errors\n */\n // @ts-ignore\n _resetTo(node) {\n // An earlier implementation was trying to be clever and to avoid restarting\n // much earlier than strictly needed. That ended up being more costly than\n // doing this primitive restart from 0 no matter what. Eventually, Validator\n // should be updated so that on large documents, restarting from a location\n // towards the end does not require revalidating the whole document. For\n // now, since wed is used for smallish documents, it would be a premature\n // optimization.\n this._erase(this.root);\n this._validationStage = 2 /* CONTENTS */;\n this._previousChild = null;\n this._validationWalker = this.schema.newWalker(new salve_1.DefaultNameResolver());\n this._validationEvents = [];\n this._curEl = this.root;\n this._partDone = 0;\n this._errors = [];\n this._errorsSeen = Object.create(null);\n this._walkerCache = Object.create(null);\n this._walkerCacheMax = -1;\n /**\n * Tells the listener that it must reset its list of errors.\n *\n * @event module:validator~Validator#reset-errors\n * @type {Object}\n * @property {integer} at The index of the first error that must\n * be deleted. This error and all those after it mus