diff options
Diffstat (limited to 'alarm/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js')
-rw-r--r-- | alarm/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/alarm/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js b/alarm/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js new file mode 100644 index 0000000..765fe77 --- /dev/null +++ b/alarm/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js @@ -0,0 +1,35 @@ +'use strict'; + +const Mixin = require('../../utils/mixin'); + +class LocationInfoOpenElementStackMixin extends Mixin { + constructor(stack, opts) { + super(stack); + + this.onItemPop = opts.onItemPop; + } + + _getOverriddenMethods(mxn, orig) { + return { + pop() { + mxn.onItemPop(this.current); + orig.pop.call(this); + }, + + popAllUpToHtmlElement() { + for (let i = this.stackTop; i > 0; i--) { + mxn.onItemPop(this.items[i]); + } + + orig.popAllUpToHtmlElement.call(this); + }, + + remove(element) { + mxn.onItemPop(this.current); + orig.remove.call(this, element); + } + }; + } +} + +module.exports = LocationInfoOpenElementStackMixin; |