diff --git a/dist/dom.d.ts b/dist/dom.d.ts
index c767411..bc4404d 100644
--- a/dist/dom.d.ts
+++ b/dist/dom.d.ts
@@ -49,6 +49,12 @@ export interface IDom {
*/
createElement(tagName: string): Element;
/**
+ * Creates the specified HTML attribute
+ * @param name A string that specifies the name of attribute to be created.
+ * @return The created attribute.
+ */
+ createAttribute(name: string): Attr;
+ /**
* Creates a new Text node.
* @param text A string to populate the new Text node.
* @return A Text node.
diff --git a/dist/dom.js b/dist/dom.js
index 3f1cffb..fea3d1b 100644
--- a/dist/dom.js
+++ b/dist/dom.js
@@ -1,3 +1,4 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=dom.js.map
diff --git a/dist/feature.js b/dist/feature.js
index 5f1f695..defefb9 100644
--- a/dist/feature.js
+++ b/dist/feature.js
@@ -1,3 +1,4 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=feature.js.map
diff --git a/dist/global.d.ts b/dist/global.d.ts
index 0f5b582..e3b71c5 100644
--- a/dist/global.d.ts
+++ b/dist/global.d.ts
@@ -1,6 +1,8 @@
-export interface IGlobal extends Window {
+import { DOMWindow, JSDOM } from 'jsdom';
+export interface IGlobal extends DOMWindow {
MutationObserver: typeof MutationObserver;
Element: typeof Element;
+ jsdom: typeof JSDOM;
SVGElement: typeof SVGElement;
XMLHttpRequest: typeof XMLHttpRequest;
CustomEvent: typeof CustomEvent;
diff --git a/dist/global.js b/dist/global.js
index d9c9594..ec9e79b 100644
--- a/dist/global.js
+++ b/dist/global.js
@@ -1,3 +1,4 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=global.js.map
diff --git a/dist/index.d.ts b/dist/index.d.ts
index 195d9d4..7d921bf 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -1,5 +1,4 @@
///
-///
/**
* Initializes the PAL with the NodeJS-targeted implementation.
*/
@@ -8,3 +7,4 @@ export declare function initialize(): void;
* @description initializes and makes variables like 'window' into NodeJS globals
*/
export declare function globalize(): NodeJS.Global;
+export declare function reset(window?: Window): void;
diff --git a/dist/index.js b/dist/index.js
index 35deb4f..72e6b5e 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,7 +1,9 @@
-///
"use strict";
+///
+Object.defineProperty(exports, "__esModule", { value: true });
const aurelia_pal_1 = require("aurelia-pal");
const nodejs_pal_builder_1 = require("./nodejs-pal-builder");
+const mutation_observer_1 = require("./polyfills/mutation-observer");
/**
* Initializes the PAL with the NodeJS-targeted implementation.
*/
@@ -93,5 +95,12 @@ function globalize() {
return global;
}
exports.globalize = globalize;
+function reset(window) {
+ if (window) {
+ window.close();
+ }
+ mutation_observer_1.MutationNotifier.getInstance().destruct();
+}
+exports.reset = reset;
//# sourceMappingURL=index.js.map
diff --git a/dist/index.js.map b/dist/index.js.map
index a6fd885..93285f7 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,2CAA2C;;AAE3C,6CAAmF;AACnF,6DAAgD;AAEhD;;EAEE;AACF;IACE,EAAE,CAAC,CAAC,2BAAa,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC;IACT,CAAC;IAED,IAAI,GAAG,GAAG,6BAAQ,EAAE,CAAC;IAErB,2BAAa,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG;QACnC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEpE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAE1D,MAAM,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C,QAAQ,CAAC;IAC3C,MAAM,CAAC,OAAO,GAAG,iBAAG,CAAC,OAAO,CAAC;IAC7B,MAAM,CAAC,UAAU,GAAG,iBAAG,CAAC,UAAU,CAAC;IACnC,MAAM,CAAC,WAAW,GAAG,sBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;IACjD,MAAM,CAAC,qBAAqB,GAAG,sBAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC;IACrE,MAAM,CAAC,QAAQ,GAAG,sBAAQ,CAAC,QAAQ,CAAC;IACpC,MAAM,CAAC,OAAO,GAAG,sBAAQ,CAAC,OAAO,CAAC;IAClC,MAAM,CAAC,MAAM,GAAG;QACd,MAAM,CAAC,QAAgB;YACrB,IAAI,CAAC;gBACH,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC5C,CAAE;YAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACX,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACF,CAAC;IACF,MAAM,CAAC,GAAG,GAAG;QACX,GAAG,EAAH,iBAAG,EAAE,QAAQ,EAAR,sBAAQ,EAAE,OAAO,EAAP,qBAAO;KACvB,CAAC;IACF,MAAM,CAAC,MAAM,CAAC;AAChB,CAAC;AAvBD,8BAuBC","file":"index.js","sourcesContent":["/// \n\nimport { initializePAL, DOM, PLATFORM, FEATURE, isInitialized } from 'aurelia-pal';\nimport { buildPal } from './nodejs-pal-builder';\n\n/**\n* Initializes the PAL with the NodeJS-targeted implementation.\n*/\nexport function initialize(): void {\n if (isInitialized) {\n return;\n }\n\n let pal = buildPal();\n\n initializePAL((platform, feature, dom) => {\n Object.assign(platform, pal.platform);\n Object.setPrototypeOf(platform, pal.platform.constructor.prototype);\n\n Object.assign(dom, pal.dom);\n Object.setPrototypeOf(dom, pal.dom.constructor.prototype);\n\n Object.assign(feature, pal.feature);\n Object.setPrototypeOf(feature, pal.feature.constructor.prototype);\n\n (function (global) {\n global.console = global.console || {};\n let con = global.console;\n let prop;\n let method;\n let empty = {};\n let dummy = function () { };\n let properties = 'memory'.split(',');\n let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = empty;\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n })(platform.global);\n\n if (platform.global.console && typeof console.log === 'object') {\n if (typeof console['debug'] === 'undefined') {\n console['debug'] = this.bind(console['log'], console);\n }\n ['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) {\n console[method] = this.bind(console[method], console);\n }, Function.prototype.call);\n }\n\n Object.defineProperty(dom, 'title', {\n get: function () {\n return pal.global.document.title;\n },\n set: function (value) {\n pal.global.document.title = value;\n }\n });\n\n Object.defineProperty(dom, 'activeElement', {\n get: function () {\n return pal.global.document.activeElement;\n }\n });\n\n Object.defineProperty(platform, 'XMLHttpRequest', {\n get: function () {\n return pal.global.XMLHttpRequest;\n }\n });\n });\n}\n\n/**\n * @description initializes and makes variables like 'window' into NodeJS globals\n */\nexport function globalize() {\n initialize();\n global.window = global.self = PLATFORM.global;\n global.document = PLATFORM.global.document;\n global.Element = DOM.Element;\n global.SVGElement = DOM.SVGElement;\n global.HTMLElement = PLATFORM.global.HTMLElement;\n global.requestAnimationFrame = PLATFORM.global.requestAnimationFrame;\n global.location = PLATFORM.location;\n global.history = PLATFORM.history;\n global.System = {\n import(moduleId: string) {\n try {\n return Promise.resolve(require(moduleId));\n } catch (e) {\n return Promise.reject(e);\n }\n }\n };\n global.PAL = {\n DOM, PLATFORM, FEATURE\n };\n return global;\n}"],"sourceRoot":"../src/"}
\ No newline at end of file
+{"version":3,"sources":["index.ts"],"names":[],"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AAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACF,CAAC;IACF,MAAM,CAAC,GAAG,GAAG;QACX,GAAG,EAAH,iBAAG,EAAE,QAAQ,EAAR,sBAAQ,EAAE,OAAO,EAAP,qBAAO;KACvB,CAAC;IACF,MAAM,CAAC,MAAM,CAAC;AAChB,CAAC;AAvBD,8BAuBC;AAED,eAAsB,MAAe;IACnC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACX,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,oCAAgB,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC;AAC5C,CAAC;AAND,sBAMC","file":"index.js","sourcesContent":["/// \n\nimport { initializePAL, DOM, PLATFORM, FEATURE, isInitialized } from 'aurelia-pal';\nimport { buildPal } from './nodejs-pal-builder';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\n/**\n* Initializes the PAL with the NodeJS-targeted implementation.\n*/\nexport function initialize(): void {\n if (isInitialized) {\n return;\n }\n\n let pal = buildPal();\n\n initializePAL((platform, feature, dom) => {\n Object.assign(platform, pal.platform);\n Object.setPrototypeOf(platform, pal.platform.constructor.prototype);\n\n Object.assign(dom, pal.dom);\n Object.setPrototypeOf(dom, pal.dom.constructor.prototype);\n\n Object.assign(feature, pal.feature);\n Object.setPrototypeOf(feature, pal.feature.constructor.prototype);\n\n (function (global) {\n global.console = global.console || {};\n let con = global.console;\n let prop;\n let method;\n let empty = {};\n let dummy = function () { };\n let properties = 'memory'.split(',');\n let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = empty;\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n })(platform.global);\n\n if (platform.global.console && typeof console.log === 'object') {\n if (typeof console['debug'] === 'undefined') {\n console['debug'] = this.bind(console['log'], console);\n }\n ['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) {\n console[method] = this.bind(console[method], console);\n }, Function.prototype.call);\n }\n\n Object.defineProperty(dom, 'title', {\n get: function () {\n return pal.global.document.title;\n },\n set: function (value) {\n pal.global.document.title = value;\n }\n });\n\n Object.defineProperty(dom, 'activeElement', {\n get: function () {\n return pal.global.document.activeElement;\n }\n });\n\n Object.defineProperty(platform, 'XMLHttpRequest', {\n get: function () {\n return pal.global.XMLHttpRequest;\n }\n });\n });\n}\n\n/**\n * @description initializes and makes variables like 'window' into NodeJS globals\n */\nexport function globalize() {\n initialize();\n global.window = global.self = PLATFORM.global;\n global.document = PLATFORM.global.document;\n global.Element = DOM.Element;\n global.SVGElement = DOM.SVGElement;\n global.HTMLElement = PLATFORM.global.HTMLElement;\n global.requestAnimationFrame = PLATFORM.global.requestAnimationFrame;\n global.location = PLATFORM.location;\n global.history = PLATFORM.history;\n global.System = {\n import(moduleId: string) {\n try {\n return Promise.resolve(require(moduleId));\n } catch (e) {\n return Promise.reject(e);\n }\n }\n };\n global.PAL = {\n DOM, PLATFORM, FEATURE\n };\n return global;\n}\n\nexport function reset(window?: Window) {\n if (window) {\n window.close();\n }\n\n MutationNotifier.getInstance().destruct();\n}"],"sourceRoot":"../src/"}
\ No newline at end of file
diff --git a/dist/nodejs-dom.d.ts b/dist/nodejs-dom.d.ts
index 862e8ef..b5f9abe 100644
--- a/dist/nodejs-dom.d.ts
+++ b/dist/nodejs-dom.d.ts
@@ -14,9 +14,11 @@ export declare class NodeJsDom implements IDom {
addEventListener(eventName: string, callback: EventListener, capture: boolean): void;
removeEventListener(eventName: string, callback: EventListener, capture: boolean): void;
createElement(tagName: string): Element;
+ createAttribute(name: string): Attr;
createTextNode(text: string): Text;
createComment(text: string): Comment;
createDocumentFragment(): DocumentFragment;
+ createTemplateElement(): HTMLTemplateElement;
createMutationObserver(callback: (changes: MutationRecord[], instance: MutationObserver) => void): MutationObserver;
createCustomEvent(eventType: string, options: Object): CustomEvent;
dispatchEvent(evt: Event): void;
diff --git a/dist/nodejs-dom.js b/dist/nodejs-dom.js
index e06626e..b8ab914 100644
--- a/dist/nodejs-dom.js
+++ b/dist/nodejs-dom.js
@@ -1,4 +1,5 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
/**
* Represents the core APIs of the DOM.
*/
@@ -21,6 +22,9 @@ class NodeJsDom {
createElement(tagName) {
return this.global.document.createElement(tagName);
}
+ createAttribute(name) {
+ return this.global.document.createAttribute(name);
+ }
createTextNode(text) {
return this.global.document.createTextNode(text);
}
@@ -30,6 +34,9 @@ class NodeJsDom {
createDocumentFragment() {
return this.global.document.createDocumentFragment();
}
+ createTemplateElement() {
+ return this.global.document.createElement('template');
+ }
createMutationObserver(callback) {
return new (this.global.window.MutationObserver)(callback);
}
diff --git a/dist/nodejs-dom.js.map b/dist/nodejs-dom.js.map
index 9f84631..7df2a7e 100644
--- a/dist/nodejs-dom.js.map
+++ b/dist/nodejs-dom.js.map
@@ -1 +1 @@
-{"version":3,"sources":["nodejs-dom.ts"],"names":[],"mappings":";AAGA;;EAEE;AACF;IAEE,YAAmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QAOlC,aAAQ,GAAW,sBAAsB,CAAC;QAC1C,UAAK,GAAW,EAAE,CAAC;QACnB,kBAAa,GAAY,IAAI,CAAC;QAR5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,gBAAiB,SAAQ,MAAM,CAAC,OAAO;SAAI,CAAC;IACrF,CAAC;IAQD,gBAAgB,CAAC,SAAiB,EAAE,QAAuB,EAAE,OAAgB;QAC3E,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,E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;YACN,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,IAAU;QAClB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,UAAU,CAAC,OAAa,EAAE,UAAiB;QACzC,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,WAAW,CAAC,OAAa,EAAE,IAAU,EAAE,UAAiB;QACtD,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC9C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,UAAU,CAAC,IAAU,EAAE,UAAiB;QACtC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,CAAC;YACJ,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AAtGD,8BAsGC","file":"nodejs-dom.js","sourcesContent":["import { IDom } from './dom';\nimport { IGlobal } from './global';\n\n/**\n* Represents the core APIs of the DOM.\n*/\nexport class NodeJsDom implements IDom {\n\n constructor(public global: IGlobal) {\n this.Element = global.Element;\n this.SVGElement = global.SVGElement || class SVGElement extends global.Element { };\n }\n\n Element: typeof Element;\n SVGElement: typeof SVGElement /* until a proper implementation is ready: */ | any;\n boundary: string = 'aurelia-dom-boundary';\n title: string = \"\";\n activeElement: Element = null;\n\n addEventListener(eventName: string, callback: EventListener, capture: boolean): void {\n return this.global.document.addEventListener(eventName, callback, capture);\n }\n removeEventListener(eventName: string, callback: EventListener, capture: boolean): void {\n return this.global.document.removeEventListener(eventName, callback, capture);\n }\n createElement(tagName: string): Element {\n return this.global.document.createElement(tagName);\n }\n createTextNode(text: string): Text {\n return this.global.document.createTextNode(text);\n }\n createComment(text: string): Comment {\n return this.global.document.createComment(text);\n }\n createDocumentFragment(): DocumentFragment {\n return this.global.document.createDocumentFragment();\n }\n createMutationObserver(callback: (changes: MutationRecord[], instance: MutationObserver) => void): MutationObserver {\n return new ((this.global.window).MutationObserver)(callback);\n }\n createCustomEvent(eventType: string, options: Object): CustomEvent {\n return new this.global.CustomEvent(eventType, options);\n }\n dispatchEvent(evt: Event): void {\n this.global.window.dispatchEvent(evt);\n }\n getComputedStyle(element: Element): CSSStyleDeclaration {\n return this.global.window.getComputedStyle(element);\n }\n getElementById(id: string): Element {\n return this.global.document.getElementById(id);\n }\n querySelectorAll(query: string): NodeList {\n return this.global.document.querySelectorAll(query);\n }\n nextElementSibling(element: Element): Element {\n return element.nextElementSibling;\n }\n createTemplateFromMarkup(markup: string): Element {\n let parser = this.global.document.createElement('div');\n parser.innerHTML = markup;\n\n let temp = parser.firstElementChild;\n if (!temp || temp.nodeName !== 'TEMPLATE') {\n throw new Error('Template markup must be wrapped in a element e.g. ');\n }\n return temp;\n }\n\n injectStyles(styles: string, destination?: Element, prepend?: boolean): Node {\n let node = this.global.document.createElement('style');\n node.innerHTML = styles;\n node.type = 'text/css';\n\n destination = destination || this.global.document.head;\n\n if (prepend && destination.childNodes.length > 0) {\n destination.insertBefore(node, destination.childNodes[0]);\n } else {\n destination.appendChild(node);\n }\n return node;\n }\n\n adoptNode(node: Node): Node {\n return this.global.document.adoptNode(node);\n }\n\n appendNode(newNode: Node, parentNode?: Node): void {\n (parentNode || this.global.document.body).appendChild(newNode);\n }\n\n replaceNode(newNode: Node, node: Node, parentNode?: Node): void {\n if (node.parentNode) {\n node.parentNode.replaceChild(newNode, node);\n } else {\n parentNode.replaceChild(newNode, node);\n }\n }\n\n removeNode(node: Node, parentNode?: Node): void {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n else {\n parentNode.removeChild(node);\n }\n }\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
+{"version":3,"sources":["nodejs-dom.ts"],"names":[],"mappings":";;AAGA;;EAEE;AACF;IAEE,YAAmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QAOlC,aAAQ,GAAW,sBAAsB,CAAC;QAC1C,UAAK,GAAW,EAAE,CAAC;QACnB,kBAAa,GAAY,IAAI,CAAC;QAR5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,gBAAiB,SAAQ,MAAM,CAAC,OAAO;SAAI,CAAC;IACrF,CAAC;IAQD,gBAAgB,CAAC,SAAiB,EAAE,QAAuB,EAAE,OAAgB;QAC3E,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IACD,mBAAmB,CAAC,SAAiB,EAAE,QAAuB,EAAE,OAAgB;QAC9E,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IACD,aAAa,CAAC,OAAe;QAC3B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IACD,eAAe,CAAC,IAAY;QAC1B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IACD,cAAc,CAAC,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,EAAE,UAAiB;QACzC,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,WAAW,CAAC,OAAa,EAAE,IAAU,EAAE,UAAiB;QACtD,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC9C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,UAAU,CAAC,IAAU,EAAE,UAAiB;QACtC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,CAAC;YACJ,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AA5GD,8BA4GC","file":"nodejs-dom.js","sourcesContent":["import { IDom } from './dom';\nimport { IGlobal } from './global';\n\n/**\n* Represents the core APIs of the DOM.\n*/\nexport class NodeJsDom implements IDom {\n\n constructor(public global: IGlobal) {\n this.Element = global.Element;\n this.SVGElement = global.SVGElement || class SVGElement extends global.Element { };\n }\n\n Element: typeof Element;\n SVGElement: typeof SVGElement /* until a proper implementation is ready: */ | any;\n boundary: string = 'aurelia-dom-boundary';\n title: string = \"\";\n activeElement: Element = null;\n\n addEventListener(eventName: string, callback: EventListener, capture: boolean): void {\n return this.global.document.addEventListener(eventName, callback, capture);\n }\n removeEventListener(eventName: string, callback: EventListener, capture: boolean): void {\n return this.global.document.removeEventListener(eventName, callback, capture);\n }\n createElement(tagName: string): Element {\n return this.global.document.createElement(tagName);\n }\n createAttribute(name: string): Attr {\n return this.global.document.createAttribute(name);\n }\n createTextNode(text: string): Text {\n return this.global.document.createTextNode(text);\n }\n createComment(text: string): Comment {\n return this.global.document.createComment(text);\n }\n createDocumentFragment(): DocumentFragment {\n return this.global.document.createDocumentFragment();\n }\n createTemplateElement(): HTMLTemplateElement {\n return this.global.document.createElement('template');\n }\n createMutationObserver(callback: (changes: MutationRecord[], instance: MutationObserver) => void): MutationObserver {\n return new ((this.global.window).MutationObserver)(callback);\n }\n createCustomEvent(eventType: string, options: Object): CustomEvent {\n return new this.global.CustomEvent(eventType, options);\n }\n dispatchEvent(evt: Event): void {\n this.global.window.dispatchEvent(evt);\n }\n getComputedStyle(element: Element): CSSStyleDeclaration {\n return this.global.window.getComputedStyle(element);\n }\n getElementById(id: string): Element {\n return this.global.document.getElementById(id);\n }\n querySelectorAll(query: string): NodeList {\n return this.global.document.querySelectorAll(query);\n }\n nextElementSibling(element: Element): Element {\n return element.nextElementSibling;\n }\n createTemplateFromMarkup(markup: string): Element {\n let parser = this.global.document.createElement('div');\n parser.innerHTML = markup;\n\n let temp = parser.firstElementChild;\n if (!temp || temp.nodeName !== 'TEMPLATE') {\n throw new Error('Template markup must be wrapped in a element e.g. ');\n }\n return temp;\n }\n\n injectStyles(styles: string, destination?: Element, prepend?: boolean): Node {\n let node = this.global.document.createElement('style');\n node.innerHTML = styles;\n node.type = 'text/css';\n\n destination = destination || this.global.document.head;\n\n if (prepend && destination.childNodes.length > 0) {\n destination.insertBefore(node, destination.childNodes[0]);\n } else {\n destination.appendChild(node);\n }\n return node;\n }\n\n adoptNode(node: Node): Node {\n return this.global.document.adoptNode(node);\n }\n\n appendNode(newNode: Node, parentNode?: Node): void {\n (parentNode || this.global.document.body).appendChild(newNode);\n }\n\n replaceNode(newNode: Node, node: Node, parentNode?: Node): void {\n if (node.parentNode) {\n node.parentNode.replaceChild(newNode, node);\n } else {\n parentNode.replaceChild(newNode, node);\n }\n }\n\n removeNode(node: Node, parentNode?: Node): void {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n else {\n parentNode.removeChild(node);\n }\n }\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
diff --git a/dist/nodejs-feature.js b/dist/nodejs-feature.js
index fe030ee..16e78ad 100644
--- a/dist/nodejs-feature.js
+++ b/dist/nodejs-feature.js
@@ -1,4 +1,5 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
class NodeJsFeature {
constructor(global) {
this.global = global;
diff --git a/dist/nodejs-feature.js.map b/dist/nodejs-feature.js.map
index 70695ad..c64b35a 100644
--- a/dist/nodejs-feature.js.map
+++ b/dist/nodejs-feature.js.map
@@ -1 +1 @@
-{"version":3,"sources":["nodejs-feature.ts"],"names":[],"mappings":";AAGA;IACE,YAAoB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QACjC,IAAI,CAAC,SAAS,GAAS,IAAI,CAAC,MAAM,CAAC,MAAO,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC;QAC3F,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,UAAU;IAC1C,CAAC;CAMF;AAZD,sCAYC","file":"nodejs-feature.js","sourcesContent":["import { IFeature } from './feature';\nimport { IGlobal } from './global';\n\nexport class NodeJsFeature implements IFeature {\n constructor(private global: IGlobal) {\n this.shadowDOM = (this.global.window).HTMLElement.prototype.attachShadow != undefined;\n this.scopedCSS = 'scoped' in this.global.document.createElement('style');\n this.htmlTemplateElement = true;\n this.mutationObserver = true; // partial\n }\n\n shadowDOM: boolean;\n scopedCSS: boolean;\n htmlTemplateElement: boolean;\n mutationObserver: boolean;\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
+{"version":3,"sources":["nodejs-feature.ts"],"names":[],"mappings":";;AAGA;IACE,YAAoB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QACjC,IAAI,CAAC,SAAS,GAAS,IAAI,CAAC,MAAM,CAAC,MAAO,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC;QAC3F,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,UAAU;IAC1C,CAAC;CAMF;AAZD,sCAYC","file":"nodejs-feature.js","sourcesContent":["import { IFeature } from './feature';\nimport { IGlobal } from './global';\n\nexport class NodeJsFeature implements IFeature {\n constructor(private global: IGlobal) {\n this.shadowDOM = (this.global.window).HTMLElement.prototype.attachShadow != undefined;\n this.scopedCSS = 'scoped' in this.global.document.createElement('style');\n this.htmlTemplateElement = true;\n this.mutationObserver = true; // partial\n }\n\n shadowDOM: boolean;\n scopedCSS: boolean;\n htmlTemplateElement: boolean;\n mutationObserver: boolean;\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
diff --git a/dist/nodejs-pal-builder.js b/dist/nodejs-pal-builder.js
index 414219d..6dc620c 100644
--- a/dist/nodejs-pal-builder.js
+++ b/dist/nodejs-pal-builder.js
@@ -1,22 +1,22 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
const nodejs_platform_1 = require("./nodejs-platform");
const nodejs_feature_1 = require("./nodejs-feature");
const nodejs_dom_1 = require("./nodejs-dom");
const jsdom_1 = require("jsdom");
-const jsdom_whole_text_1 = require("./polyfills/jsdom-whole-text");
const mutation_observer_1 = require("./polyfills/mutation-observer");
const mutation_observer_2 = require("./polyfills/mutation-observer");
let _patchedjsdom = false;
function buildPal() {
- var global = jsdom_1.jsdom(undefined, {}).defaultView;
+ var jsdom = new jsdom_1.JSDOM(undefined, {});
+ var global = jsdom.window;
if (!_patchedjsdom) {
patchNotifyChange(global);
- jsdom_whole_text_1.polyfillWholeText();
_patchedjsdom = true;
}
ensurePerformance(global.window);
ensureMutationObserver(global.window);
- var platform = new nodejs_platform_1.NodeJsPlatform(global);
+ var platform = new nodejs_platform_1.NodeJsPlatform(global, jsdom);
var dom = new nodejs_dom_1.NodeJsDom(global);
var feature = new nodejs_feature_1.NodeJsFeature(global);
return {
diff --git a/dist/nodejs-pal-builder.js.map b/dist/nodejs-pal-builder.js.map
index b0e7cfa..1b1ebab 100644
--- a/dist/nodejs-pal-builder.js.map
+++ b/dist/nodejs-pal-builder.js.map
@@ -1 +1 @@
-{"version":3,"sources":["nodejs-pal-builder.ts"],"names":[],"mappings":";AAKA,uDAAmD;AACnD,qDAAiD;AACjD,6CAAyC;AACzC,iCAA8B;AAC9B,mEAAiE;AACjE,qEAAiE;AACjE,qEAAiE;AAEjE,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;IACE,IAAI,MAAM,GAAqB,aAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC;IAEhE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QACnB,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,oCAAiB,EAAE,CAAC;QACpB,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,QAAQ,GAAG,IAAI,gCAAc,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,GAAG,GAAG,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,OAAO,GAAG,IAAI,8BAAa,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,CAAC;QACL,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;QAClB,GAAG,EAAE,GAAG;QACR,OAAO,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AAC,CAAC,CAAC;QAC7B,MAAM,CAAC,gBAAgB,GAAG,oCAAgB,CAAC;IAC7C,CAAC;AACH,CAAC","file":"nodejs-pal-builder.js","sourcesContent":["import { initializePAL } from 'aurelia-pal';\nimport { IPlatform } from './platform';\nimport { IGlobal } from './global';\nimport { IDom } from './dom';\nimport { IFeature } from './feature';\nimport { NodeJsPlatform } from './nodejs-platform';\nimport { NodeJsFeature } from './nodejs-feature';\nimport { NodeJsDom } from './nodejs-dom';\nimport { jsdom } from 'jsdom';\nimport { polyfillWholeText } from './polyfills/jsdom-whole-text';\nimport { MutationObserver } from './polyfills/mutation-observer';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\nlet _patchedjsdom = false;\n\nexport function buildPal(): { global: IGlobal, platform: IPlatform, dom: IDom, feature: IFeature } {\n var global: IGlobal = jsdom(undefined, {}).defaultView;\n\n if (!_patchedjsdom) {\n patchNotifyChange(global);\n polyfillWholeText();\n _patchedjsdom = true;\n }\n\n ensurePerformance(global.window);\n ensureMutationObserver(global.window);\n\n var platform = new NodeJsPlatform(global);\n var dom = new NodeJsDom(global);\n var feature = new NodeJsFeature(global);\n\n return {\n global: global,\n platform: platform,\n dom: dom,\n feature: feature\n };\n}\n\nlet intersectSetter = function (proto, propertyName: string, intersect: Function) {\n let old = Object.getOwnPropertyDescriptor(proto, propertyName);\n let oldSet = old.set;\n let newSet = function set(V) {\n oldSet.call(this, V);\n intersect(this);\n };\n Object.defineProperty(proto, propertyName, {\n set: newSet,\n get: old.get,\n configurable: old.configurable,\n enumerable: old.enumerable\n });\n};\n\nlet intersectMethod = function (proto, methodName: string, intersect: Function) {\n let orig = proto[methodName];\n proto[methodName] = function (...args) {\n var ret = orig.apply(this, args);\n intersect(this);\n return ret;\n };\n};\n\nfunction patchNotifyChange(window: Window) {\n let notifyInstance = MutationNotifier.getInstance();\n let notify = function (node: Node) { notifyInstance.notifyChanged(node); };\n\n let node_proto = (window)._core.Node.prototype;\n\n intersectMethod(node_proto, \"appendChild\", notify);\n intersectMethod(node_proto, \"insertBefore\", notify);\n intersectMethod(node_proto, \"removeChild\", notify);\n intersectMethod(node_proto, \"replaceChild\", notify);\n intersectSetter(node_proto, \"nodeValue\", notify);\n intersectSetter(node_proto, \"textContent\", notify);\n\n let element_proto = (window)._core.Element.prototype;\n\n intersectMethod(element_proto, \"setAttribute\", notify);\n intersectMethod(element_proto, \"removeAttribute\", notify);\n intersectMethod(element_proto, \"removeAttributeNode\", notify);\n intersectMethod(element_proto, \"removeAttributeNS\", notify);\n}\n\n\nfunction ensurePerformance(window) {\n if (window.performance === undefined) {\n window.performance = {};\n }\n\n if (window.performance.now === undefined) {\n let nowOffset = Date.now();\n\n //if (performance.timing && performance.timing.navigationStart) {\n // nowOffset = performance.timing.navigationStart;\n //}\n\n window.performance.now = function now() {\n return Date.now() - nowOffset;\n };\n }\n}\n\nfunction ensureMutationObserver(window) {\n if (!window.MutationObserver) {\n window.MutationObserver = MutationObserver;\n }\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
+{"version":3,"sources":["nodejs-pal-builder.ts"],"names":[],"mappings":";;AAKA,uDAAmD;AACnD,qDAAiD;AACjD,6CAAyC;AACzC,iCAA8B;AAC9B,qEAAiE;AACjE,qEAAiE;AAEjE,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;IACE,IAAI,KAAK,GAAG,IAAI,aAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,MAAM,GAAqB,KAAK,CAAC,MAAM,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QACnB,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,QAAQ,GAAG,IAAI,gCAAc,CAAC,MAAM,EAAE,K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QACjE,mDAAmD;QACnD,GAAG;QAEH,MAAM,CAAC,WAAW,CAAC,GAAG,GAAG;YACvB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAChC,CAAC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,gCAAgC,MAAM;IACpC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC7B,MAAM,CAAC,gBAAgB,GAAG,oCAAgB,CAAC;IAC7C,CAAC;AACH,CAAC","file":"nodejs-pal-builder.js","sourcesContent":["import { initializePAL } from 'aurelia-pal';\nimport { IPlatform } from './platform';\nimport { IGlobal } from './global';\nimport { IDom } from './dom';\nimport { IFeature } from './feature';\nimport { NodeJsPlatform } from './nodejs-platform';\nimport { NodeJsFeature } from './nodejs-feature';\nimport { NodeJsDom } from './nodejs-dom';\nimport { JSDOM } from 'jsdom';\nimport { MutationObserver } from './polyfills/mutation-observer';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\nlet _patchedjsdom = false;\n\nexport function buildPal(): { global: IGlobal, platform: IPlatform, dom: IDom, feature: IFeature } {\n var jsdom = new JSDOM(undefined, {});\n var global: IGlobal = jsdom.window;\n\n if (!_patchedjsdom) {\n patchNotifyChange(global);\n _patchedjsdom = true;\n }\n\n ensurePerformance(global.window);\n ensureMutationObserver(global.window);\n\n var platform = new NodeJsPlatform(global, jsdom);\n var dom = new NodeJsDom(global);\n var feature = new NodeJsFeature(global);\n\n return {\n global: global,\n platform: platform,\n dom: dom,\n feature: feature\n };\n}\n\nlet intersectSetter = function (proto, propertyName: string, intersect: Function) {\n let old = Object.getOwnPropertyDescriptor(proto, propertyName);\n let oldSet = old.set;\n let newSet = function set(V) {\n oldSet.call(this, V);\n intersect(this);\n };\n Object.defineProperty(proto, propertyName, {\n set: newSet,\n get: old.get,\n configurable: old.configurable,\n enumerable: old.enumerable\n });\n};\n\nlet intersectMethod = function (proto, methodName: string, intersect: Function) {\n let orig = proto[methodName];\n proto[methodName] = function (...args) {\n var ret = orig.apply(this, args);\n intersect(this);\n return ret;\n };\n};\n\nfunction patchNotifyChange(window: Window) {\n let notifyInstance = MutationNotifier.getInstance();\n let notify = function (node: Node) { notifyInstance.notifyChanged(node); };\n\n let node_proto = (window)._core.Node.prototype;\n\n intersectMethod(node_proto, \"appendChild\", notify);\n intersectMethod(node_proto, \"insertBefore\", notify);\n intersectMethod(node_proto, \"removeChild\", notify);\n intersectMethod(node_proto, \"replaceChild\", notify);\n intersectSetter(node_proto, \"nodeValue\", notify);\n intersectSetter(node_proto, \"textContent\", notify);\n\n let element_proto = (window)._core.Element.prototype;\n\n intersectMethod(element_proto, \"setAttribute\", notify);\n intersectMethod(element_proto, \"removeAttribute\", notify);\n intersectMethod(element_proto, \"removeAttributeNode\", notify);\n intersectMethod(element_proto, \"removeAttributeNS\", notify);\n}\n\n\nfunction ensurePerformance(window) {\n if (window.performance === undefined) {\n window.performance = {};\n }\n\n if (window.performance.now === undefined) {\n let nowOffset = Date.now();\n\n //if (performance.timing && performance.timing.navigationStart) {\n // nowOffset = performance.timing.navigationStart;\n //}\n\n window.performance.now = function now() {\n return Date.now() - nowOffset;\n };\n }\n}\n\nfunction ensureMutationObserver(window) {\n if (!window.MutationObserver) {\n window.MutationObserver = MutationObserver;\n }\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
diff --git a/dist/nodejs-platform.d.ts b/dist/nodejs-platform.d.ts
index e173a6c..93eb736 100644
--- a/dist/nodejs-platform.d.ts
+++ b/dist/nodejs-platform.d.ts
@@ -1,9 +1,11 @@
import { IPlatform } from './platform';
import { IPerformance } from './performance';
import { IGlobal } from './global';
+import { JSDOM } from 'jsdom';
export declare class NodeJsPlatform implements IPlatform {
global: IGlobal;
- constructor(global: IGlobal);
+ jsdom: JSDOM;
+ constructor(global: IGlobal, jsdom: JSDOM);
/**
* A function wich does nothing.
*/
diff --git a/dist/nodejs-platform.js b/dist/nodejs-platform.js
index 769969b..487e95a 100644
--- a/dist/nodejs-platform.js
+++ b/dist/nodejs-platform.js
@@ -1,7 +1,9 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
class NodeJsPlatform {
- constructor(global) {
+ constructor(global, jsdom) {
this.global = global;
+ this.jsdom = jsdom;
/**
* A function wich does nothing.
*/
diff --git a/dist/nodejs-platform.js.map b/dist/nodejs-platform.js.map
index d411662..69f00cb 100644
--- a/dist/nodejs-platform.js.map
+++ b/dist/nodejs-platform.js.map
@@ -1 +1 @@
-{"version":3,"sources":["nodejs-platform.ts"],"names":[],"mappings":";AAIA;IAEE,YAAmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QAOlC;;UAEE;QACF,SAAI,GAAa,QAAQ,CAAC,CAAC;QATzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IACnD,CAAC;IAkBD;;;;MAIE;IACF,qBAAqB,CAAC,QAA+C;QACnE,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;MAGE;IACF,UAAU,CAAC,QAAiD;QAC1D,sBAAsB;IACxB,CAAC;IACD;;;;;MAKE;IACF,gBAAgB,CAAC,SAAiB,EAAE,QAAkB,EAAE,OAAiB;QACvE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAO,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IACD;;;;;MAKE;IACF,mBAAmB,CAAC,SAAiB,EAAE,QAAkB,EAAE,OAAiB;QAC1E,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAO,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;CAMF;AAhED,wCAgEC","file":"nodejs-platform.js","sourcesContent":["import { IPlatform } from './platform';\nimport { IPerformance } from './performance';\nimport { IGlobal } from './global';\n\nexport class NodeJsPlatform implements IPlatform {\n\n constructor(public global: IGlobal) {\n this.performance = this.global.performance;\n this.location = this.global.location;\n this.history = this.global.history;\n this.XMLHttpRequest = this.global.XMLHttpRequest;\n }\n\n /**\n * A function wich does nothing.\n */\n noop: Function = () => { };\n /**\n * The runtime's location API.\n */\n location: Object;\n /**\n * The runtime's history API.\n */\n history: Object;\n /**\n * The runtime's performance API\n */\n performance: IPerformance;\n /**\n * Registers a function to call when the system is ready to update (repaint) the display.\n * @param callback The function to call.\n * @return A long integer value, the request id, that uniquely identifies the entry in the callback list.\n */\n requestAnimationFrame(callback: (animationFrameStart: number) => void): number {\n return setImmediate(callback);\n }\n\n /**\n * Iterate all modules loaded by the script loader.\n * @param callback A callback that will receive each module id along with the module object. Return true to end enumeration.\n */\n eachModule(callback: (key: string, value: Object) => boolean): void {\n //TODO: What is this? \n }\n /**\n * Add a global event listener.\n * @param eventName A string representing the event type to listen for.\n * @param callback The function that receives a notification when an event of the specified type occurs.\n * @param capture If true, useCapture indicates that the user wishes to initiate capture.\n */\n addEventListener(eventName: string, callback: Function, capture?: boolean): void {\n this.global.addEventListener(eventName, callback, capture);\n }\n /**\n * Remove a global event listener.\n * @param eventName A string representing the event type to listen for.\n * @param callback The function to remove from the event.\n * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not.\n */\n removeEventListener(eventName: string, callback: Function, capture?: boolean): void {\n this.global.removeEventListener(eventName, callback, capture);\n }\n\n /**\n * The runtime's XMLHttpRequest API.\n */\n XMLHttpRequest: typeof XMLHttpRequest;\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
+{"version":3,"sources":["nodejs-platform.ts"],"names":[],"mappings":";;AAKA;IAEE,YAAmB,MAAe,EAAS,KAAY;QAApC,WAAM,GAAN,MAAM,CAAS;QAAS,UAAK,GAAL,KAAK,CAAO;QAOvD;;UAEE;QACF,SAAI,GAAa,QAAQ,CAAC,CAAC;QATzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IACnD,CAAC;IAkBD;;;;MAIE;IACF,qBAAqB,CAAC,QAA+C;QACnE,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;MAGE;IACF,UAAU,CAAC,QAAiD;QAC1D,sBAAsB;IACxB,CAAC;IACD;;;;;MAKE;IACF,gBAAgB,CAAC,SAAiB,EAAE,QAAkB,EAAE,OAAiB;QACvE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAO,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IACD;;;;;MAKE;IACF,mBAAmB,CAAC,SAAiB,EAAE,QAAkB,EAAE,OAAiB;QAC1E,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAO,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;CAMF;AAhED,wCAgEC","file":"nodejs-platform.js","sourcesContent":["import { IPlatform } from './platform';\nimport { IPerformance } from './performance';\nimport { IGlobal } from './global';\nimport { JSDOM } from 'jsdom';\n\nexport class NodeJsPlatform implements IPlatform {\n\n constructor(public global: IGlobal, public jsdom: JSDOM) {\n this.performance = this.global.performance;\n this.location = this.global.location;\n this.history = this.global.history;\n this.XMLHttpRequest = this.global.XMLHttpRequest;\n }\n\n /**\n * A function wich does nothing.\n */\n noop: Function = () => { };\n /**\n * The runtime's location API.\n */\n location: Object;\n /**\n * The runtime's history API.\n */\n history: Object;\n /**\n * The runtime's performance API\n */\n performance: IPerformance;\n /**\n * Registers a function to call when the system is ready to update (repaint) the display.\n * @param callback The function to call.\n * @return A long integer value, the request id, that uniquely identifies the entry in the callback list.\n */\n requestAnimationFrame(callback: (animationFrameStart: number) => void): number {\n return setImmediate(callback);\n }\n\n /**\n * Iterate all modules loaded by the script loader.\n * @param callback A callback that will receive each module id along with the module object. Return true to end enumeration.\n */\n eachModule(callback: (key: string, value: Object) => boolean): void {\n //TODO: What is this? \n }\n /**\n * Add a global event listener.\n * @param eventName A string representing the event type to listen for.\n * @param callback The function that receives a notification when an event of the specified type occurs.\n * @param capture If true, useCapture indicates that the user wishes to initiate capture.\n */\n addEventListener(eventName: string, callback: Function, capture?: boolean): void {\n this.global.addEventListener(eventName, callback, capture);\n }\n /**\n * Remove a global event listener.\n * @param eventName A string representing the event type to listen for.\n * @param callback The function to remove from the event.\n * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not.\n */\n removeEventListener(eventName: string, callback: Function, capture?: boolean): void {\n this.global.removeEventListener(eventName, callback, capture);\n }\n\n /**\n * The runtime's XMLHttpRequest API.\n */\n XMLHttpRequest: typeof XMLHttpRequest;\n}\n"],"sourceRoot":"../src/"}
\ No newline at end of file
diff --git a/dist/observer.js b/dist/observer.js
index faf99c0..cc02df6 100644
--- a/dist/observer.js
+++ b/dist/observer.js
@@ -1,3 +1,4 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=observer.js.map
diff --git a/dist/performance.js b/dist/performance.js
index f5ee029..5f2c981 100644
--- a/dist/performance.js
+++ b/dist/performance.js
@@ -1,3 +1,4 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=performance.js.map
diff --git a/dist/platform.js b/dist/platform.js
index daace41..e4da399 100644
--- a/dist/platform.js
+++ b/dist/platform.js
@@ -1,3 +1,4 @@
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=platform.js.map
diff --git a/dist/polyfills/mutation-observer.d.ts b/dist/polyfills/mutation-observer.d.ts
index 77f25dd..7993a9f 100644
--- a/dist/polyfills/mutation-observer.d.ts
+++ b/dist/polyfills/mutation-observer.d.ts
@@ -77,5 +77,6 @@ export declare class MutationNotifier extends EventEmitter {
private static _instance;
static getInstance(): MutationNotifier;
constructor();
+ destruct(): void;
notifyChanged(node: Node): void;
}
diff --git a/dist/polyfills/mutation-observer.js b/dist/polyfills/mutation-observer.js
index 4fac347..d8a14c9 100644
--- a/dist/polyfills/mutation-observer.js
+++ b/dist/polyfills/mutation-observer.js
@@ -1,9 +1,10 @@
+"use strict";
/*
* Based on Shim for MutationObserver interface
* Author: Graeme Yeates (github.com/megawac)
* Repository: https://github.com/megawac/MutationObserver.js
*/
-"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
class Util {
static clone($target, config) {
let recurse = true; // set true so childList we'll always check the first level
@@ -123,9 +124,9 @@ class Util {
return obj[prop] !== undefined; // will be nicely inlined by gcc
}
}
-exports.Util = Util;
Util.counter = 1;
Util.expando = 'mo_id';
+exports.Util = Util;
class MutationObserver {
constructor(listener) {
this._watched = [];
@@ -476,11 +477,14 @@ class MutationNotifier extends events_1.EventEmitter {
}
return MutationNotifier._instance;
}
+ destruct() {
+ this.removeAllListeners("changed");
+ }
notifyChanged(node) {
this.emit("changed", node);
}
}
-exports.MutationNotifier = MutationNotifier;
MutationNotifier._instance = null;
+exports.MutationNotifier = MutationNotifier;
//# sourceMappingURL=mutation-observer.js.map
diff --git a/dist/polyfills/mutation-observer.js.map b/dist/polyfills/mutation-observer.js.map
index 418ce3d..eac3fbd 100644
--- a/dist/polyfills/mutation-observer.js.map
+++ b/dist/polyfills/mutation-observer.js.map
@@ -1 +1 @@
-{"version":3,"sources":["polyfills/mutation-observer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH;IAIE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM;QAC1B,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,2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,CAAC;CACF;AAlBD,wCAkBC;AAED,mCAAsC;AAEtC,sBAA8B,SAAQ,qBAAY;IAUhD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAVD,MAAM,CAAC,WAAW;QAChB,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;YAChC,gBAAgB,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtD,CAAC;QACD,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC;IACpC,CAAC;IAOD,aAAa,CAAC,IAAU;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;;AAjBH,4CAkBC;AAjBgB,0BAAS,GAAqB,IAAI,CAAC","file":"mutation-observer.js","sourcesContent":["/*\n * Based on Shim for MutationObserver interface\n * Author: Graeme Yeates (github.com/megawac)\n * Repository: https://github.com/megawac/MutationObserver.js\n */\n\nexport class Util {\n static counter = 1;\n static expando = 'mo_id';\n\n static clone($target, config) {\n let recurse = true; // set true so childList we'll always check the first level\n return (function copy($target) {\n let elestruct = {\n /** @type {Node} */\n node: $target,\n charData: null,\n attr: null,\n kids: null,\n };\n\n // Store current character data of target text or comment node if the config requests\n // those properties to be observed.\n if (config.charData && ($target.nodeType === 3 || $target.nodeType === 8)) {\n elestruct.charData = $target.nodeValue;\n } else {\n // Add attr only if subtree is specified or top level and avoid if\n // attributes is a document object (#13).\n if (config.attr && recurse && $target.nodeType === 1) {\n /**\n * clone live attribute list to an object structure {name: val}\n * @type {Object.}\n */\n elestruct.attr = Util.reduce($target.attributes, (memo, attr) => {\n if (!config.afilter || config.afilter[attr.name]) {\n memo[attr.name] = attr.value;\n }\n return memo;\n }, {});\n }\n\n // whether we should iterate the children of $target node\n if (recurse && ((config.kids || config.charData) || (config.attr && config.descendents))) {\n /** @type {Array.} : Array of custom clone */\n elestruct.kids = Util.map($target.childNodes, copy);\n }\n\n recurse = config.descendents;\n }\n return elestruct;\n })($target);\n }\n\n /**\n * indexOf an element in a collection of custom nodes\n *\n * @param {NodeList} set\n * @param {!Object} $node : A custom cloned nodeg333\n * @param {number} idx : index to start the loop\n * @return {number}\n */\n static indexOfCustomNode(set, $node, idx) {\n const JSCompiler_renameProperty = a => a;\n return this.indexOf(set, $node, idx, JSCompiler_renameProperty('node'));\n }\n\n /**\n * Attempt to uniquely id an element for hashing. We could optimize this for legacy browsers but it hopefully wont be called enough to be a concern\n *\n * @param {Node} $ele\n * @return {(string|number)}\n */\n static getElementId($ele) {\n try {\n return $ele.id || ($ele[this.expando] = $ele[this.expando] || this.counter++);\n } catch (e) { // ie <8 will throw if you set an unknown property on a text node\n try {\n return $ele.nodeValue; // naive\n } catch (shitie) { // when text node is removed: https://gist.github.com/megawac/8355978 :(\n return this.counter++;\n }\n }\n }\n\n /**\n * **map** Apply a mapping function to each item of a set\n * @param {Array|NodeList} set\n * @param {Function} iterator\n */\n static map(set, iterator) {\n let results = [];\n for (let index = 0; index < set.length; index++) {\n results[index] = iterator(set[index], index, set);\n }\n return results;\n }\n\n /**\n * **Reduce** builds up a single result from a list of values\n * @param {Array|NodeList|NamedNodeMap} set\n * @param {Function} iterator\n * @param {*} [memo] Initial value of the memo.\n */\n static reduce(set, iterator, memo) {\n for (let index = 0; index < set.length; index++) {\n memo = iterator(memo, set[index], index, set);\n }\n return memo;\n }\n\n /**\n * **indexOf** find index of item in collection.\n * @param {Array|NodeList} set\n * @param {Object} item\n * @param {number} idx\n * @param {string} [prop] Property on set item to compare to item\n */\n static indexOf(set, item, idx, prop?) {\n for (/*idx = ~~idx*/; idx < set.length; idx++) {// start idx is always given as this is internal\n if ((prop ? set[idx][prop] : set[idx]) === item) return idx;\n }\n return -1;\n }\n\n /**\n * @param {Object} obj\n * @param {(string|number)} prop\n * @return {boolean}\n */\n static has(obj, prop) {\n return obj[prop] !== undefined; // will be nicely inlined by gcc\n }\n}\n\nexport class MutationObserver {\n private _watched = [];\n private _listener = null;\n private _period = 30;\n private _timeout = null;\n private _disposed = false;\n private _notifyListener = null;\n\n constructor(listener) {\n this._watched = [];\n this._listener = listener;\n this._period = 30;\n this._notifyListener = () => { this.scheduleMutationCheck(this); };\n }\n\n observe($target, config) {\n let settings = {\n attr: !!(config.attributes || config.attributeFilter || config.attributeOldValue),\n\n // some browsers enforce that subtree must be set with childList, attributes or characterData.\n // We don't care as spec doesn't specify this rule.\n kids: !!config.childList,\n descendents: !!config.subtree,\n charData: !!(config.characterData || config.characterDataOldValue),\n\n afilter: null\n };\n\n MutationNotifier.getInstance().on(\"changed\", this._notifyListener);\n\n let watched = this._watched;\n\n // remove already observed target element from pool\n for (let i = 0; i < watched.length; i++) {\n if (watched[i].tar === $target) watched.splice(i, 1);\n }\n\n if (config.attributeFilter) {\n /**\n * converts to a {key: true} dict for faster lookup\n * @type {Object.}\n */\n settings.afilter = Util.reduce(config.attributeFilter, (a, b) => {\n a[b] = true;\n return a;\n }, {});\n }\n\n watched.push({\n tar: $target,\n fn: this.createMutationSearcher($target, settings)\n });\n }\n\n takeRecords() {\n let mutations = [];\n let watched = this._watched;\n\n for (let i = 0; i < watched.length; i++) {\n watched[i].fn(mutations);\n }\n\n return mutations;\n }\n\n disconnect() {\n this._watched = []; // clear the stuff being observed\n MutationNotifier.getInstance().removeListener(\"changed\", this._notifyListener );\n this._disposed = true;\n clearTimeout(this._timeout); // ready for garbage collection\n this._timeout = null;\n }\n\n private createMutationSearcher($target, config) {\n /** type {Elestuct} */\n let $oldstate = Util.clone($target, config); // create the cloned datastructure\n\n /**\n * consumes array of mutations we can push to\n *\n * @param {Array.} mutations\n */\n return (mutations) => {\n let olen = mutations.length;\n let dirty;\n\n if (config.charData && $target.nodeType === 3 && $target.nodeValue !== $oldstate.charData) {\n mutations.push(new MutationRecord({\n type: 'characterData',\n target: $target,\n oldValue: $oldstate.charData\n }));\n }\n\n // Alright we check base level changes in attributes... easy\n if (config.attr && $oldstate.attr) {\n this.findAttributeMutations(mutations, $target, $oldstate.attr, config.afilter);\n }\n\n // check childlist or subtree for mutations\n if (config.kids || config.descendents) {\n dirty = this.searchSubtree(mutations, $target, $oldstate, config);\n }\n\n // reclone data structure if theres changes\n if (dirty || mutations.length !== olen) {\n /** type {Elestuct} */\n $oldstate = Util.clone($target, config);\n }\n };\n }\n\n private scheduleMutationCheck(observer) {\n // Only schedule if there isn't already a timer. \n if (!observer._timeout) {\n observer._timeout = setTimeout(() => this.mutationChecker(observer), this._period);\n }\n }\n\n private mutationChecker(observer) {\n // allow scheduling a new timer. \n observer._timeout = null; \n \n let mutations = observer.takeRecords();\n\n if (mutations.length) { // fire away\n // calling the listener with context is not spec but currently consistent with FF and WebKit\n observer._listener(mutations, observer);\n }\n }\n\n private searchSubtree(mutations, $target, $oldstate, config) {\n // Track if the tree is dirty and has to be recomputed (#14).\n let dirty;\n /*\n * Helper to identify node rearrangment and stuff...\n * There is no gaurentee that the same node will be identified for both added and removed nodes\n * if the positions have been shuffled.\n * conflicts array will be emptied by end of operation\n */\n const _resolveConflicts = (conflicts, node, $kids, $oldkids, numAddedNodes) => {\n // the distance between the first conflicting node and the last\n let distance = conflicts.length - 1;\n // prevents same conflict being resolved twice consider when two nodes switch places.\n // only one should be given a mutation event (note -~ is used as a math.ceil shorthand)\n let counter = -~((distance - numAddedNodes) / 2);\n let $cur;\n let oldstruct;\n let conflict;\n while ((conflict = conflicts.pop())) {\n $cur = $kids[conflict.i];\n oldstruct = $oldkids[conflict.j];\n\n // attempt to determine if there was node rearrangement... won't gaurentee all matches\n // also handles case where added/removed nodes cause nodes to be identified as conflicts\n if (config.kids && counter && Math.abs(conflict.i - conflict.j) >= distance) {\n mutations.push(new MutationRecord({\n type: 'childList',\n target: node,\n addedNodes: [$cur],\n removedNodes: [$cur],\n // haha don't rely on this please\n nextSibling: $cur.nextSibling,\n previousSibling: $cur.previousSibling\n }));\n counter--; // found conflict\n }\n\n // Alright we found the resorted nodes now check for other types of mutations\n if (config.attr && oldstruct.attr) this.findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter);\n if (config.charData && $cur.nodeType === 3 && $cur.nodeValue !== oldstruct.charData) {\n mutations.push(new MutationRecord({\n type: 'characterData',\n target: $cur,\n oldValue: oldstruct.charData\n }));\n }\n // now look @ subtree\n if (config.descendents) _findMutations($cur, oldstruct);\n }\n };\n\n /**\n * Main worker. Finds and adds mutations if there are any\n * @param {Node} node\n * @param {!Object} old : A cloned data structure using internal clone\n */\n const _findMutations = (node, old) => {\n let $kids = node.childNodes;\n let $oldkids = old.kids;\n let klen = $kids.length;\n // $oldkids will be undefined for text and comment nodes\n let olen = $oldkids ? $oldkids.length : 0;\n // if (!olen && !klen) return; // both empty; clearly no changes\n\n // we delay the intialization of these for marginal performance in the expected case (actually quite signficant on large subtrees when these would be otherwise unused)\n // map of checked element of ids to prevent registering the same conflict twice\n let map;\n // array of potential conflicts (ie nodes that may have been re arranged)\n let conflicts;\n let id; // element id from getElementId helper\n let idx; // index of a moved or inserted element\n\n let oldstruct;\n // current and old nodes\n let $cur;\n let $old;\n // track the number of added nodes so we can resolve conflicts more accurately\n let numAddedNodes = 0;\n\n // iterate over both old and current child nodes at the same time\n let i = 0;\n let j = 0;\n // while there is still anything left in $kids or $oldkids (same as i < $kids.length || j < $oldkids.length;)\n while (i < klen || j < olen) {\n // current and old nodes at the indexs\n $cur = $kids[i];\n oldstruct = $oldkids[j];\n $old = oldstruct && oldstruct.node;\n\n if ($cur === $old) { // expected case - optimized for this case\n // check attributes as specified by config\n if (config.attr && oldstruct.attr) {/* oldstruct.attr instead of textnode check */\n this.findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter);\n }\n // check character data if node is a comment or textNode and it's being observed\n if (config.charData && oldstruct.charData !== undefined && $cur.nodeValue !== oldstruct.charData) {\n mutations.push(new MutationRecord({\n type: 'characterData',\n target: $cur\n }));\n }\n\n // resolve conflicts; it will be undefined if there are no conflicts - otherwise an array\n if (conflicts) _resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes);\n\n // recurse on next level of children. Avoids the recursive call when there are no children left to iterate\n if (config.descendents && ($cur.childNodes.length || oldstruct.kids && oldstruct.kids.length)) _findMutations($cur, oldstruct);\n\n i++;\n j++;\n } else { // (uncommon case) lookahead until they are the same again or the end of children\n dirty = true;\n if (!map) { // delayed initalization (big perf benefit)\n map = {};\n conflicts = [];\n }\n if ($cur) {\n // check id is in the location map otherwise do a indexOf search\n if (!(map[id = Util.getElementId($cur)])) { // to prevent double checking\n // mark id as found\n map[id] = true;\n // custom indexOf using comparitor checking oldkids[i].node === $cur\n if ((idx = Util.indexOfCustomNode($oldkids, $cur, j)) === -1) {\n if (config.kids) {\n mutations.push(new MutationRecord({\n type: 'childList',\n target: node,\n addedNodes: [$cur], // $cur is a new node\n nextSibling: $cur.nextSibling,\n previousSibling: $cur.previousSibling\n }));\n numAddedNodes++;\n }\n } else {\n conflicts.push({ // add conflict\n i: i,\n j: idx\n });\n }\n }\n i++;\n }\n\n if ($old &&\n // special case: the changes may have been resolved: i and j appear congurent so we can continue using the expected case\n $old !== $kids[i]\n ) {\n if (!(map[id = Util.getElementId($old)])) {\n map[id] = true;\n if ((idx = Util.indexOf($kids, $old, i)) === -1) {\n if (config.kids) {\n mutations.push(new MutationRecord({\n type: 'childList',\n target: old.node,\n removedNodes: [$old],\n nextSibling: $oldkids[j + 1], // praise no indexoutofbounds exception\n previousSibling: $oldkids[j - 1]\n }));\n numAddedNodes--;\n }\n } else {\n conflicts.push({\n i: idx,\n j: j\n });\n }\n }\n j++;\n }\n }// end uncommon case\n }// end loop\n\n // resolve any remaining conflicts\n if (conflicts) _resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes);\n };\n _findMutations($target, $oldstate);\n return dirty;\n }\n\n private findAttributeMutations(mutations, $target, $oldstate, filter) {\n let checked = {};\n let attributes = $target.attributes;\n let attr;\n let name;\n let i = attributes.length;\n while (i--) {\n attr = attributes[i];\n name = attr.name;\n if (!filter || Util.has(filter, name)) {\n if (attr.value !== $oldstate[name]) {\n // The pushing is redundant but gzips very nicely\n mutations.push(new MutationRecord({\n type: 'attributes',\n target: $target,\n attributeName: name,\n oldValue: $oldstate[name],\n attributeNamespace: attr.namespaceURI // in ie<8 it incorrectly will return undefined\n }));\n }\n checked[name] = true;\n }\n }\n for (name in $oldstate) {\n if (!(checked[name])) {\n mutations.push(new MutationRecord({\n target: $target,\n type: 'attributes',\n attributeName: name,\n oldValue: $oldstate[name]\n }));\n }\n }\n }\n}\n\nexport class MutationRecord {\n constructor(data) {\n let settings = { // technically these should be on proto so hasOwnProperty will return false for non explicitly props\n type: null,\n target: null,\n addedNodes: [],\n removedNodes: [],\n previousSibling: null,\n nextSibling: null,\n attributeName: null,\n attributeNamespace: null,\n oldValue: null\n };\n for (let prop in data) {\n if (Util.has(settings, prop) && data[prop] !== undefined) settings[prop] = data[prop];\n }\n return settings;\n }\n}\n\nimport { EventEmitter } from 'events';\n\nexport class MutationNotifier extends EventEmitter {\n private static _instance: MutationNotifier = null;\n\n static getInstance() {\n if (!MutationNotifier._instance) {\n MutationNotifier._instance = new MutationNotifier();\n }\n return MutationNotifier._instance;\n }\n\n constructor() {\n super();\n this.setMaxListeners(100);\n }\n\n notifyChanged(node: Node) {\n this.emit(\"changed\", node);\n }\n}"],"sourceRoot":"../../../src/"}
\ No newline at end of file
+{"version":3,"sources":["polyfills/mutation-observer.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAEH;IAIE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM;QAC1B,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,2DAA2D;QAC/E,MAAM,CAAC,CAAC,cAAc,OAAO;YAC3B,IAAI,SAAS,GAAG;gBACd,mBAAmB;gBACnB,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,IAAI;aACX,CAAC;YAEF,qFAAqF;YACrF,mCAA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CAAC,SAAS,CAAC,CAAC,CAAC;YAChC,gBAAgB,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtD,CAAC;QACD,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC;IACpC,CAAC;IAOD,QAAQ;QACN,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAED,aAAa,CAAC,IAAU;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;;AApBc,0BAAS,GAAqB,IAAI,CAAC;AADpD,4CAsBC","file":"mutation-observer.js","sourcesContent":["/*\n * Based on Shim for MutationObserver interface\n * Author: Graeme Yeates (github.com/megawac)\n * Repository: https://github.com/megawac/MutationObserver.js\n */\n\nexport class Util {\n static counter = 1;\n static expando = 'mo_id';\n\n static clone($target, config) {\n let recurse = true; // set true so childList we'll always check the first level\n return (function copy($target) {\n let elestruct = {\n /** @type {Node} */\n node: $target,\n charData: null,\n attr: null,\n kids: null,\n };\n\n // Store current character data of target text or comment node if the config requests\n // those properties to be observed.\n if (config.charData && ($target.nodeType === 3 || $target.nodeType === 8)) {\n elestruct.charData = $target.nodeValue;\n } else {\n // Add attr only if subtree is specified or top level and avoid if\n // attributes is a document object (#13).\n if (config.attr && recurse && $target.nodeType === 1) {\n /**\n * clone live attribute list to an object structure {name: val}\n * @type {Object.}\n */\n elestruct.attr = Util.reduce($target.attributes, (memo, attr) => {\n if (!config.afilter || config.afilter[attr.name]) {\n memo[attr.name] = attr.value;\n }\n return memo;\n }, {});\n }\n\n // whether we should iterate the children of $target node\n if (recurse && ((config.kids || config.charData) || (config.attr && config.descendents))) {\n /** @type {Array.} : Array of custom clone */\n elestruct.kids = Util.map($target.childNodes, copy);\n }\n\n recurse = config.descendents;\n }\n return elestruct;\n })($target);\n }\n\n /**\n * indexOf an element in a collection of custom nodes\n *\n * @param {NodeList} set\n * @param {!Object} $node : A custom cloned nodeg333\n * @param {number} idx : index to start the loop\n * @return {number}\n */\n static indexOfCustomNode(set, $node, idx) {\n const JSCompiler_renameProperty = a => a;\n return this.indexOf(set, $node, idx, JSCompiler_renameProperty('node'));\n }\n\n /**\n * Attempt to uniquely id an element for hashing. We could optimize this for legacy browsers but it hopefully wont be called enough to be a concern\n *\n * @param {Node} $ele\n * @return {(string|number)}\n */\n static getElementId($ele) {\n try {\n return $ele.id || ($ele[this.expando] = $ele[this.expando] || this.counter++);\n } catch (e) { // ie <8 will throw if you set an unknown property on a text node\n try {\n return $ele.nodeValue; // naive\n } catch (shitie) { // when text node is removed: https://gist.github.com/megawac/8355978 :(\n return this.counter++;\n }\n }\n }\n\n /**\n * **map** Apply a mapping function to each item of a set\n * @param {Array|NodeList} set\n * @param {Function} iterator\n */\n static map(set, iterator) {\n let results = [];\n for (let index = 0; index < set.length; index++) {\n results[index] = iterator(set[index], index, set);\n }\n return results;\n }\n\n /**\n * **Reduce** builds up a single result from a list of values\n * @param {Array|NodeList|NamedNodeMap} set\n * @param {Function} iterator\n * @param {*} [memo] Initial value of the memo.\n */\n static reduce(set, iterator, memo) {\n for (let index = 0; index < set.length; index++) {\n memo = iterator(memo, set[index], index, set);\n }\n return memo;\n }\n\n /**\n * **indexOf** find index of item in collection.\n * @param {Array|NodeList} set\n * @param {Object} item\n * @param {number} idx\n * @param {string} [prop] Property on set item to compare to item\n */\n static indexOf(set, item, idx, prop?) {\n for (/*idx = ~~idx*/; idx < set.length; idx++) {// start idx is always given as this is internal\n if ((prop ? set[idx][prop] : set[idx]) === item) return idx;\n }\n return -1;\n }\n\n /**\n * @param {Object} obj\n * @param {(string|number)} prop\n * @return {boolean}\n */\n static has(obj, prop) {\n return obj[prop] !== undefined; // will be nicely inlined by gcc\n }\n}\n\nexport class MutationObserver {\n private _watched = [];\n private _listener = null;\n private _period = 30;\n private _timeout = null;\n private _disposed = false;\n private _notifyListener = null;\n\n constructor(listener) {\n this._watched = [];\n this._listener = listener;\n this._period = 30;\n this._notifyListener = () => { this.scheduleMutationCheck(this); };\n }\n\n observe($target, config) {\n let settings = {\n attr: !!(config.attributes || config.attributeFilter || config.attributeOldValue),\n\n // some browsers enforce that subtree must be set with childList, attributes or characterData.\n // We don't care as spec doesn't specify this rule.\n kids: !!config.childList,\n descendents: !!config.subtree,\n charData: !!(config.characterData || config.characterDataOldValue),\n\n afilter: null\n };\n\n MutationNotifier.getInstance().on(\"changed\", this._notifyListener);\n\n let watched = this._watched;\n\n // remove already observed target element from pool\n for (let i = 0; i < watched.length; i++) {\n if (watched[i].tar === $target) watched.splice(i, 1);\n }\n\n if (config.attributeFilter) {\n /**\n * converts to a {key: true} dict for faster lookup\n * @type {Object.}\n */\n settings.afilter = Util.reduce(config.attributeFilter, (a, b) => {\n a[b] = true;\n return a;\n }, {});\n }\n\n watched.push({\n tar: $target,\n fn: this.createMutationSearcher($target, settings)\n });\n }\n\n takeRecords() {\n let mutations = [];\n let watched = this._watched;\n\n for (let i = 0; i < watched.length; i++) {\n watched[i].fn(mutations);\n }\n\n return mutations;\n }\n\n disconnect() {\n this._watched = []; // clear the stuff being observed\n MutationNotifier.getInstance().removeListener(\"changed\", this._notifyListener );\n this._disposed = true;\n clearTimeout(this._timeout); // ready for garbage collection\n this._timeout = null;\n }\n\n private createMutationSearcher($target, config) {\n /** type {Elestuct} */\n let $oldstate = Util.clone($target, config); // create the cloned datastructure\n\n /**\n * consumes array of mutations we can push to\n *\n * @param {Array.} mutations\n */\n return (mutations) => {\n let olen = mutations.length;\n let dirty;\n\n if (config.charData && $target.nodeType === 3 && $target.nodeValue !== $oldstate.charData) {\n mutations.push(new MutationRecord({\n type: 'characterData',\n target: $target,\n oldValue: $oldstate.charData\n }));\n }\n\n // Alright we check base level changes in attributes... easy\n if (config.attr && $oldstate.attr) {\n this.findAttributeMutations(mutations, $target, $oldstate.attr, config.afilter);\n }\n\n // check childlist or subtree for mutations\n if (config.kids || config.descendents) {\n dirty = this.searchSubtree(mutations, $target, $oldstate, config);\n }\n\n // reclone data structure if theres changes\n if (dirty || mutations.length !== olen) {\n /** type {Elestuct} */\n $oldstate = Util.clone($target, config);\n }\n };\n }\n\n private scheduleMutationCheck(observer) {\n // Only schedule if there isn't already a timer. \n if (!observer._timeout) {\n observer._timeout = setTimeout(() => this.mutationChecker(observer), this._period);\n }\n }\n\n private mutationChecker(observer) {\n // allow scheduling a new timer. \n observer._timeout = null; \n \n let mutations = observer.takeRecords();\n\n if (mutations.length) { // fire away\n // calling the listener with context is not spec but currently consistent with FF and WebKit\n observer._listener(mutations, observer);\n }\n }\n\n private searchSubtree(mutations, $target, $oldstate, config) {\n // Track if the tree is dirty and has to be recomputed (#14).\n let dirty;\n /*\n * Helper to identify node rearrangment and stuff...\n * There is no gaurentee that the same node will be identified for both added and removed nodes\n * if the positions have been shuffled.\n * conflicts array will be emptied by end of operation\n */\n const _resolveConflicts = (conflicts, node, $kids, $oldkids, numAddedNodes) => {\n // the distance between the first conflicting node and the last\n let distance = conflicts.length - 1;\n // prevents same conflict being resolved twice consider when two nodes switch places.\n // only one should be given a mutation event (note -~ is used as a math.ceil shorthand)\n let counter = -~((distance - numAddedNodes) / 2);\n let $cur;\n let oldstruct;\n let conflict;\n while ((conflict = conflicts.pop())) {\n $cur = $kids[conflict.i];\n oldstruct = $oldkids[conflict.j];\n\n // attempt to determine if there was node rearrangement... won't gaurentee all matches\n // also handles case where added/removed nodes cause nodes to be identified as conflicts\n if (config.kids && counter && Math.abs(conflict.i - conflict.j) >= distance) {\n mutations.push(new MutationRecord({\n type: 'childList',\n target: node,\n addedNodes: [$cur],\n removedNodes: [$cur],\n // haha don't rely on this please\n nextSibling: $cur.nextSibling,\n previousSibling: $cur.previousSibling\n }));\n counter--; // found conflict\n }\n\n // Alright we found the resorted nodes now check for other types of mutations\n if (config.attr && oldstruct.attr) this.findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter);\n if (config.charData && $cur.nodeType === 3 && $cur.nodeValue !== oldstruct.charData) {\n mutations.push(new MutationRecord({\n type: 'characterData',\n target: $cur,\n oldValue: oldstruct.charData\n }));\n }\n // now look @ subtree\n if (config.descendents) _findMutations($cur, oldstruct);\n }\n };\n\n /**\n * Main worker. Finds and adds mutations if there are any\n * @param {Node} node\n * @param {!Object} old : A cloned data structure using internal clone\n */\n const _findMutations = (node, old) => {\n let $kids = node.childNodes;\n let $oldkids = old.kids;\n let klen = $kids.length;\n // $oldkids will be undefined for text and comment nodes\n let olen = $oldkids ? $oldkids.length : 0;\n // if (!olen && !klen) return; // both empty; clearly no changes\n\n // we delay the intialization of these for marginal performance in the expected case (actually quite signficant on large subtrees when these would be otherwise unused)\n // map of checked element of ids to prevent registering the same conflict twice\n let map;\n // array of potential conflicts (ie nodes that may have been re arranged)\n let conflicts;\n let id; // element id from getElementId helper\n let idx; // index of a moved or inserted element\n\n let oldstruct;\n // current and old nodes\n let $cur;\n let $old;\n // track the number of added nodes so we can resolve conflicts more accurately\n let numAddedNodes = 0;\n\n // iterate over both old and current child nodes at the same time\n let i = 0;\n let j = 0;\n // while there is still anything left in $kids or $oldkids (same as i < $kids.length || j < $oldkids.length;)\n while (i < klen || j < olen) {\n // current and old nodes at the indexs\n $cur = $kids[i];\n oldstruct = $oldkids[j];\n $old = oldstruct && oldstruct.node;\n\n if ($cur === $old) { // expected case - optimized for this case\n // check attributes as specified by config\n if (config.attr && oldstruct.attr) {/* oldstruct.attr instead of textnode check */\n this.findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter);\n }\n // check character data if node is a comment or textNode and it's being observed\n if (config.charData && oldstruct.charData !== undefined && $cur.nodeValue !== oldstruct.charData) {\n mutations.push(new MutationRecord({\n type: 'characterData',\n target: $cur\n }));\n }\n\n // resolve conflicts; it will be undefined if there are no conflicts - otherwise an array\n if (conflicts) _resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes);\n\n // recurse on next level of children. Avoids the recursive call when there are no children left to iterate\n if (config.descendents && ($cur.childNodes.length || oldstruct.kids && oldstruct.kids.length)) _findMutations($cur, oldstruct);\n\n i++;\n j++;\n } else { // (uncommon case) lookahead until they are the same again or the end of children\n dirty = true;\n if (!map) { // delayed initalization (big perf benefit)\n map = {};\n conflicts = [];\n }\n if ($cur) {\n // check id is in the location map otherwise do a indexOf search\n if (!(map[id = Util.getElementId($cur)])) { // to prevent double checking\n // mark id as found\n map[id] = true;\n // custom indexOf using comparitor checking oldkids[i].node === $cur\n if ((idx = Util.indexOfCustomNode($oldkids, $cur, j)) === -1) {\n if (config.kids) {\n mutations.push(new MutationRecord({\n type: 'childList',\n target: node,\n addedNodes: [$cur], // $cur is a new node\n nextSibling: $cur.nextSibling,\n previousSibling: $cur.previousSibling\n }));\n numAddedNodes++;\n }\n } else {\n conflicts.push({ // add conflict\n i: i,\n j: idx\n });\n }\n }\n i++;\n }\n\n if ($old &&\n // special case: the changes may have been resolved: i and j appear congurent so we can continue using the expected case\n $old !== $kids[i]\n ) {\n if (!(map[id = Util.getElementId($old)])) {\n map[id] = true;\n if ((idx = Util.indexOf($kids, $old, i)) === -1) {\n if (config.kids) {\n mutations.push(new MutationRecord({\n type: 'childList',\n target: old.node,\n removedNodes: [$old],\n nextSibling: $oldkids[j + 1], // praise no indexoutofbounds exception\n previousSibling: $oldkids[j - 1]\n }));\n numAddedNodes--;\n }\n } else {\n conflicts.push({\n i: idx,\n j: j\n });\n }\n }\n j++;\n }\n }// end uncommon case\n }// end loop\n\n // resolve any remaining conflicts\n if (conflicts) _resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes);\n };\n _findMutations($target, $oldstate);\n return dirty;\n }\n\n private findAttributeMutations(mutations, $target, $oldstate, filter) {\n let checked = {};\n let attributes = $target.attributes;\n let attr;\n let name;\n let i = attributes.length;\n while (i--) {\n attr = attributes[i];\n name = attr.name;\n if (!filter || Util.has(filter, name)) {\n if (attr.value !== $oldstate[name]) {\n // The pushing is redundant but gzips very nicely\n mutations.push(new MutationRecord({\n type: 'attributes',\n target: $target,\n attributeName: name,\n oldValue: $oldstate[name],\n attributeNamespace: attr.namespaceURI // in ie<8 it incorrectly will return undefined\n }));\n }\n checked[name] = true;\n }\n }\n for (name in $oldstate) {\n if (!(checked[name])) {\n mutations.push(new MutationRecord({\n target: $target,\n type: 'attributes',\n attributeName: name,\n oldValue: $oldstate[name]\n }));\n }\n }\n }\n}\n\nexport class MutationRecord {\n constructor(data) {\n let settings = { // technically these should be on proto so hasOwnProperty will return false for non explicitly props\n type: null,\n target: null,\n addedNodes: [],\n removedNodes: [],\n previousSibling: null,\n nextSibling: null,\n attributeName: null,\n attributeNamespace: null,\n oldValue: null\n };\n for (let prop in data) {\n if (Util.has(settings, prop) && data[prop] !== undefined) settings[prop] = data[prop];\n }\n return settings;\n }\n}\n\nimport { EventEmitter } from 'events';\n\nexport class MutationNotifier extends EventEmitter {\n private static _instance: MutationNotifier = null;\n\n static getInstance() {\n if (!MutationNotifier._instance) {\n MutationNotifier._instance = new MutationNotifier();\n }\n return MutationNotifier._instance;\n }\n\n constructor() {\n super();\n this.setMaxListeners(100);\n }\n\n destruct() {\n this.removeAllListeners(\"changed\");\n }\n\n notifyChanged(node: Node) {\n this.emit(\"changed\", node);\n }\n}"],"sourceRoot":"../../../src/"}
\ No newline at end of file
diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md
index 183922b..c738447 100644
--- a/doc/CHANGELOG.md
+++ b/doc/CHANGELOG.md
@@ -1,3 +1,21 @@
+
+# [1.0.0-beta.2.0.0](https://github.com/aurelia/pal-nodejs/compare/1.0.0-beta.1.0.0...1.0.0-beta.2.0.0) (2017-08-22)
+
+
+### Bug Fixes
+
+* **whole-text:** remove unnecessary wholeText polyfill ([348a272](https://github.com/aurelia/pal-nodejs/commit/348a272))
+
+
+### Features
+
+* **dom:** add createTemplateElement ([8158b02](https://github.com/aurelia/pal-nodejs/commit/8158b02))
+* **dom:** implement createAttribute ([e926bd9](https://github.com/aurelia/pal-nodejs/commit/e926bd9))
+* **index:** add reset function ([a33a116](https://github.com/aurelia/pal-nodejs/commit/a33a116))
+* **jsdom:** update jsdom ([d8e6239](https://github.com/aurelia/pal-nodejs/commit/d8e6239))
+
+
+
# [1.0.0-beta.1.0.0](https://github.com/aurelia/pal-nodejs/compare/1.0.0-alpha.5...v1.0.0-beta.1.0.0) (2016-12-07)
diff --git a/doc/api.json b/doc/api.json
index a66add1..da9a0d6 100644
--- a/doc/api.json
+++ b/doc/api.json
@@ -1 +1 @@
-{"name":"aurelia-pal-nodejs","children":[{"id":2,"name":"initialize","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":3,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Initializes the PAL with the NodeJS-targeted implementation."},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":4,"character":34}]}],"groups":[{"title":"Functions","kind":64,"children":[2]}]}
\ No newline at end of file
+{"name":"aurelia-pal-nodejs","children":[{"id":4,"name":"globalize","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":5,"name":"globalize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"tags":[{"tag":"description","text":"initializes and makes variables like 'window' into NodeJS globals\n"}]},"type":{"type":"reference","name":"Global"}}],"sources":[{"fileName":"index.d.ts","line":9,"character":33}]},{"id":2,"name":"initialize","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":3,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Initializes the PAL with the NodeJS-targeted implementation."},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":5,"character":34}]},{"id":6,"name":"reset","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":7,"name":"reset","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":8,"name":"window","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Window"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":10,"character":29}]}],"groups":[{"title":"Functions","kind":64,"children":[4,2,6]}]}
\ No newline at end of file
diff --git a/package.json b/package.json
index 2377242..3ab1eb8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "aurelia-pal-nodejs",
- "version": "1.0.0-beta.1.0.0",
+ "version": "1.0.0-beta.2.0.0",
"description": "The Node.js-specific implementation of Aurelia's platform abstraction layer.",
"keywords": [
"aurelia",