Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oozcitak/dom

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oozcitak/dom - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

lib/algorithm/AbortAlgorithm.d.ts

28

lib/algorithm/index.d.ts

@@ -1,1 +0,27 @@

export { DOMAlgorithmImpl as DOMAlgorithm } from './DOMAlgorithmImpl';
export * from "./AbortAlgorithm";
export * from "./AttrAlgorithm";
export * from "./BoundaryPointAlgorithm";
export * from "./CharacterDataAlgorithm";
export * from "./CreateAlgorithm";
export * from "./CustomElementAlgorithm";
export * from "./DocumentAlgorithm";
export * from "./DOMAlgorithm";
export * from "./DOMTokenListAlgorithm";
export * from "./ElementAlgorithm";
export * from "./EventAlgorithm";
export * from "./EventTargetAlgorithm";
export * from "./MutationAlgorithm";
export * from "./MutationObserverAlgorithm";
export * from "./NamespaceAlgorithm";
export * from "./NodeAlgorithm";
export * from "./NodeIteratorAlgorithm";
export * from "./OrderedSetAlgorithm";
export * from "./ParentNodeAlgorithm";
export * from "./RangeAlgorithm";
export * from "./SelectorsAlgorithm";
export * from "./ShadowTreeAlgorithm";
export * from "./TextAlgorithm";
export * from "./TraversalAlgorithm";
export * from "./TreeAlgorithm";
export * from "./TreeWalkerAlgorithm";
export * from "./XMLAlgorithm";
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
// Export classes
var DOMAlgorithmImpl_1 = require("./DOMAlgorithmImpl");
exports.DOMAlgorithm = DOMAlgorithmImpl_1.DOMAlgorithmImpl;
__export(require("./AbortAlgorithm"));
__export(require("./AttrAlgorithm"));
__export(require("./BoundaryPointAlgorithm"));
__export(require("./CharacterDataAlgorithm"));
__export(require("./CreateAlgorithm"));
__export(require("./CustomElementAlgorithm"));
__export(require("./DocumentAlgorithm"));
__export(require("./DOMAlgorithm"));
__export(require("./DOMTokenListAlgorithm"));
__export(require("./ElementAlgorithm"));
__export(require("./EventAlgorithm"));
__export(require("./EventTargetAlgorithm"));
__export(require("./MutationAlgorithm"));
__export(require("./MutationObserverAlgorithm"));
__export(require("./NamespaceAlgorithm"));
__export(require("./NodeAlgorithm"));
__export(require("./NodeIteratorAlgorithm"));
__export(require("./OrderedSetAlgorithm"));
__export(require("./ParentNodeAlgorithm"));
__export(require("./RangeAlgorithm"));
__export(require("./SelectorsAlgorithm"));
__export(require("./ShadowTreeAlgorithm"));
__export(require("./TextAlgorithm"));
__export(require("./TraversalAlgorithm"));
__export(require("./TreeAlgorithm"));
__export(require("./TreeWalkerAlgorithm"));
__export(require("./XMLAlgorithm"));
//# sourceMappingURL=index.js.map

2

lib/dom/AbortControllerImpl.d.ts
import { AbortSignal, AbortController } from "./interfaces";
import { DOMAlgorithm } from "../algorithm/interfaces";
/**

@@ -7,3 +6,2 @@ * Represents a controller that allows to abort DOM requests.

export declare class AbortControllerImpl implements AbortController {
_algo: DOMAlgorithm;
_signal: AbortSignal;

@@ -10,0 +8,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -17,4 +17,3 @@ * Represents a controller that allows to abort DOM requests.

*/
this._algo = util_1.globalStore.dom.algorithm;
this._signal = this._algo.create.abortSignal();
this._signal = algorithm_1.create_abortSignal();
}

@@ -25,3 +24,3 @@ /** @inheritdoc */

abort() {
this._algo.abort.signalAbort(this._signal);
algorithm_1.abort_signalAbort(this._signal);
}

@@ -28,0 +27,0 @@ }

import { EventHandler, AbortSignal } from "./interfaces";
import { EventTargetImpl } from './EventTargetImpl';
import { EventTargetImpl } from "./EventTargetImpl";
/**

@@ -4,0 +4,0 @@ * Represents a signal object that communicates with a DOM request and abort

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const EventTargetImpl_1 = require("./EventTargetImpl");
const algorithm_1 = require("../algorithm");
/**

@@ -21,6 +22,6 @@ * Represents a signal object that communicates with a DOM request and abort

get onabort() {
return this._algo.event.getterEventHandlerIDLAttribute(this, "onabort");
return algorithm_1.event_getterEventHandlerIDLAttribute(this, "onabort");
}
set onabort(val) {
this._algo.event.setterEventHandlerIDLAttribute(this, "onabort", val);
algorithm_1.event_setterEventHandlerIDLAttribute(this, "onabort", val);
}

@@ -27,0 +28,0 @@ /**

@@ -1,2 +0,2 @@

import { Node, BoundaryPoint, AbstractRange } from './interfaces';
import { Node, BoundaryPoint, AbstractRange } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents an abstract range with a start and end boundary point.

@@ -1,2 +0,2 @@

import { Element, NodeType, Attr, Document } from "./interfaces";
import { Element, NodeType, Attr, Document, Node } from "./interfaces";
import { NodeImpl } from "./NodeImpl";

@@ -8,2 +8,3 @@ /**

_nodeType: NodeType;
_children: Set<Node>;
_localName: string;

@@ -10,0 +11,0 @@ _namespace: string | null;

@@ -5,2 +5,4 @@ "use strict";

const NodeImpl_1 = require("./NodeImpl");
const algorithm_1 = require("../algorithm");
const util_1 = require("../util");
/**

@@ -18,2 +20,3 @@ * Represents an attribute of an element node.

this._nodeType = interfaces_1.NodeType.Attribute;
this._children = new util_1.EmptySet();
this._namespace = null;

@@ -44,3 +47,3 @@ this._namespacePrefix = null;

*/
this._algo.attr.setAnExistingAttributeValue(this, value);
algorithm_1.attr_setAnExistingAttributeValue(this, value);
}

@@ -56,3 +59,3 @@ /**

*/
return (this._namespacePrefix ?
return (this._namespacePrefix !== null ?
this._namespacePrefix + ':' + this.localName :

@@ -59,0 +62,0 @@ this.localName);

import { TextImpl } from "./TextImpl";
import { NodeType, CDATASection, Document } from "./interfaces";
import { NodeType, CDATASection, Document, Node } from "./interfaces";
/**

@@ -8,2 +8,3 @@ * Represents a CDATA node.

_nodeType: NodeType;
_children: Set<Node>;
/**

@@ -10,0 +11,0 @@ * Initializes a new instance of `CDATASection`.

@@ -5,2 +5,3 @@ "use strict";

const interfaces_1 = require("./interfaces");
const util_1 = require("../util");
/**

@@ -18,2 +19,3 @@ * Represents a CDATA node.

this._nodeType = interfaces_1.NodeType.CData;
this._children = new util_1.EmptySet();
}

@@ -20,0 +22,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const NodeImpl_1 = require("./NodeImpl");
const algorithm_1 = require("../algorithm");
/**

@@ -15,3 +16,2 @@ * Represents a generic text node.

super();
this._data = '';
this._data = data;

@@ -22,3 +22,3 @@ }

set data(value) {
this._algo.characterData.replaceData(this, 0, this.length, value);
algorithm_1.characterData_replaceData(this, 0, this.length, value);
}

@@ -33,3 +33,3 @@ /** @inheritdoc */

*/
return this._algo.characterData.substringData(this, offset, count);
return algorithm_1.characterData_substringData(this, offset, count);
}

@@ -42,3 +42,3 @@ /** @inheritdoc */

*/
return this._algo.characterData.replaceData(this, this.length, 0, data);
return algorithm_1.characterData_replaceData(this, this.length, 0, data);
}

@@ -51,3 +51,3 @@ /** @inheritdoc */

*/
this._algo.characterData.replaceData(this, offset, 0, data);
algorithm_1.characterData_replaceData(this, offset, 0, data);
}

@@ -61,3 +61,3 @@ /** @inheritdoc */

*/
this._algo.characterData.replaceData(this, offset, count, '');
algorithm_1.characterData_replaceData(this, offset, count, '');
}

@@ -70,3 +70,3 @@ /** @inheritdoc */

*/
this._algo.characterData.replaceData(this, offset, count, data);
algorithm_1.characterData_replaceData(this, offset, count, data);
}

@@ -73,0 +73,0 @@ // MIXIN: NonDocumentTypeChildNode

@@ -1,2 +0,2 @@

import { Node, ChildNode } from './interfaces';
import { Node, ChildNode } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents a mixin that extends child nodes that can have siblings

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -16,3 +17,2 @@ * Represents a mixin that extends child nodes that can have siblings

*/
const algo = util_1.globalStore.dom.algorithm;
const context = util_1.Cast.asNode(this);

@@ -30,3 +30,4 @@ const parent = context._parent;

flag = false;
for (const child of nodes) {
for (let i = 0; i < nodes.length; i++) {
const child = nodes[i];
if (child === viablePreviousSibling) {

@@ -43,3 +44,3 @@ viablePreviousSibling = viablePreviousSibling._previousSibling;

*/
const node = algo.parentNode.convertNodesIntoANode(nodes, context._nodeDocument);
const node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument);
/**

@@ -56,3 +57,3 @@ * 5. If viablePreviousSibling is null, set it to parent’s first child,

*/
algo.mutation.preInsert(node, parent, viablePreviousSibling);
algorithm_1.mutation_preInsert(node, parent, viablePreviousSibling);
}

@@ -65,3 +66,2 @@ /** @inheritdoc */

*/
const algo = util_1.globalStore.dom.algorithm;
const context = util_1.Cast.asNode(this);

@@ -79,3 +79,4 @@ const parent = context.parentNode;

flag = false;
for (const child of nodes) {
for (let i = 0; i < nodes.length; i++) {
const child = nodes[i];
if (child === viableNextSibling) {

@@ -92,7 +93,7 @@ viableNextSibling = viableNextSibling._nextSibling;

*/
const node = algo.parentNode.convertNodesIntoANode(nodes, context._nodeDocument);
const node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument);
/**
* 5. Pre-insert node into parent before viableNextSibling.
*/
algo.mutation.preInsert(node, parent, viableNextSibling);
algorithm_1.mutation_preInsert(node, parent, viableNextSibling);
}

@@ -105,3 +106,2 @@ /** @inheritdoc */

*/
const algo = util_1.globalStore.dom.algorithm;
const context = util_1.Cast.asNode(this);

@@ -119,3 +119,4 @@ const parent = context._parent;

flag = false;
for (const child of nodes) {
for (let i = 0; i < nodes.length; i++) {
const child = nodes[i];
if (child === viableNextSibling) {

@@ -132,3 +133,3 @@ viableNextSibling = viableNextSibling._nextSibling;

*/
const node = algo.parentNode.convertNodesIntoANode(nodes, context._nodeDocument);
const node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument);
/**

@@ -141,5 +142,5 @@ * 5. If context object’s parent is parent, replace the context object with

if (context._parent === parent)
algo.mutation.replace(context, node, parent);
algorithm_1.mutation_replace(context, node, parent);
else
algo.mutation.preInsert(node, parent, viableNextSibling);
algorithm_1.mutation_preInsert(node, parent, viableNextSibling);
}

@@ -152,3 +153,2 @@ /** @inheritdoc */

*/
const algo = util_1.globalStore.dom.algorithm;
const context = util_1.Cast.asNode(this);

@@ -158,3 +158,3 @@ const parent = context._parent;

return;
algo.mutation.remove(context, parent);
algorithm_1.mutation_remove(context, parent);
}

@@ -161,0 +161,0 @@ }

@@ -1,2 +0,2 @@

import { NodeType, Comment, Document } from "./interfaces";
import { NodeType, Comment, Document, Node } from "./interfaces";
import { CharacterDataImpl } from "./CharacterDataImpl";

@@ -8,2 +8,3 @@ /**

_nodeType: NodeType;
_children: Set<Node>;
/**

@@ -10,0 +11,0 @@ * Initializes a new instance of `Comment`.

@@ -5,2 +5,3 @@ "use strict";

const CharacterDataImpl_1 = require("./CharacterDataImpl");
const util_1 = require("../util");
/**

@@ -18,2 +19,3 @@ * Represents a comment node.

this._nodeType = interfaces_1.NodeType.Comment;
this._children = new util_1.EmptySet();
}

@@ -20,0 +22,0 @@ /**

@@ -1,3 +0,3 @@

import { CustomEventInit, CustomEvent } from './interfaces';
import { EventImpl } from './EventImpl';
import { CustomEventInit, CustomEvent } from "./interfaces";
import { EventImpl } from "./EventImpl";
/**

@@ -4,0 +4,0 @@ * Represents and event that carries custom data.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const EventImpl_1 = require("./EventImpl");
const algorithm_1 = require("../algorithm");
/**

@@ -28,3 +29,3 @@ * Represents and event that carries custom data.

*/
this._algo.event.initialize(this, type, bubbles, cancelable);
algorithm_1.event_initialize(this, type, bubbles, cancelable);
/**

@@ -31,0 +32,0 @@ * 3. Set the context object’s detail attribute to detail.

@@ -8,2 +8,3 @@ import { Node, Element, NodeType, HTMLCollection, NodeList, DocumentFragment, Document } from "./interfaces";

_nodeType: NodeType;
_children: Set<Node>;
_host: Element | null;

@@ -10,0 +11,0 @@ /**

@@ -17,2 +17,3 @@ "use strict";

this._nodeType = interfaces_1.NodeType.DocumentFragment;
this._children = new Set();
this._host = host;

@@ -19,0 +20,0 @@ }

@@ -1,4 +0,4 @@

import { DOMImplementation, DocumentType, Element, Text, NodeFilter, NodeType, Node, HTMLCollection, DocumentFragment, NodeList, WhatToShow, Attr, ProcessingInstruction, Comment, CDATASection, NodeIterator, TreeWalker, FilterResult, Range, Event, EventTarget, Origin, Document } from './interfaces';
import { NodeImpl } from './NodeImpl';
import { Interfaces as URLInterfaces } from '@oozcitak/url';
import { DOMImplementation, DocumentType, Element, Text, NodeFilter, NodeType, Node, HTMLCollection, DocumentFragment, NodeList, WhatToShow, Attr, ProcessingInstruction, Comment, CDATASection, NodeIterator, TreeWalker, FilterResult, Range, Event, EventTarget, Origin, Document } from "./interfaces";
import { NodeImpl } from "./NodeImpl";
import { URLRecord } from "@oozcitak/url/lib/interfaces";
/**

@@ -9,2 +9,3 @@ * Represents a document node.

_nodeType: NodeType;
_children: Set<Node>;
_encoding: {

@@ -15,7 +16,7 @@ name: string;

_contentType: string;
_URL: URLInterfaces.URLRecord;
_URL: URLRecord;
_origin: Origin;
_type: "xml" | "html";
_mode: "no-quirks" | "quirks" | "limited-quirks";
protected _implementation: DOMImplementation;
protected _implementation?: DOMImplementation;
_nodeDocumentOverwrite: Document | null;

@@ -22,0 +23,0 @@ get _nodeDocument(): Document;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
const interfaces_1 = require("./interfaces");

@@ -9,3 +10,4 @@ const DOMException_1 = require("./DOMException");

const infra_1 = require("@oozcitak/infra");
const url_1 = require("@oozcitak/url");
const URLAlgorithm_1 = require("@oozcitak/url/lib/URLAlgorithm");
const algorithm_1 = require("../algorithm");
/**

@@ -21,2 +23,3 @@ * Represents a document node.

this._nodeType = interfaces_1.NodeType.Document;
this._children = new Set();
this._encoding = {

@@ -43,3 +46,2 @@ name: "UTF-8",

this._nodeDocumentOverwrite = null;
this._implementation = this._algo.create.domImplementation(this);
}

@@ -54,3 +56,3 @@ get _nodeDocument() { return this._nodeDocumentOverwrite || this; }

*/
return this._implementation;
return this._implementation || (this._implementation = algorithm_1.create_domImplementation(this));
}

@@ -64,3 +66,3 @@ /** @inheritdoc */

*/
return new url_1.URLAlgorithm().urlSerializer(this._URL);
return URLAlgorithm_1.urlSerializer(this._URL);
}

@@ -130,3 +132,3 @@ /** @inheritdoc */

*/
return this._algo.node.listOfElementsWithQualifiedName(qualifiedName, this);
return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this);
}

@@ -140,3 +142,3 @@ /** @inheritdoc */

*/
return this._algo.node.listOfElementsWithNamespace(namespace, localName, this);
return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this);
}

@@ -149,3 +151,3 @@ /** @inheritdoc */

*/
return this._algo.node.listOfElementsWithClassNames(classNames, this);
return algorithm_1.node_listOfElementsWithClassNames(classNames, this);
}

@@ -169,3 +171,3 @@ /** @inheritdoc */

*/
if (!this._algo.xml.isName(localName))
if (!algorithm_1.xml_isName(localName))
throw new DOMException_1.InvalidCharacterError();

@@ -185,3 +187,3 @@ if (this._type === "html")

infra_1.namespace.HTML : null;
return this._algo.element.createAnElement(this, localName, namespace, null, is, true);
return algorithm_1.element_createAnElement(this, localName, namespace, null, is, true);
}

@@ -195,3 +197,3 @@ /** @inheritdoc */

*/
return this._algo.document.internalCreateElementNS(this, namespace, qualifiedName, options);
return algorithm_1.document_internalCreateElementNS(this, namespace, qualifiedName, options);
}

@@ -204,3 +206,3 @@ /** @inheritdoc */

*/
return this._algo.create.documentFragment(this);
return algorithm_1.create_documentFragment(this);
}

@@ -213,3 +215,3 @@ /** @inheritdoc */

*/
return this._algo.create.text(this, data);
return algorithm_1.create_text(this, data);
}

@@ -230,3 +232,3 @@ /** @inheritdoc */

throw new DOMException_1.InvalidCharacterError();
return this._algo.create.cdataSection(this, data);
return algorithm_1.create_cdataSection(this, data);
}

@@ -239,3 +241,3 @@ /** @inheritdoc */

*/
return this._algo.create.comment(this, data);
return algorithm_1.create_comment(this, data);
}

@@ -252,7 +254,7 @@ /** @inheritdoc */

*/
if (!this._algo.xml.isName(target))
if (!algorithm_1.xml_isName(target))
throw new DOMException_1.InvalidCharacterError();
if (data.includes("?>"))
throw new DOMException_1.InvalidCharacterError();
return this._algo.create.processingInstruction(this, target, data);
return algorithm_1.create_processingInstruction(this, target, data);
}

@@ -269,3 +271,3 @@ /** @inheritdoc */

*/
return this._algo.node.clone(node, this, deep);
return algorithm_1.node_clone(node, this, deep);
}

@@ -288,3 +290,3 @@ /** @inheritdoc */

*/
this._algo.document.adopt(node, this);
algorithm_1.document_adopt(node, this);
return node;

@@ -302,3 +304,3 @@ }

*/
if (!this._algo.xml.isName(localName))
if (!algorithm_1.xml_isName(localName))
throw new DOMException_1.InvalidCharacterError();

@@ -308,3 +310,3 @@ if (this._type === "html") {

}
const attr = this._algo.create.attr(this, localName);
const attr = algorithm_1.create_attr(this, localName);
return attr;

@@ -320,4 +322,4 @@ }

*/
const [ns, prefix, localName] = this._algo.namespace.validateAndExtract(namespace, qualifiedName);
const attr = this._algo.create.attr(this, localName);
const [ns, prefix, localName] = algorithm_1.namespace_validateAndExtract(namespace, qualifiedName);
const attr = algorithm_1.create_attr(this, localName);
attr._namespace = ns;

@@ -329,3 +331,3 @@ attr._namespacePrefix = prefix;

createEvent(eventInterface) {
return this._algo.event.createLegacyEvent(eventInterface);
return algorithm_1.event_createLegacyEvent(eventInterface);
}

@@ -338,3 +340,3 @@ /** @inheritdoc */

*/
const range = this._algo.create.range();
const range = algorithm_1.create_range();
range._start = [this, 0];

@@ -354,7 +356,7 @@ range._end = [this, 0];

*/
const iterator = this._algo.create.nodeIterator(root, root, true);
const iterator = algorithm_1.create_nodeIterator(root, root, true);
iterator._whatToShow = whatToShow;
iterator._iteratorCollection = this._algo.create.nodeList(root);
iterator._iteratorCollection = algorithm_1.create_nodeList(root);
if (util_2.isFunction(filter)) {
iterator._filter = this._algo.create.nodeFilter();
iterator._filter = algorithm_1.create_nodeFilter();
iterator._filter.acceptNode = filter;

@@ -376,6 +378,6 @@ }

*/
const walker = this._algo.create.treeWalker(root, root);
const walker = algorithm_1.create_treeWalker(root, root);
walker._whatToShow = whatToShow;
if (util_2.isFunction(filter)) {
walker._filter = this._algo.create.nodeFilter();
walker._filter = algorithm_1.create_nodeFilter();
walker._filter.acceptNode = filter;

@@ -404,3 +406,3 @@ }

else {
return util_1.globalStore.dom.window;
return __1.dom.window;
}

@@ -407,0 +409,0 @@ }

@@ -1,2 +0,2 @@

import { DocumentOrShadowRoot } from './interfaces';
import { DocumentOrShadowRoot } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents a mixin for an interface to be used to share APIs between

import { Node, NodeType, DocumentType, Document } from "./interfaces";
import { NodeImpl } from './NodeImpl';
import { NodeImpl } from "./NodeImpl";
/**

@@ -9,2 +9,3 @@ * Represents an object providing methods which are not dependent on

_nodeType: NodeType;
_children: Set<Node>;
_name: string;

@@ -11,0 +12,0 @@ _publicId: string;

@@ -5,2 +5,3 @@ "use strict";

const NodeImpl_1 = require("./NodeImpl");
const util_1 = require("../util");
/**

@@ -21,2 +22,3 @@ * Represents an object providing methods which are not dependent on

this._nodeType = interfaces_1.NodeType.DocumentType;
this._children = new util_1.EmptySet();
this._name = '';

@@ -23,0 +25,0 @@ this._publicId = '';

@@ -8,7 +8,8 @@ import { DocumentType, Document, XMLDocument, DOMImplementation } from "./interfaces";

_associatedDocument: Document;
private _algo;
/**
* Initializes a new instance of `DOMImplementation`.
*
* @param document - the associated document
*/
private constructor();
constructor(document?: Document);
/** @inheritdoc */

@@ -15,0 +16,0 @@ createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const infra_1 = require("@oozcitak/infra");
const algorithm_1 = require("../algorithm");
const DOMImpl_1 = require("./DOMImpl");
/**

@@ -12,6 +13,7 @@ * Represents an object providing methods which are not dependent on

* Initializes a new instance of `DOMImplementation`.
*
* @param document - the associated document
*/
constructor(document) {
this._associatedDocument = document;
this._algo = util_1.globalStore.dom.algorithm;
this._associatedDocument = document || DOMImpl_1.DOMImpl.instance.window.document;
}

@@ -26,4 +28,4 @@ /** @inheritdoc */

*/
this._algo.namespace.validate(qualifiedName);
return this._algo.create.documentType(this._associatedDocument, qualifiedName, publicId, systemId);
algorithm_1.namespace_validate(qualifiedName);
return algorithm_1.create_documentType(this._associatedDocument, qualifiedName, publicId, systemId);
}

@@ -35,3 +37,3 @@ /** @inheritdoc */

*/
const document = this._algo.create.xmlDocument();
const document = algorithm_1.create_xmlDocument();
/**

@@ -45,3 +47,3 @@ * 2. Let element be null.

if (qualifiedName) {
element = this._algo.document.internalCreateElementNS(document, namespace, qualifiedName);
element = algorithm_1.document_internalCreateElementNS(document, namespace, qualifiedName);
}

@@ -86,3 +88,3 @@ /**

*/
const doc = this._algo.create.document();
const doc = algorithm_1.create_document();
doc._type = "html";

@@ -94,3 +96,3 @@ doc._contentType = "text/html";

*/
doc.appendChild(this._algo.create.documentType(doc, "html", "", ""));
doc.appendChild(algorithm_1.create_documentType(doc, "html", "", ""));
/**

@@ -100,3 +102,3 @@ * 4. Append the result of creating an element given doc, html, and the

*/
const htmlElement = this._algo.element.createAnElement(doc, "html", infra_1.namespace.HTML);
const htmlElement = algorithm_1.element_createAnElement(doc, "html", infra_1.namespace.HTML);
doc.appendChild(htmlElement);

@@ -107,3 +109,3 @@ /**

*/
const headElement = this._algo.element.createAnElement(doc, "head", infra_1.namespace.HTML);
const headElement = algorithm_1.element_createAnElement(doc, "head", infra_1.namespace.HTML);
htmlElement.appendChild(headElement);

@@ -119,5 +121,5 @@ /**

if (title !== undefined) {
const titleElement = this._algo.element.createAnElement(doc, "title", infra_1.namespace.HTML);
const titleElement = algorithm_1.element_createAnElement(doc, "title", infra_1.namespace.HTML);
headElement.appendChild(titleElement);
const textElement = this._algo.create.text(doc, title);
const textElement = algorithm_1.create_text(doc, title);
titleElement.appendChild(textElement);

@@ -129,3 +131,3 @@ }

*/
const bodyElement = this._algo.element.createAnElement(doc, "body", infra_1.namespace.HTML);
const bodyElement = algorithm_1.element_createAnElement(doc, "body", infra_1.namespace.HTML);
htmlElement.appendChild(bodyElement);

@@ -132,0 +134,0 @@ /**

import { DOMTokenList, Element, Attr } from "./interfaces";
import { DOMAlgorithm } from "../algorithm/interfaces";
/**

@@ -10,3 +9,2 @@ * Represents a token set.

_tokenSet: Set<string>;
protected _algo: DOMAlgorithm;
/**

@@ -13,0 +11,0 @@ * Initializes a new instance of `DOMTokenList`.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
const DOMException_1 = require("./DOMException");
const util_1 = require("../util");
const infra_1 = require("@oozcitak/infra");
const algorithm_1 = require("../algorithm");
/**

@@ -17,3 +18,2 @@ * Represents a token set.

constructor(element, attribute) {
this._algo = util_1.globalStore.dom.algorithm;
/**

@@ -31,3 +31,3 @@ * 1. Let element be associated element.

const localName = attribute._localName;
const value = this._algo.element.getAnAttributeValue(element, localName);
const value = algorithm_1.element_getAnAttributeValue(element, localName);
// define a closure to be called when the associated attribute's value changes

@@ -46,3 +46,3 @@ const thisObj = this;

else
thisObj._tokenSet = thisObj._algo.orderedSet.parse(value);
thisObj._tokenSet = algorithm_1.orderedSet_parse(value);
}

@@ -52,3 +52,5 @@ }

this._element._attributeChangeSteps.push(updateTokenSet);
this._algo.runAttributeChangeSteps(element, localName, value, value, null);
if (__1.dom.features.steps) {
algorithm_1.dom_runAttributeChangeSteps(element, localName, value, value, null);
}
}

@@ -97,3 +99,3 @@ /** @inheritdoc */

*/
for (const token of tokens) {
tokens.forEach(token => {
if (token === '') {

@@ -108,4 +110,4 @@ throw new DOMException_1.SyntaxError("Cannot add an empty token.");

}
}
this._algo.tokenList.updateSteps(this);
});
algorithm_1.tokenList_updateSteps(this);
}

@@ -123,3 +125,3 @@ /** @inheritdoc */

*/
for (const token of tokens) {
tokens.forEach(token => {
if (token === '') {

@@ -134,4 +136,4 @@ throw new DOMException_1.SyntaxError("Cannot remove an empty token.");

}
}
this._algo.tokenList.updateSteps(this);
});
algorithm_1.tokenList_updateSteps(this);
}

@@ -162,3 +164,3 @@ /** @inheritdoc */

this._tokenSet.delete(token);
this._algo.tokenList.updateSteps(this);
algorithm_1.tokenList_updateSteps(this);
return false;

@@ -174,3 +176,3 @@ }

this._tokenSet.add(token);
this._algo.tokenList.updateSteps(this);
algorithm_1.tokenList_updateSteps(this);
return true;

@@ -209,3 +211,3 @@ }

infra_1.set.replace(this._tokenSet, token, newToken);
this._algo.tokenList.updateSteps(this);
algorithm_1.tokenList_updateSteps(this);
return true;

@@ -219,3 +221,3 @@ }

*/
return this._algo.tokenList.validationSteps(this, token);
return algorithm_1.tokenList_validationSteps(this, token);
}

@@ -228,3 +230,3 @@ /** @inheritdoc */

*/
return this._algo.tokenList.serializeSteps(this);
return algorithm_1.tokenList_serializeSteps(this);
}

@@ -237,3 +239,3 @@ set value(value) {

*/
this._algo.element.setAnAttributeValue(this._element, this._attribute.localName, value);
algorithm_1.element_setAnAttributeValue(this._element, this._attribute.localName, value);
}

@@ -240,0 +242,0 @@ /**

@@ -1,4 +0,3 @@

import { Attr, NamedNodeMap, DOMTokenList, ShadowRoot, NodeType, Node, Document, Element, HTMLCollection, NodeList, ShadowRootMode, CustomElementDefinition, HTMLSlotElement, Slot } from './interfaces';
import { NodeImpl } from './NodeImpl';
import { AttributeChangeStep } from '../algorithm/interfaces';
import { Attr, NamedNodeMap, DOMTokenList, ShadowRoot, NodeType, Node, Document, Element, HTMLCollection, NodeList, ShadowRootMode, CustomElementDefinition, HTMLSlotElement, Slot, AttributeChangeStep } from "./interfaces";
import { NodeImpl } from "./NodeImpl";
/**

@@ -9,2 +8,3 @@ * Represents an element node.

_nodeType: NodeType;
_children: Set<Node>;
_namespace: string | null;

@@ -17,4 +17,5 @@ _namespacePrefix: string | null;

_shadowRoot: ShadowRoot | null;
_attributeList: NamedNodeMap;
_uniqueIdentifier?: string | undefined;
__attributeList?: NamedNodeMap;
get _attributeList(): NamedNodeMap;
_uniqueIdentifier?: string;
_attributeChangeSteps: AttributeChangeStep[];

@@ -126,14 +127,2 @@ _name: string;

/**
* Defines attribute change steps to update a slot’s name.
*/
private _updateASlotsName;
/**
* Defines attribute change steps to update a slotable’s name.
*/
private _updateASlotablesName;
/**
* Defines attribute change steps to update an element's ID.
*/
private _updateAnElementID;
/**
* Creates a new `Element`.

@@ -140,0 +129,0 @@ *

@@ -7,3 +7,3 @@ "use strict";

const infra_1 = require("@oozcitak/infra");
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -19,2 +19,3 @@ * Represents an element node.

this._nodeType = interfaces_1.NodeType.Element;
this._children = new Set();
this._namespace = null;

@@ -30,9 +31,4 @@ this._namespacePrefix = null;

this._assignedSlot = null;
this._attributeList = this._algo.create.namedNodeMap(this);
if (util_1.globalStore.dom.features.slots) {
this._attributeChangeSteps.push(this._updateASlotablesName);
this._attributeChangeSteps.push(this._updateASlotsName);
}
this._attributeChangeSteps.push(this._updateAnElementID);
}
get _attributeList() { return this.__attributeList || (this.__attributeList = algorithm_1.create_namedNodeMap(this)); }
/** @inheritdoc */

@@ -48,28 +44,28 @@ get namespaceURI() { return this._namespace; }

get id() {
return this._algo.element.getAnAttributeValue(this, "id");
return algorithm_1.element_getAnAttributeValue(this, "id");
}
set id(value) {
this._algo.element.setAnAttributeValue(this, "id", value);
algorithm_1.element_setAnAttributeValue(this, "id", value);
}
/** @inheritdoc */
get className() {
return this._algo.element.getAnAttributeValue(this, "class");
return algorithm_1.element_getAnAttributeValue(this, "class");
}
set className(value) {
this._algo.element.setAnAttributeValue(this, "class", value);
algorithm_1.element_setAnAttributeValue(this, "class", value);
}
/** @inheritdoc */
get classList() {
let attr = this._algo.element.getAnAttributeByName("class", this);
let attr = algorithm_1.element_getAnAttributeByName("class", this);
if (attr === null) {
attr = this._algo.create.attr(this._nodeDocument, "class");
attr = algorithm_1.create_attr(this._nodeDocument, "class");
}
return this._algo.create.domTokenList(this, attr);
return algorithm_1.create_domTokenList(this, attr);
}
/** @inheritdoc */
get slot() {
return this._algo.element.getAnAttributeValue(this, "slot");
return algorithm_1.element_getAnAttributeValue(this, "slot");
}
set slot(value) {
this._algo.element.setAnAttributeValue(this, "slot", value);
algorithm_1.element_setAnAttributeValue(this, "slot", value);
}

@@ -90,5 +86,3 @@ /** @inheritdoc */

const names = [];
for (const attr of this._attributeList) {
names.push(attr._qualifiedName);
}
this._attributeList._attributeList.forEach(attr => names.push(attr._qualifiedName));
return names;

@@ -104,3 +98,3 @@ }

*/
const attr = this._algo.element.getAnAttributeByName(qualifiedName, this);
const attr = algorithm_1.element_getAnAttributeByName(qualifiedName, this);
return (attr ? attr._value : null);

@@ -116,3 +110,3 @@ }

*/
const attr = this._algo.element.getAnAttributeByNamespaceAndLocalName(namespace, localName, this);
const attr = algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this);
return (attr ? attr.value : null);

@@ -126,3 +120,3 @@ }

*/
if (!this._algo.xml.isName(qualifiedName))
if (!algorithm_1.xml_isName(qualifiedName))
throw new DOMException_1.InvalidCharacterError();

@@ -142,3 +136,4 @@ /**

let attribute = null;
for (const attr of this._attributeList) {
for (let i = 0; i < this._attributeList._attributeList.length; i++) {
const attr = this._attributeList._attributeList[i];
if (attr._qualifiedName === qualifiedName) {

@@ -156,5 +151,5 @@ attribute = attr;

if (attribute === null) {
attribute = this._algo.create.attr(this._nodeDocument, qualifiedName);
attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName);
attribute._value = value;
this._algo.element.append(attribute, this);
algorithm_1.element_append(attribute, this);
return;

@@ -165,3 +160,3 @@ }

*/
this._algo.element.change(attribute, this, value);
algorithm_1.element_change(attribute, this, value);
}

@@ -176,4 +171,4 @@ /** @inheritdoc */

*/
const [ns, prefix, localName] = this._algo.namespace.validateAndExtract(namespace, qualifiedName);
this._algo.element.setAnAttributeValue(this, localName, value, prefix, ns);
const [ns, prefix, localName] = algorithm_1.namespace_validateAndExtract(namespace, qualifiedName);
algorithm_1.element_setAnAttributeValue(this, localName, value, prefix, ns);
}

@@ -187,3 +182,3 @@ /** @inheritdoc */

*/
this._algo.element.removeAnAttributeByName(qualifiedName, this);
algorithm_1.element_removeAnAttributeByName(qualifiedName, this);
}

@@ -197,3 +192,3 @@ /** @inheritdoc */

*/
this._algo.element.removeAnAttributeByNamespaceAndLocalName(namespace, localName, this);
algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, this);
}

@@ -212,3 +207,4 @@ /** @inheritdoc */

}
for (const attr of this._attributeList) {
for (let i = 0; i < this._attributeList._attributeList.length; i++) {
const attr = this._attributeList._attributeList[i];
if (attr._qualifiedName === qualifiedName) {

@@ -226,3 +222,3 @@ return true;

*/
if (!this._algo.xml.isName(qualifiedName))
if (!algorithm_1.xml_isName(qualifiedName))
throw new DOMException_1.InvalidCharacterError();

@@ -242,3 +238,4 @@ /**

let attribute = null;
for (const attr of this._attributeList) {
for (let i = 0; i < this._attributeList._attributeList.length; i++) {
const attr = this._attributeList._attributeList[i];
if (attr._qualifiedName === qualifiedName) {

@@ -259,5 +256,5 @@ attribute = attr;

if (force === undefined || force === true) {
attribute = this._algo.create.attr(this._nodeDocument, qualifiedName);
attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName);
attribute._value = '';
this._algo.element.append(attribute, this);
algorithm_1.element_append(attribute, this);
return true;

@@ -272,3 +269,3 @@ }

*/
this._algo.element.removeAnAttributeByName(qualifiedName, this);
algorithm_1.element_removeAnAttributeByName(qualifiedName, this);
return false;

@@ -289,3 +286,4 @@ }

const ns = namespace || null;
for (const attr of this._attributeList) {
for (let i = 0; i < this._attributeList._attributeList.length; i++) {
const attr = this._attributeList._attributeList[i];
if (attr._namespace === ns && attr._localName === localName) {

@@ -303,3 +301,3 @@ return true;

*/
return this._algo.element.getAnAttributeByName(qualifiedName, this);
return algorithm_1.element_getAnAttributeByName(qualifiedName, this);
}

@@ -313,3 +311,3 @@ /** @inheritdoc */

*/
return this._algo.element.getAnAttributeByNamespaceAndLocalName(namespace, localName, this);
return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this);
}

@@ -323,7 +321,7 @@ /** @inheritdoc */

*/
return this._algo.element.setAnAttribute(attr, this);
return algorithm_1.element_setAnAttribute(attr, this);
}
/** @inheritdoc */
setAttributeNodeNS(attr) {
return this._algo.element.setAnAttribute(attr, this);
return algorithm_1.element_setAnAttribute(attr, this);
}

@@ -339,3 +337,4 @@ /** @inheritdoc */

let found = false;
for (const attribute of this._attributeList) {
for (let i = 0; i < this._attributeList._attributeList.length; i++) {
const attribute = this._attributeList._attributeList[i];
if (attribute === attr) {

@@ -348,3 +347,3 @@ found = true;

throw new DOMException_1.NotFoundError();
this._algo.element.remove(attr, this);
algorithm_1.element_remove(attr, this);
return attr;

@@ -366,4 +365,4 @@ }

*/
if (!this._algo.customElement.isValidCustomElementName(this._localName) &&
!this._algo.customElement.isValidShadowHostName(this._localName))
if (!algorithm_1.customElement_isValidCustomElementName(this._localName) &&
!algorithm_1.customElement_isValidShadowHostName(this._localName))
throw new DOMException_1.NotSupportedError();

@@ -379,4 +378,4 @@ /**

*/
if (this._algo.customElement.isValidCustomElementName(this._localName) || this._is !== null) {
const definition = this._algo.customElement.lookUpACustomElementDefinition(this._nodeDocument, this._namespace, this._localName, this._is);
if (algorithm_1.customElement_isValidCustomElementName(this._localName) || this._is !== null) {
const definition = algorithm_1.customElement_lookUpACustomElementDefinition(this._nodeDocument, this._namespace, this._localName, this._is);
if (definition !== null && definition.disableShadow === true) {

@@ -398,3 +397,3 @@ throw new DOMException_1.NotSupportedError();

*/
const shadow = this._algo.create.shadowRoot(this._nodeDocument, this);
const shadow = algorithm_1.create_shadowRoot(this._nodeDocument, this);
shadow._mode = init.mode;

@@ -455,3 +454,3 @@ this._shadowRoot = shadow;

*/
return this._algo.node.listOfElementsWithQualifiedName(qualifiedName, this);
return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this);
}

@@ -465,3 +464,3 @@ /** @inheritdoc */

*/
return this._algo.node.listOfElementsWithNamespace(namespace, localName, this);
return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this);
}

@@ -474,3 +473,3 @@ /** @inheritdoc */

*/
return this._algo.node.listOfElementsWithClassNames(classNames, this);
return algorithm_1.node_listOfElementsWithClassNames(classNames, this);
}

@@ -484,3 +483,3 @@ /** @inheritdoc */

*/
return this._algo.element.insertAdjacent(this, where, element);
return algorithm_1.element_insertAdjacent(this, where, element);
}

@@ -494,4 +493,4 @@ /** @inheritdoc */

*/
const text = this._algo.create.text(this._nodeDocument, data);
this._algo.element.insertAdjacent(this, where, text);
const text = algorithm_1.create_text(this._nodeDocument, data);
algorithm_1.element_insertAdjacent(this, where, text);
}

@@ -563,86 +562,2 @@ /**

/**
* Defines attribute change steps to update a slot’s name.
*/
_updateASlotsName(element, localName, oldValue, value, namespace) {
/**
* 1. If element is a slot, localName is name, and namespace is null, then:
* 1.1. If value is oldValue, then return.
* 1.2. If value is null and oldValue is the empty string, then return.
* 1.3. If value is the empty string and oldValue is null, then return.
* 1.4. If value is null or the empty string, then set element’s name to the
* empty string.
* 1.5. Otherwise, set element’s name to value.
* 1.6. Run assign slotables for a tree with element’s root.
*/
if (util_1.Guard.isSlot(element) && localName === "name" && namespace === null) {
if (value === oldValue)
return;
if (value === null && oldValue === '')
return;
if (value === '' && oldValue === null)
return;
if ((value === null || value === '')) {
element._name = '';
}
else {
element._name = value;
}
const algo = util_1.globalStore.dom.algorithm;
algo.shadowTree.assignSlotablesForATree(algo.tree.rootNode(element));
}
}
/**
* Defines attribute change steps to update a slotable’s name.
*/
_updateASlotablesName(element, localName, oldValue, value, namespace) {
/**
* 1. If localName is slot and namespace is null, then:
* 1.1. If value is oldValue, then return.
* 1.2. If value is null and oldValue is the empty string, then return.
* 1.3. If value is the empty string and oldValue is null, then return.
* 1.4. If value is null or the empty string, then set element’s name to
* the empty string.
* 1.5. Otherwise, set element’s name to value.
* 1.6. If element is assigned, then run assign slotables for element’s
* assigned slot.
* 1.7. Run assign a slot for element.
*/
if (util_1.Guard.isSlotable(element) && localName === "slot" && namespace === null) {
if (value === oldValue)
return;
if (value === null && oldValue === '')
return;
if (value === '' && oldValue === null)
return;
if ((value === null || value === '')) {
element._name = '';
}
else {
element._name = value;
}
const algo = util_1.globalStore.dom.algorithm;
if (algo.shadowTree.isAssigned(element)) {
algo.shadowTree.assignSlotables(element._assignedSlot);
}
algo.shadowTree.assignASlot(element);
}
}
/**
* Defines attribute change steps to update an element's ID.
*/
_updateAnElementID(element, localName, oldValue, value, namespace) {
/**
* 1. If localName is id, namespace is null, and value is null or the empty
* string, then unset element’s ID.
* 2. Otherwise, if localName is id, namespace is null, then set element’s
* ID to value.
*/
if (localName === "id" && namespace === null) {
if (!value)
element._uniqueIdentifier = undefined;
else
element._uniqueIdentifier = value;
}
}
/**
* Creates a new `Element`.

@@ -649,0 +564,0 @@ *

@@ -1,3 +0,2 @@

import { EventInit, EventTarget, EventPhase, PotentialEventTarget, EventPathItem, Event } from './interfaces';
import { DOMAlgorithm } from '../algorithm/interfaces';
import { EventInit, EventTarget, EventPhase, PotentialEventTarget, EventPathItem, Event } from "./interfaces";
/**

@@ -29,3 +28,2 @@ * Represents a DOM event.

_timeStamp: number;
protected _algo: DOMAlgorithm;
/**

@@ -32,0 +30,0 @@ * Initializes a new instance of `Event`.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const interfaces_1 = require("./interfaces");
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -33,3 +33,2 @@ * Represents a DOM event.

this._cancelable = false;
this._algo = util_1.globalStore.dom.algorithm;
/**

@@ -223,3 +222,3 @@ * When a constructor of the Event interface, or of an interface that

if (!value) {
this._algo.event.setTheCanceledFlag(this);
algorithm_1.event_setTheCanceledFlag(this);
}

@@ -229,3 +228,3 @@ }

preventDefault() {
this._algo.event.setTheCanceledFlag(this);
algorithm_1.event_setTheCanceledFlag(this);
}

@@ -250,3 +249,3 @@ /** @inheritdoc */

*/
this._algo.event.initialize(this, type, bubbles, cancelable);
algorithm_1.event_initialize(this, type, bubbles, cancelable);
}

@@ -253,0 +252,0 @@ }

@@ -1,3 +0,2 @@

import { Event, EventListener, EventTarget, AddEventListenerOptions, EventListenerOptions, EventListenerEntry, EventHandlerEntry } from './interfaces';
import { DOMAlgorithm } from '../algorithm/interfaces';
import { Event, EventListener, EventTarget, AddEventListenerOptions, EventListenerOptions, EventListenerEntry, EventHandlerEntry } from "./interfaces";
/**

@@ -7,5 +6,8 @@ * Represents a target to which an event can be dispatched.

export declare abstract class EventTargetImpl implements EventTarget {
_eventListenerList: EventListenerEntry[];
_eventHandlerMap: Map<string, EventHandlerEntry>;
protected _algo: DOMAlgorithm;
private __eventListenerList?;
get _eventListenerList(): EventListenerEntry[];
private __eventHandlerMap?;
get _eventHandlerMap(): {
[key: string]: EventHandlerEntry;
};
/**

@@ -12,0 +14,0 @@ * Initializes a new instance of `EventTarget`.

@@ -5,2 +5,3 @@ "use strict";

const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -13,7 +14,9 @@ * Represents a target to which an event can be dispatched.

*/
constructor() {
this._eventListenerList = [];
this._eventHandlerMap = new Map();
this._algo = util_1.globalStore.dom.algorithm;
constructor() { }
get _eventListenerList() {
return this.__eventListenerList || (this.__eventListenerList = []);
}
get _eventHandlerMap() {
return this.__eventHandlerMap || (this.__eventHandlerMap = {});
}
/** @inheritdoc */

@@ -24,3 +27,3 @@ addEventListener(type, callback, options = { passive: false, once: false, capture: false }) {

*/
const [capture, passive, once] = this._algo.eventTarget.flattenMore(options);
const [capture, passive, once] = algorithm_1.eventTarget_flattenMore(options);
// convert callback function to EventListener, return if null

@@ -42,3 +45,3 @@ let listenerCallback;

*/
this._algo.eventTarget.addEventListener(this, {
algorithm_1.eventTarget_addEventListener(this, {
type: type,

@@ -64,3 +67,3 @@ callback: listenerCallback,

*/
const capture = this._algo.eventTarget.flatten(options);
const capture = algorithm_1.eventTarget_flatten(options);
if (!callback)

@@ -73,15 +76,14 @@ return;

*/
let i = 0;
for (const entry of this._eventListenerList) {
for (let i = 0; i < this._eventListenerList.length; i++) {
const entry = this._eventListenerList[i];
if (entry.type !== type || entry.capture !== capture)
continue;
if (util_1.Guard.isEventListener(callback) && entry.callback === callback) {
this._algo.eventTarget.removeEventListener(this, entry, i);
algorithm_1.eventTarget_removeEventListener(this, entry, i);
break;
}
else if (callback && entry.callback.handleEvent === callback) {
this._algo.eventTarget.removeEventListener(this, entry, i);
algorithm_1.eventTarget_removeEventListener(this, entry, i);
break;
}
i++;
}

@@ -101,3 +103,3 @@ }

event._isTrusted = false;
return this._algo.event.dispatch(event, this);
return algorithm_1.event_dispatch(event, this);
}

@@ -104,0 +106,0 @@ /** @inheritdoc */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const infra_1 = require("@oozcitak/infra");
const algorithm_1 = require("../algorithm");
const util_1 = require("../util");
const infra_1 = require("@oozcitak/infra");
/**

@@ -28,4 +29,6 @@ * Represents a collection of elements.

let count = 0;
for (const node of this) {
let node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e));
while (node !== null) {
count++;
node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e));
}

@@ -42,3 +45,4 @@ return count;

let i = 0;
for (const node of this) {
let node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e));
while (node !== null) {
if (i === index)

@@ -48,2 +52,3 @@ return node;

i++;
node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e));
}

@@ -64,3 +69,4 @@ return null;

return null;
for (const ele of this) {
let ele = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e));
while (ele != null) {
if (ele._uniqueIdentifier === key) {

@@ -70,3 +76,4 @@ return ele;

else if (ele._namespace === infra_1.namespace.HTML) {
for (const attr of ele._attributeList) {
for (let i = 0; i < ele._attributeList._attributeList.length; i++) {
const attr = ele._attributeList._attributeList[i];
if (attr._localName === "name" && attr._namespace === null &&

@@ -77,2 +84,3 @@ attr._namespacePrefix === null && attr._value === key)

}
ele = algorithm_1.tree_getNextDescendantNode(this._root, ele, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e));
}

@@ -83,5 +91,5 @@ return null;

[Symbol.iterator]() {
const algo = util_1.globalStore.dom.algorithm;
const it = algo.tree.getDescendantElements(this._root, false, false, (ele) => { return !!this._filter(ele); })[Symbol.iterator]();
let currentNode = it.next().value;
const root = this._root;
const filter = this._filter;
let currentNode = algorithm_1.tree_getFirstDescendantNode(root, false, false, (e) => util_1.Guard.isElementNode(e) && filter(e));
return {

@@ -94,3 +102,3 @@ next() {

const result = { done: false, value: currentNode };
currentNode = it.next().value;
currentNode = algorithm_1.tree_getNextDescendantNode(root, currentNode, false, false, (e) => util_1.Guard.isElementNode(e) && filter(e));
return result;

@@ -97,0 +105,0 @@ }

@@ -1,39 +0,36 @@

import { AbortControllerImpl } from './AbortControllerImpl';
import { AbortSignalImpl } from './AbortSignalImpl';
import { AbstractRangeImpl } from './AbstractRangeImpl';
import { AttrImpl } from './AttrImpl';
import { CDATASectionImpl } from './CDATASectionImpl';
import { CharacterDataImpl } from './CharacterDataImpl';
import { CommentImpl } from './CommentImpl';
import { CustomEventImpl } from './CustomEventImpl';
import { DocumentFragmentImpl } from './DocumentFragmentImpl';
import { DocumentImpl } from './DocumentImpl';
import { DocumentTypeImpl } from './DocumentTypeImpl';
import { DOMException } from './DOMException';
import { DOMImplementationImpl } from './DOMImplementationImpl';
import { DOMTokenListImpl } from './DOMTokenListImpl';
import { ElementImpl } from './ElementImpl';
import { EventImpl } from './EventImpl';
import { EventTargetImpl } from './EventTargetImpl';
import { HTMLCollectionImpl } from './HTMLCollectionImpl';
import { MutationObserverImpl } from './MutationObserverImpl';
import { MutationRecordImpl } from './MutationRecordImpl';
import { NamedNodeMapImpl } from './NamedNodeMapImpl';
import { NodeFilterImpl } from './NodeFilterImpl';
import { NodeImpl } from './NodeImpl';
import { NodeIteratorImpl } from './NodeIteratorImpl';
import { NodeListImpl } from './NodeListImpl';
import { NodeListStaticImpl } from './NodeListStaticImpl';
import { ProcessingInstructionImpl } from './ProcessingInstructionImpl';
import { RangeImpl } from './RangeImpl';
import { ShadowRootImpl } from './ShadowRootImpl';
import { StaticRangeImpl } from './StaticRangeImpl';
import { TextImpl } from './TextImpl';
import { TraverserImpl } from './TraverserImpl';
import { TreeWalkerImpl } from './TreeWalkerImpl';
import { WindowImpl } from './WindowImpl';
import { XMLDocumentImpl } from './XMLDocumentImpl';
export { AbortControllerImpl as AbortController, AbortSignalImpl as AbortSignal, AbstractRangeImpl as AbstractRange, AttrImpl as Attr, CDATASectionImpl as CDATASection, CharacterDataImpl as CharacterData, CommentImpl as Comment, CustomEventImpl as CustomEvent, DocumentFragmentImpl as DocumentFragment, DocumentImpl as Document, DocumentTypeImpl as DocumentType, DOMException as DOMExcep, DOMImplementationImpl as DOMImplementation, DOMTokenListImpl as DOMTokenList, ElementImpl as Element, EventImpl as Event, EventTargetImpl as EventTarget, HTMLCollectionImpl as HTMLCollection, MutationObserverImpl as MutationObserver, MutationRecordImpl as MutationRecord, NamedNodeMapImpl as NamedNodeMap, NodeFilterImpl as NodeFilter, NodeImpl as Node, NodeIteratorImpl as NodeIterator, NodeListImpl as NodeList, NodeListStaticImpl as NodeListStatic, ProcessingInstructionImpl as ProcessingInstruction, RangeImpl as Range, ShadowRootImpl as ShadowRoot, StaticRangeImpl as StaticRange, TextImpl as Text, TraverserImpl as Traverser, TreeWalkerImpl as TreeWalker, WindowImpl as Window, XMLDocumentImpl as XMLDocument };
export { DOMException };
import * as Interfaces from './interfaces';
export { Interfaces };
import { AbortControllerImpl } from "./AbortControllerImpl";
import { AbortSignalImpl } from "./AbortSignalImpl";
import { AbstractRangeImpl } from "./AbstractRangeImpl";
import { AttrImpl } from "./AttrImpl";
import { CDATASectionImpl } from "./CDATASectionImpl";
import { CharacterDataImpl } from "./CharacterDataImpl";
import { CommentImpl } from "./CommentImpl";
import { CustomEventImpl } from "./CustomEventImpl";
import { DocumentFragmentImpl } from "./DocumentFragmentImpl";
import { DocumentImpl } from "./DocumentImpl";
import { DocumentTypeImpl } from "./DocumentTypeImpl";
import { DOMImpl } from "./DOMImpl";
import { DOMImplementationImpl } from "./DOMImplementationImpl";
import { DOMTokenListImpl } from "./DOMTokenListImpl";
import { ElementImpl } from "./ElementImpl";
import { EventImpl } from "./EventImpl";
import { EventTargetImpl } from "./EventTargetImpl";
import { HTMLCollectionImpl } from "./HTMLCollectionImpl";
import { MutationObserverImpl } from "./MutationObserverImpl";
import { MutationRecordImpl } from "./MutationRecordImpl";
import { NamedNodeMapImpl } from "./NamedNodeMapImpl";
import { NodeFilterImpl } from "./NodeFilterImpl";
import { NodeImpl } from "./NodeImpl";
import { NodeIteratorImpl } from "./NodeIteratorImpl";
import { NodeListImpl } from "./NodeListImpl";
import { NodeListStaticImpl } from "./NodeListStaticImpl";
import { ProcessingInstructionImpl } from "./ProcessingInstructionImpl";
import { RangeImpl } from "./RangeImpl";
import { ShadowRootImpl } from "./ShadowRootImpl";
import { StaticRangeImpl } from "./StaticRangeImpl";
import { TextImpl } from "./TextImpl";
import { TraverserImpl } from "./TraverserImpl";
import { TreeWalkerImpl } from "./TreeWalkerImpl";
import { WindowImpl } from "./WindowImpl";
import { XMLDocumentImpl } from "./XMLDocumentImpl";
export { AbortControllerImpl as AbortController, AbortSignalImpl as AbortSignal, AbstractRangeImpl as AbstractRange, AttrImpl as Attr, CDATASectionImpl as CDATASection, CharacterDataImpl as CharacterData, CommentImpl as Comment, CustomEventImpl as CustomEvent, DocumentFragmentImpl as DocumentFragment, DocumentImpl as Document, DocumentTypeImpl as DocumentType, DOMImpl as DOM, DOMImplementationImpl as DOMImplementation, DOMTokenListImpl as DOMTokenList, ElementImpl as Element, EventImpl as Event, EventTargetImpl as EventTarget, HTMLCollectionImpl as HTMLCollection, MutationObserverImpl as MutationObserver, MutationRecordImpl as MutationRecord, NamedNodeMapImpl as NamedNodeMap, NodeFilterImpl as NodeFilter, NodeImpl as Node, NodeIteratorImpl as NodeIterator, NodeListImpl as NodeList, NodeListStaticImpl as NodeListStatic, ProcessingInstructionImpl as ProcessingInstruction, RangeImpl as Range, ShadowRootImpl as ShadowRoot, StaticRangeImpl as StaticRange, TextImpl as Text, TraverserImpl as Traverser, TreeWalkerImpl as TreeWalker, WindowImpl as Window, XMLDocumentImpl as XMLDocument };
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -36,5 +29,4 @@ const util_1 = require("@oozcitak/util");

exports.DocumentType = DocumentTypeImpl_1.DocumentTypeImpl;
const DOMException_1 = require("./DOMException");
exports.DOMExcep = DOMException_1.DOMException;
exports.DOMException = DOMException_1.DOMException;
const DOMImpl_1 = require("./DOMImpl");
exports.DOM = DOMImpl_1.DOMImpl;
const DOMImplementationImpl_1 = require("./DOMImplementationImpl");

@@ -111,5 +103,2 @@ exports.DOMImplementation = DOMImplementationImpl_1.DOMImplementationImpl;

util_1.applyMixin(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl);
// Export interfaces
const Interfaces = __importStar(require("./interfaces"));
exports.Interfaces = Interfaces;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
const util_1 = require("../util");

@@ -24,3 +25,3 @@ const infra_1 = require("@oozcitak/infra");

this._callback = callback;
const window = util_1.globalStore.dom.window;
const window = __1.dom.window;
infra_1.set.append(window._mutationObservers, this);

@@ -73,3 +74,4 @@ }

let isRegistered = false;
for (const registered of target._registeredObserverList) {
const coptions = options;
target._registeredObserverList.forEach(registered => {
if (registered.observer === this) {

@@ -82,11 +84,11 @@ isRegistered = true;

*/
for (const node of this._nodeList) {
this._nodeList.forEach(node => {
infra_1.list.remove((node)._registeredObserverList, (ob) => util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered);
}
});
/**
* 7.2. Set registered’s options to options.
*/
registered.options = options;
registered.options = coptions;
}
}
});
/**

@@ -110,5 +112,5 @@ * 8. Otherwise:

*/
for (const node of this._nodeList) {
this._nodeList.forEach(node => {
infra_1.list.remove((node)._registeredObserverList, (ob) => ob.observer === this);
}
});
/**

@@ -115,0 +117,0 @@ * 2. Empty the context object’s record queue.

@@ -6,3 +6,2 @@ import { Element, Attr, NamedNodeMap } from "./interfaces";

export declare class NamedNodeMapImpl implements NamedNodeMap {
private _algo;
_element: Element;

@@ -9,0 +8,0 @@ _attributeList: Attr[];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const DOMException_1 = require("./DOMException");
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -16,3 +16,2 @@ * Represents a collection of nodes.

this._attributeList = [];
this._algo = util_1.globalStore.dom.algorithm;
this._element = element;

@@ -43,3 +42,3 @@ }

*/
return this._algo.element.getAnAttributeByName(qualifiedName, this._element);
return algorithm_1.element_getAnAttributeByName(qualifiedName, this._element);
}

@@ -53,3 +52,3 @@ /** @inheritdoc */

*/
return this._algo.element.getAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element);
return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element);
}

@@ -62,7 +61,7 @@ /** @inheritdoc */

*/
return this._algo.element.setAnAttribute(attr, this._element);
return algorithm_1.element_setAnAttribute(attr, this._element);
}
/** @inheritdoc */
setNamedItemNS(attr) {
return this._algo.element.setAnAttribute(attr, this._element);
return algorithm_1.element_setAnAttribute(attr, this._element);
}

@@ -77,3 +76,3 @@ /** @inheritdoc */

*/
const attr = this._algo.element.removeAnAttributeByName(qualifiedName, this._element);
const attr = algorithm_1.element_removeAnAttributeByName(qualifiedName, this._element);
if (attr === null)

@@ -91,3 +90,3 @@ throw new DOMException_1.NotFoundError();

*/
const attr = this._algo.element.removeAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element);
const attr = algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element);
if (attr === null)

@@ -94,0 +93,0 @@ throw new DOMException_1.NotFoundError();

@@ -1,3 +0,3 @@

import { Node, NodeList, Element, Document, NodeType, Position, GetRootNodeOptions, RegisteredObserver, TransientRegisteredObserver, Event, EventTarget } from './interfaces';
import { EventTargetImpl } from './EventTargetImpl';
import { Node, NodeList, Element, Document, NodeType, Position, GetRootNodeOptions, RegisteredObserver, TransientRegisteredObserver, Event, EventTarget } from "./interfaces";
import { EventTargetImpl } from "./EventTargetImpl";
/**

@@ -25,10 +25,12 @@ * Represents a generic XML node.

readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
protected _childNodes: NodeList;
private _nodeDocumentOverride;
private __childNodes?;
get _childNodes(): NodeList;
private _nodeDocumentOverride?;
get _nodeDocument(): Document;
set _nodeDocument(val: Document);
_registeredObserverList: Array<RegisteredObserver | TransientRegisteredObserver>;
private __registeredObserverList?;
get _registeredObserverList(): (RegisteredObserver | TransientRegisteredObserver)[];
abstract _nodeType: NodeType;
_parent: Node | null;
_children: Set<Node>;
abstract _children: Set<Node>;
_firstChild: Node | null;

@@ -35,0 +37,0 @@ _lastChild: Node | null;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
const interfaces_1 = require("./interfaces");

@@ -7,3 +8,4 @@ const EventTargetImpl_1 = require("./EventTargetImpl");

const DOMException_1 = require("./DOMException");
const url_1 = require("@oozcitak/url");
const algorithm_1 = require("../algorithm");
const URLAlgorithm_1 = require("@oozcitak/url/lib/URLAlgorithm");
/**

@@ -36,6 +38,3 @@ * Represents a generic XML node.

this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
this._nodeDocumentOverride = undefined;
this._registeredObserverList = [];
this._parent = null;
this._children = new Set();
this._firstChild = null;

@@ -45,6 +44,11 @@ this._lastChild = null;

this._nextSibling = null;
this._childNodes = this._algo.create.nodeList(this);
}
get _nodeDocument() { return this._nodeDocumentOverride || util_1.globalStore.dom.window._associatedDocument; }
get _childNodes() {
return this.__childNodes || (this.__childNodes = algorithm_1.create_nodeList(this));
}
get _nodeDocument() { return this._nodeDocumentOverride || __1.dom.window._associatedDocument; }
set _nodeDocument(val) { this._nodeDocumentOverride = val; }
get _registeredObserverList() {
return this.__registeredObserverList || (this.__registeredObserverList = []);
}
/** @inheritdoc */

@@ -97,3 +101,3 @@ get nodeType() { return this._nodeType; }

*/
return new url_1.URLAlgorithm().urlSerializer(this._nodeDocument._URL);
return URLAlgorithm_1.urlSerializer(this._nodeDocument._URL);
}

@@ -108,3 +112,3 @@ /**

*/
return util_1.Guard.isElementNode(this) && this._algo.shadowTree.isConnected(this);
return util_1.Guard.isElementNode(this) && algorithm_1.shadowTree_isConnected(this);
}

@@ -139,3 +143,3 @@ /**

*/
return this._algo.tree.rootNode(this, !!options && options.composed);
return algorithm_1.tree_rootNode(this, !!options && options.composed);
}

@@ -249,3 +253,2 @@ /**

set nodeValue(value) {
const algo = this._algo;
if (value === null) {

@@ -255,6 +258,6 @@ value = '';

if (util_1.Guard.isAttrNode(this)) {
algo.attr.setAnExistingAttributeValue(this, value);
algorithm_1.attr_setAnExistingAttributeValue(this, value);
}
else if (util_1.Guard.isCharacterDataNode(this)) {
algo.characterData.replaceData(this, 0, this._data.length, value);
algorithm_1.characterData_replaceData(this, 0, this._data.length, value);
}

@@ -268,5 +271,4 @@ }

get textContent() {
const algo = this._algo;
if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) {
return algo.text.descendantTextContent(this);
return algorithm_1.text_descendantTextContent(this);
}

@@ -284,3 +286,2 @@ else if (util_1.Guard.isAttrNode(this)) {

set textContent(value) {
const algo = this._algo;
if (value === null) {

@@ -290,9 +291,9 @@ value = '';

if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) {
algo.node.stringReplaceAll(value, this);
algorithm_1.node_stringReplaceAll(value, this);
}
else if (util_1.Guard.isAttrNode(this)) {
algo.attr.setAnExistingAttributeValue(this, value);
algorithm_1.attr_setAnExistingAttributeValue(this, value);
}
else if (util_1.Guard.isCharacterDataNode(this)) {
algo.characterData.replaceData(this, 0, algo.tree.nodeLength(this), value);
algorithm_1.characterData_replaceData(this, 0, algorithm_1.tree_nodeLength(this), value);
}

@@ -312,10 +313,10 @@ }

*/
const algo = this._algo;
const descendantNodes = [];
for (const node of algo.tree.getDescendantNodes(this)) {
if (util_1.Guard.isExclusiveTextNode(node)) {
descendantNodes.push(node);
}
let node = algorithm_1.tree_getFirstDescendantNode(this, false, false, (e) => util_1.Guard.isExclusiveTextNode(e));
while (node !== null) {
descendantNodes.push(node);
node = algorithm_1.tree_getNextDescendantNode(this, node, false, false, (e) => util_1.Guard.isExclusiveTextNode(e));
}
for (const node of descendantNodes) {
for (let i = 0; i < descendantNodes.length; i++) {
const node = descendantNodes[i];
if (node._parent === null)

@@ -328,5 +329,5 @@ continue;

*/
let length = algo.tree.nodeLength(node);
let length = algorithm_1.tree_nodeLength(node);
if (length === 0) {
algo.mutation.remove(node, node._parent);
algorithm_1.mutation_remove(node, node._parent);
continue;

@@ -340,3 +341,3 @@ }

let data = '';
for (const sibling of algo.text.contiguousExclusiveTextNodes(node)) {
for (const sibling of algorithm_1.text_contiguousExclusiveTextNodes(node)) {
textSiblings.push(sibling);

@@ -348,3 +349,3 @@ data += sibling._data;

*/
algo.characterData.replaceData(node, length, 0, data);
algorithm_1.characterData_replaceData(node, length, 0, data);
/**

@@ -354,3 +355,3 @@ * 5. Let currentNode be node’s next sibling.

*/
if (this._algo.range.rangeList.length !== 0) {
if (__1.dom.rangeList.length !== 0) {
let currentNode = node._nextSibling;

@@ -370,21 +371,22 @@ while (currentNode !== null && util_1.Guard.isExclusiveTextNode(currentNode)) {

*/
const index = algo.tree.index(currentNode);
for (const range of algo.range.rangeList) {
if (range._start[0] === currentNode) {
const cn = currentNode;
const index = algorithm_1.tree_index(cn);
__1.dom.rangeList.forEach(range => {
if (range._start[0] === cn) {
range._start[0] = node;
range._start[1] += length;
}
if (range._end[0] === currentNode) {
if (range._end[0] === cn) {
range._end[0] = node;
range._end[1] += length;
}
if (range._start[0] === currentNode._parent && range._start[1] === index) {
if (range._start[0] === cn._parent && range._start[1] === index) {
range._start[0] = node;
range._start[1] = length;
}
if (range._end[0] === currentNode._parent && range._end[1] === index) {
if (range._end[0] === cn._parent && range._end[1] === index) {
range._end[0] = node;
range._end[1] = length;
}
}
});
/**

@@ -394,3 +396,3 @@ * 6.5. Add currentNode’s length to length.

*/
length += algo.tree.nodeLength(currentNode);
length += algorithm_1.tree_nodeLength(currentNode);
currentNode = currentNode._nextSibling;

@@ -403,6 +405,7 @@ }

*/
for (const sibling of textSiblings) {
for (let i = 0; i < textSiblings.length; i++) {
const sibling = textSiblings[i];
if (sibling._parent === null)
continue;
algo.mutation.remove(sibling, sibling._parent);
algorithm_1.mutation_remove(sibling, sibling._parent);
}

@@ -429,3 +432,3 @@ }

throw new DOMException_1.NotSupportedError();
return this._algo.node.clone(this, null, deep);
return algorithm_1.node_clone(this, null, deep);
}

@@ -443,3 +446,3 @@ /**

*/
return (node !== null && this._algo.node.equals(this, node));
return (node !== null && algorithm_1.node_equals(this, node));
}

@@ -463,3 +466,2 @@ /**

compareDocumentPosition(other) {
const algo = this._algo;
/**

@@ -501,3 +503,4 @@ * 1. If context object is other, then return zero.

*/
for (const attr of node2._attributeList) {
for (let i = 0; i < node2._attributeList._attributeList.length; i++) {
const attr = node2._attributeList._attributeList[i];
/**

@@ -511,6 +514,6 @@ * 5.2.1. If attr equals attr1, then return the result of adding

*/
if (algo.node.equals(attr, attr1)) {
if (algorithm_1.node_equals(attr, attr1)) {
return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Preceding;
}
else if (algo.node.equals(attr, attr2)) {
else if (algorithm_1.node_equals(attr, attr2)) {
return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Following;

@@ -529,7 +532,7 @@ }

if (node1 === null || node2 === null ||
algo.tree.rootNode(node1) !== algo.tree.rootNode(node2)) {
algorithm_1.tree_rootNode(node1) !== algorithm_1.tree_rootNode(node2)) {
// nodes are disconnected
// return a random result but cache the value for consistency
return interfaces_1.Position.Disconnected | interfaces_1.Position.ImplementationSpecific |
(util_1.globalStore.dom.compareCache.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following);
(__1.dom.compareCache.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following);
}

@@ -541,3 +544,3 @@ /**

*/
if ((!attr1 && algo.tree.isAncestorOf(node2, node1)) ||
if ((!attr1 && algorithm_1.tree_isAncestorOf(node2, node1)) ||
(attr2 && (node1 === node2))) {

@@ -551,3 +554,3 @@ return interfaces_1.Position.Contains | interfaces_1.Position.Preceding;

*/
if ((!attr2 && algo.tree.isDescendantOf(node2, node1)) ||
if ((!attr2 && algorithm_1.tree_isDescendantOf(node2, node1)) ||
(attr1 && (node1 === node2))) {

@@ -559,3 +562,3 @@ return interfaces_1.Position.ContainedBy | interfaces_1.Position.Following;

*/
if (algo.tree.isPreceding(node2, node1))
if (algorithm_1.tree_isPreceding(node2, node1))
return interfaces_1.Position.Preceding;

@@ -581,3 +584,3 @@ /**

return false;
return this._algo.tree.isDescendantOf(this, other, true);
return algorithm_1.tree_isDescendantOf(this, other, true);
}

@@ -602,3 +605,3 @@ /**

*/
return this._algo.node.locateANamespacePrefix(this, namespace);
return algorithm_1.node_locateANamespacePrefix(this, namespace);
}

@@ -614,3 +617,3 @@ else if (util_1.Guard.isDocumentNode(this)) {

else {
return this._algo.node.locateANamespacePrefix(this.documentElement, namespace);
return algorithm_1.node_locateANamespacePrefix(this.documentElement, namespace);
}

@@ -630,3 +633,3 @@ }

else {
return this._algo.node.locateANamespacePrefix(this._element, namespace);
return algorithm_1.node_locateANamespacePrefix(this._element, namespace);
}

@@ -643,3 +646,3 @@ }

else {
return this._algo.node.locateANamespacePrefix(this.parentElement, namespace);
return algorithm_1.node_locateANamespacePrefix(this.parentElement, namespace);
}

@@ -660,3 +663,3 @@ }

*/
return this._algo.node.locateANamespace(this, prefix || null);
return algorithm_1.node_locateANamespace(this, prefix || null);
}

@@ -678,3 +681,3 @@ /**

namespace = null;
const defaultNamespace = this._algo.node.locateANamespace(this, null);
const defaultNamespace = algorithm_1.node_locateANamespace(this, null);
return (defaultNamespace === namespace);

@@ -703,3 +706,3 @@ }

*/
return this._algo.mutation.preInsert(newChild, this, refChild);
return algorithm_1.mutation_preInsert(newChild, this, refChild);
}

@@ -724,3 +727,3 @@ /**

*/
return this._algo.mutation.append(newChild, this);
return algorithm_1.mutation_append(newChild, this);
}

@@ -742,3 +745,3 @@ /**

*/
return this._algo.mutation.replace(oldChild, newChild, this);
return algorithm_1.mutation_replace(oldChild, newChild, this);
}

@@ -758,3 +761,3 @@ /**

*/
return this._algo.mutation.preRemove(oldChild, this);
return algorithm_1.mutation_preRemove(oldChild, this);
}

@@ -771,3 +774,3 @@ /**

*/
if (util_1.Guard.isSlotable(this) && this._algo.shadowTree.isAssigned(this)) {
if (util_1.Guard.isSlotable(this) && algorithm_1.shadowTree_isAssigned(this)) {
return this._assignedSlot;

@@ -774,0 +777,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const TraverserImpl_1 = require("./TraverserImpl");
const algorithm_1 = require("../algorithm");
/**

@@ -17,3 +18,3 @@ * Represents an object which can be used to iterate through the nodes

this._pointerBeforeReference = pointerBeforeReference;
this._algo.nodeIterator.iteratorList.add(this);
algorithm_1.nodeIterator_iteratorList().add(this);
}

@@ -30,3 +31,3 @@ /** @inheritdoc */

*/
return this._algo.nodeIterator.traverse(this, true);
return algorithm_1.nodeIterator_traverse(this, true);
}

@@ -39,3 +40,3 @@ /** @inheritdoc */

*/
return this._algo.nodeIterator.traverse(this, false);
return algorithm_1.nodeIterator_traverse(this, false);
}

@@ -49,3 +50,3 @@ /** @inheritdoc */

*/
this._algo.nodeIterator.iteratorList.remove(this);
algorithm_1.nodeIterator_iteratorList().remove(this);
}

@@ -52,0 +53,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const __1 = require("../");
/**

@@ -118,7 +118,6 @@ * Represents an ordered list of nodes.

if (thisArg === undefined) {
thisArg = util_1.globalStore.dom.window;
thisArg = __1.dom.window;
}
for (const [index, node] of this.entries()) {
callback.call(thisArg, node, index, this);
}
let index = 0;
this._root._children.forEach(node => callback.call(thisArg, node, index++, this));
}

@@ -125,0 +124,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const __1 = require("../");
/**

@@ -104,7 +104,6 @@ * Represents an ordered list of nodes.

if (thisArg === undefined) {
thisArg = util_1.globalStore.dom.window;
thisArg = __1.dom.window;
}
for (const [index, node] of this.entries()) {
callback.call(thisArg, node, index, this);
}
let index = 0;
this._items.forEach(node => callback.call(thisArg, node, index++, this));
}

@@ -111,0 +110,0 @@ /**

@@ -1,2 +0,2 @@

import { Element, NonDocumentTypeChildNode } from './interfaces';
import { Element, NonDocumentTypeChildNode } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents a mixin that extends child nodes that can have siblings

@@ -1,2 +0,2 @@

import { Element, NonElementParentNode } from './interfaces';
import { Element, NonElementParentNode } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents a mixin that extends non-element parent nodes. This mixin

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -16,7 +17,8 @@ * Represents a mixin that extends non-element parent nodes. This mixin

*/
const algo = util_1.globalStore.dom.algorithm;
for (const ele of algo.tree.getDescendantElements(util_1.Cast.asNode(this))) {
let ele = algorithm_1.tree_getFirstDescendantNode(util_1.Cast.asNode(this), false, false, (e) => util_1.Guard.isElementNode(e));
while (ele !== null) {
if (ele._uniqueIdentifier === id) {
return ele;
}
ele = algorithm_1.tree_getNextDescendantNode(util_1.Cast.asNode(this), ele, false, false, (e) => util_1.Guard.isElementNode(e));
}

@@ -23,0 +25,0 @@ return null;

@@ -1,2 +0,2 @@

import { Node, HTMLCollection, NodeList, Element, ParentNode } from './interfaces';
import { Node, HTMLCollection, NodeList, Element, ParentNode } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents a mixin that extends parent nodes that can have children.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -16,4 +17,3 @@ * Represents a mixin that extends parent nodes that can have children.

*/
const algo = util_1.globalStore.dom.algorithm;
return algo.create.htmlCollection(util_1.Cast.asNode(this));
return algorithm_1.create_htmlCollection(util_1.Cast.asNode(this));
}

@@ -56,8 +56,7 @@ /** @inheritdoc */

*/
const node = util_1.Cast.asNode(this);
let count = 0;
for (const childNode of node._children) {
util_1.Cast.asNode(this)._children.forEach(childNode => {
if (util_1.Guard.isElementNode(childNode))
count++;
}
});
return count;

@@ -73,6 +72,5 @@ }

*/
const algo = util_1.globalStore.dom.algorithm;
const node = util_1.Cast.asNode(this);
const childNode = algo.parentNode.convertNodesIntoANode(nodes, node._nodeDocument);
algo.mutation.preInsert(childNode, node, node._firstChild);
const childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument);
algorithm_1.mutation_preInsert(childNode, node, node._firstChild);
}

@@ -86,6 +84,5 @@ /** @inheritdoc */

*/
const algo = util_1.globalStore.dom.algorithm;
const node = util_1.Cast.asNode(this);
const childNode = algo.parentNode.convertNodesIntoANode(nodes, node._nodeDocument);
algo.mutation.append(childNode, node);
const childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument);
algorithm_1.mutation_append(childNode, node);
}

@@ -99,5 +96,4 @@ /** @inheritdoc */

*/
const algo = util_1.globalStore.dom.algorithm;
const node = util_1.Cast.asNode(this);
const result = algo.selectors.scopeMatchASelectorsString(selectors, node);
const result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node);
return (result.length === 0 ? null : result[0]);

@@ -112,6 +108,5 @@ }

*/
const algo = util_1.globalStore.dom.algorithm;
const node = util_1.Cast.asNode(this);
const result = algo.selectors.scopeMatchASelectorsString(selectors, node);
return algo.create.nodeListStatic(node, result);
const result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node);
return algorithm_1.create_nodeListStatic(node, result);
}

@@ -118,0 +113,0 @@ }

@@ -1,2 +0,2 @@

import { NodeType, ProcessingInstruction, Document } from "./interfaces";
import { NodeType, ProcessingInstruction, Document, Node } from "./interfaces";
import { CharacterDataImpl } from "./CharacterDataImpl";

@@ -8,2 +8,3 @@ /**

_nodeType: NodeType;
_children: Set<Node>;
_target: string;

@@ -10,0 +11,0 @@ /**

@@ -5,2 +5,3 @@ "use strict";

const CharacterDataImpl_1 = require("./CharacterDataImpl");
const util_1 = require("../util");
/**

@@ -16,3 +17,3 @@ * Represents a processing instruction node.

this._nodeType = interfaces_1.NodeType.ProcessingInstruction;
this._target = '';
this._children = new util_1.EmptySet();
this._target = target;

@@ -19,0 +20,0 @@ }

@@ -1,4 +0,3 @@

import { Node, Range, HowToCompare, DocumentFragment, BoundaryPoint } from './interfaces';
import { AbstractRangeImpl } from './AbstractRangeImpl';
import { DOMAlgorithm } from '../algorithm/interfaces';
import { Node, Range, HowToCompare, DocumentFragment, BoundaryPoint } from "./interfaces";
import { AbstractRangeImpl } from "./AbstractRangeImpl";
/**

@@ -8,3 +7,2 @@ * Represents a live range.

export declare class RangeImpl extends AbstractRangeImpl implements Range {
protected _algo: DOMAlgorithm;
_start: BoundaryPoint;

@@ -11,0 +9,0 @@ _end: BoundaryPoint;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
const interfaces_1 = require("./interfaces");
const AbstractRangeImpl_1 = require("./AbstractRangeImpl");
const DOMException_1 = require("./DOMException");
const algorithm_1 = require("../algorithm");
const util_1 = require("../util");

@@ -24,7 +26,6 @@ /**

*/
this._algo = util_1.globalStore.dom.algorithm;
const doc = util_1.globalStore.dom.window._associatedDocument;
const doc = __1.dom.window._associatedDocument;
this._start = [doc, 0];
this._end = [doc, 0];
this._algo.range.rangeList.add(this);
__1.dom.rangeList.add(this);
}

@@ -40,3 +41,3 @@ /** @inheritdoc */

let container = this._start[0];
while (!this._algo.tree.isAncestorOf(this._end[0], container, true)) {
while (!algorithm_1.tree_isAncestorOf(this._end[0], container, true)) {
if (container._parent === null) {

@@ -55,3 +56,3 @@ throw new Error("Parent node is null.");

*/
this._algo.range.setTheStart(this, node, offset);
algorithm_1.range_setTheStart(this, node, offset);
}

@@ -64,3 +65,3 @@ /** @inheritdoc */

*/
this._algo.range.setTheEnd(this, node, offset);
algorithm_1.range_setTheEnd(this, node, offset);
}

@@ -78,3 +79,3 @@ /** @inheritdoc */

throw new DOMException_1.InvalidNodeTypeError();
this._algo.range.setTheStart(this, parent, this._algo.tree.index(node));
algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node));
}

@@ -92,3 +93,3 @@ /** @inheritdoc */

throw new DOMException_1.InvalidNodeTypeError();
this._algo.range.setTheStart(this, parent, this._algo.tree.index(node) + 1);
algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node) + 1);
}

@@ -106,3 +107,3 @@ /** @inheritdoc */

throw new DOMException_1.InvalidNodeTypeError();
this._algo.range.setTheEnd(this, parent, this._algo.tree.index(node));
algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node));
}

@@ -120,3 +121,3 @@ /** @inheritdoc */

throw new DOMException_1.InvalidNodeTypeError();
this._algo.range.setTheEnd(this, parent, this._algo.tree.index(node) + 1);
algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node) + 1);
}

@@ -142,3 +143,3 @@ /** @inheritdoc */

*/
this._algo.range.select(node, this);
algorithm_1.range_select(node, this);
}

@@ -155,3 +156,3 @@ /** @inheritdoc */

throw new DOMException_1.InvalidNodeTypeError();
const length = this._algo.tree.nodeLength(node);
const length = algorithm_1.tree_nodeLength(node);
this._start = [node, 0];

@@ -177,3 +178,3 @@ this._end = [node, length];

*/
if (this._algo.range.root(this) !== this._algo.range.root(sourceRange))
if (algorithm_1.range_root(this) !== algorithm_1.range_root(sourceRange))
throw new DOMException_1.WrongDocumentError();

@@ -227,3 +228,3 @@ /**

*/
const position = this._algo.boundaryPoint.position(thisPoint, otherPoint);
const position = algorithm_1.boundaryPoint_position(thisPoint, otherPoint);
if (position === interfaces_1.BoundaryPosition.Before) {

@@ -247,3 +248,3 @@ return -1;

*/
if (this._algo.range.collapsed(this))
if (algorithm_1.range_collapsed(this))
return;

@@ -263,3 +264,3 @@ const originalStartNode = this._startNode;

util_1.Guard.isCharacterDataNode(originalStartNode)) {
this._algo.characterData.replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, '');
algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, '');
return;

@@ -273,5 +274,5 @@ }

const nodesToRemove = [];
for (const node of this._algo.range.getContainedNodes(this)) {
for (const node of algorithm_1.range_getContainedNodes(this)) {
const parent = node._parent;
if (parent !== null && this._algo.range.isContained(parent, this)) {
if (parent !== null && algorithm_1.range_isContained(parent, this)) {
continue;

@@ -283,3 +284,3 @@ }

let newOffset;
if (this._algo.tree.isAncestorOf(originalEndNode, originalStartNode, true)) {
if (algorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) {
/**

@@ -304,3 +305,3 @@ * 5. If original start node is an inclusive ancestor of original end

while (referenceNode._parent !== null &&
!this._algo.tree.isAncestorOf(originalEndNode, referenceNode._parent, true)) {
!algorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent, true)) {
referenceNode = referenceNode._parent;

@@ -313,3 +314,3 @@ }

newNode = referenceNode._parent;
newOffset = this._algo.tree.index(referenceNode) + 1;
newOffset = algorithm_1.tree_index(referenceNode) + 1;
}

@@ -323,3 +324,3 @@ /**

if (util_1.Guard.isCharacterDataNode(originalStartNode)) {
this._algo.characterData.replaceData(originalStartNode, originalStartOffset, this._algo.tree.nodeLength(originalStartNode) - originalStartOffset, '');
algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, algorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, '');
}

@@ -330,8 +331,8 @@ /**

*/
for (const node of nodesToRemove) {
nodesToRemove.forEach(node => {
/* istanbul ignore else */
if (node._parent) {
this._algo.mutation.remove(node, node._parent);
algorithm_1.mutation_remove(node, node._parent);
}
}
});
/**

@@ -343,3 +344,3 @@ * 9. If original end node is a Text, ProcessingInstruction, or Comment

if (util_1.Guard.isCharacterDataNode(originalEndNode)) {
this._algo.characterData.replaceData(originalEndNode, 0, originalEndOffset, '');
algorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, '');
}

@@ -358,3 +359,3 @@ /**

*/
return this._algo.range.extract(this);
return algorithm_1.range_extract(this);
}

@@ -367,3 +368,3 @@ /** @inheritdoc */

*/
return this._algo.range.cloneTheContents(this);
return algorithm_1.range_cloneTheContents(this);
}

@@ -376,3 +377,3 @@ /** @inheritdoc */

*/
return this._algo.range.insert(node, this);
return algorithm_1.range_insert(node, this);
}

@@ -385,3 +386,3 @@ /** @inheritdoc */

*/
for (const node of this._algo.range.getPartiallyContainedNodes(this)) {
for (const node of algorithm_1.range_getPartiallyContainedNodes(this)) {
if (!util_1.Guard.isTextNode(node)) {

@@ -403,3 +404,3 @@ throw new DOMException_1.InvalidStateError();

*/
const fragment = this._algo.range.extract(this);
const fragment = algorithm_1.range_extract(this);
/**

@@ -409,3 +410,3 @@ * 4. If newParent has children, then replace all with null within newParent.

if ((newParent)._children.size !== 0) {
this._algo.mutation.replaceAll(null, newParent);
algorithm_1.mutation_replaceAll(null, newParent);
}

@@ -416,8 +417,8 @@ /**

*/
this._algo.range.insert(newParent, this);
this._algo.mutation.append(fragment, newParent);
algorithm_1.range_insert(newParent, this);
algorithm_1.mutation_append(fragment, newParent);
/**
* 7. Select newParent within the context object.
*/
this._algo.range.select(newParent, this);
algorithm_1.range_select(newParent, this);
}

@@ -430,3 +431,3 @@ /** @inheritdoc */

*/
return this._algo.create.range(this._start, this._end);
return algorithm_1.create_range(this._start, this._end);
}

@@ -440,3 +441,3 @@ /** @inheritdoc */

*/
this._algo.range.rangeList.remove(this);
__1.dom.rangeList.remove(this);
}

@@ -448,3 +449,3 @@ /** @inheritdoc */

*/
if (this._algo.tree.rootNode(node) !== this._algo.range.root(this)) {
if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) {
return false;

@@ -459,3 +460,3 @@ }

throw new DOMException_1.InvalidNodeTypeError();
if (offset > this._algo.tree.nodeLength(node))
if (offset > algorithm_1.tree_nodeLength(node))
throw new DOMException_1.IndexSizeError();

@@ -466,4 +467,4 @@ /**

const bp = [node, offset];
if (this._algo.boundaryPoint.position(bp, this._start) === interfaces_1.BoundaryPosition.Before ||
this._algo.boundaryPoint.position(bp, this._end) === interfaces_1.BoundaryPosition.After) {
if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before ||
algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) {
return false;

@@ -485,7 +486,7 @@ }

*/
if (this._algo.tree.rootNode(node) !== this._algo.range.root(this))
if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this))
throw new DOMException_1.WrongDocumentError();
if (util_1.Guard.isDocumentTypeNode(node))
throw new DOMException_1.InvalidNodeTypeError();
if (offset > this._algo.tree.nodeLength(node))
if (offset > algorithm_1.tree_nodeLength(node))
throw new DOMException_1.IndexSizeError();

@@ -498,6 +499,6 @@ /**

const bp = [node, offset];
if (this._algo.boundaryPoint.position(bp, this._start) === interfaces_1.BoundaryPosition.Before) {
if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before) {
return -1;
}
else if (this._algo.boundaryPoint.position(bp, this._end) === interfaces_1.BoundaryPosition.After) {
else if (algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) {
return 1;

@@ -514,3 +515,3 @@ }

*/
if (this._algo.tree.rootNode(node) !== this._algo.range.root(this)) {
if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) {
return false;

@@ -528,3 +529,3 @@ }

*/
const offset = this._algo.tree.index(node);
const offset = algorithm_1.tree_index(node);
/**

@@ -534,4 +535,4 @@ * 5. If (parent, offset) is before end and (parent, offset plus 1) is

*/
if (this._algo.boundaryPoint.position([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before &&
this._algo.boundaryPoint.position([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) {
if (algorithm_1.boundaryPoint_position([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before &&
algorithm_1.boundaryPoint_position([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) {
return true;

@@ -570,3 +571,3 @@ }

*/
for (const child of this._algo.range.getContainedNodes(this)) {
for (const child of algorithm_1.range_getContainedNodes(this)) {
if (util_1.Guard.isTextNode(child)) {

@@ -573,0 +574,0 @@ s += child._data;

@@ -5,2 +5,3 @@ "use strict";

const util_1 = require("@oozcitak/util");
const algorithm_1 = require("../algorithm");
/**

@@ -38,3 +39,3 @@ * Represents a shadow root.

if (!event._composedFlag && !util_1.isEmpty(event._path) &&
this._algo.tree.rootNode(event._path[0].invocationTarget) === this) {
algorithm_1.tree_rootNode(event._path[0].invocationTarget) === this) {
return null;

@@ -41,0 +42,0 @@ }

@@ -1,2 +0,2 @@

import { Slotable, Slot, HTMLSlotElement } from './interfaces';
import { Slotable, Slot, HTMLSlotElement } from "./interfaces";
/**

@@ -3,0 +3,0 @@ * Represents a mixin that allows nodes to become the contents of

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -16,4 +16,3 @@ * Represents a mixin that allows nodes to become the contents of

get assignedSlot() {
const algo = util_1.globalStore.dom.algorithm;
return algo.shadowTree.findASlot(this, true);
return algorithm_1.shadowTree_findASlot(this, true);
}

@@ -20,0 +19,0 @@ }

@@ -1,3 +0,3 @@

import { AbstractRangeImpl } from './AbstractRangeImpl';
import { BoundaryPoint, StaticRangeInit, StaticRange } from './interfaces';
import { AbstractRangeImpl } from "./AbstractRangeImpl";
import { BoundaryPoint, StaticRangeInit, StaticRange } from "./interfaces";
/**

@@ -4,0 +4,0 @@ * Represents a static range.

@@ -1,2 +0,2 @@

import { NodeType, Text, HTMLSlotElement, Document, Slot } from "./interfaces";
import { NodeType, Text, HTMLSlotElement, Document, Slot, Node } from "./interfaces";
import { CharacterDataImpl } from "./CharacterDataImpl";

@@ -8,2 +8,3 @@ /**

_nodeType: NodeType;
_children: Set<Node>;
_name: string;

@@ -10,0 +11,0 @@ _assignedSlot: Slot | null;

@@ -5,2 +5,4 @@ "use strict";

const CharacterDataImpl_1 = require("./CharacterDataImpl");
const algorithm_1 = require("../algorithm");
const util_1 = require("../util");
/**

@@ -18,2 +20,3 @@ * Represents a text node.

this._nodeType = interfaces_1.NodeType.Text;
this._children = new util_1.EmptySet();
this._name = '';

@@ -29,3 +32,3 @@ this._assignedSlot = null;

let text = '';
for (const node of this._algo.text.contiguousTextNodes(this, true)) {
for (const node of algorithm_1.text_contiguousTextNodes(this, true)) {
text = text + node.data;

@@ -41,3 +44,3 @@ }

*/
return this._algo.text.split(this, offset);
return algorithm_1.text_split(this, offset);
}

@@ -44,0 +47,0 @@ // MIXIN: Slotable

import { Node, NodeFilter, WhatToShow, Traverser } from "./interfaces";
import { DOMAlgorithm } from "../algorithm/interfaces";
/**

@@ -8,3 +7,2 @@ * Represents an object which can be used to iterate through the nodes

export declare abstract class TraverserImpl implements Traverser {
protected _algo: DOMAlgorithm;
_activeFlag: boolean;

@@ -11,0 +9,0 @@ _root: Node;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const interfaces_1 = require("./interfaces");
const util_1 = require("../util");
/**

@@ -16,3 +15,2 @@ * Represents an object which can be used to iterate through the nodes

constructor(root) {
this._algo = util_1.globalStore.dom.algorithm;
this._activeFlag = false;

@@ -19,0 +17,0 @@ this._root = root;

@@ -5,2 +5,3 @@ "use strict";

const TraverserImpl_1 = require("./TraverserImpl");
const algorithm_1 = require("../algorithm");
/**

@@ -36,3 +37,3 @@ * Represents the nodes of a subtree and a position within them.

if (node !== null &&
this._algo.traversal.filter(this, node) === interfaces_1.FilterResult.Accept) {
algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) {
this._current = node;

@@ -53,3 +54,3 @@ return node;

*/
return this._algo.treeWalker.traverseChildren(this, true);
return algorithm_1.treeWalker_traverseChildren(this, true);
}

@@ -62,3 +63,3 @@ /** @inheritdoc */

*/
return this._algo.treeWalker.traverseChildren(this, false);
return algorithm_1.treeWalker_traverseChildren(this, false);
}

@@ -71,3 +72,3 @@ /** @inheritdoc */

*/
return this._algo.treeWalker.traverseSiblings(this, true);
return algorithm_1.treeWalker_traverseSiblings(this, true);
}

@@ -94,3 +95,3 @@ /** @inheritdoc */

node = sibling;
let result = this._algo.traversal.filter(this, node);
let result = algorithm_1.traversal_filter(this, node);
/**

@@ -106,3 +107,3 @@ * 2.2.3. While result is not FILTER_REJECT and node has a child:

node = node._lastChild;
result = this._algo.traversal.filter(this, node);
result = algorithm_1.traversal_filter(this, node);
}

@@ -138,3 +139,3 @@ /**

*/
if (this._algo.traversal.filter(this, node) === interfaces_1.FilterResult.Accept) {
if (algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) {
this._current = node;

@@ -155,3 +156,3 @@ return node;

*/
return this._algo.treeWalker.traverseSiblings(this, false);
return algorithm_1.treeWalker_traverseSiblings(this, false);
}

@@ -180,3 +181,3 @@ /** @inheritdoc */

node = node._firstChild;
result = this._algo.traversal.filter(this, node);
result = algorithm_1.traversal_filter(this, node);
if (result === interfaces_1.FilterResult.Accept) {

@@ -220,3 +221,3 @@ this._current = node;

*/
result = this._algo.traversal.filter(this, node);
result = algorithm_1.traversal_filter(this, node);
if (result === interfaces_1.FilterResult.Accept) {

@@ -223,0 +224,0 @@ this._current = node;

@@ -1,4 +0,4 @@

import { Event, Slot, MutationObserver, Document, Window, Range, NodeIterator } from './interfaces';
import { EventTargetImpl } from './EventTargetImpl';
import { ObjectCache } from '@oozcitak/util';
import { Event, Slot, MutationObserver, Document, Window, NodeIterator } from "./interfaces";
import { EventTargetImpl } from "./EventTargetImpl";
import { ObjectCache } from "@oozcitak/util";
/**

@@ -13,3 +13,2 @@ * Represents a window containing a DOM document.

_associatedDocument: Document;
_rangeList: ObjectCache<Range>;
_iteratorList: ObjectCache<NodeIterator>;

@@ -16,0 +15,0 @@ /**

@@ -5,2 +5,3 @@ "use strict";

const util_1 = require("@oozcitak/util");
const algorithm_1 = require("../algorithm");
/**

@@ -18,5 +19,4 @@ * Represents a window containing a DOM document.

this._mutationObservers = new Set();
this._rangeList = new util_1.ObjectCache();
this._iteratorList = new util_1.ObjectCache();
this._associatedDocument = this._algo.create.document();
this._associatedDocument = algorithm_1.create_document();
}

@@ -23,0 +23,0 @@ /** @inheritdoc */

@@ -1,3 +0,3 @@

import { DocumentImpl } from './DocumentImpl';
import { XMLDocument } from './interfaces';
import { DocumentImpl } from "./DocumentImpl";
import { XMLDocument } from "./interfaces";
/**

@@ -4,0 +4,0 @@ * Represents an XML document.

@@ -1,32 +0,6 @@

import { CompareCache } from "@oozcitak/util";
import { Node, DOM, Window, DOMImplementation, DOMFeatures } from "./dom/interfaces";
import { DOMAlgorithm } from "./algorithm/interfaces";
/**
* Represents an object implementing DOM algorithms.
*/
declare class DOMImpl implements DOM {
private _features;
private _algorithm;
private _window;
private _compareCache;
/**
* Initializes a new instance of `DOM`.
*
* @param features - DOM features supported by algorithms. All features are
* enabled by default unless explicity disabled.
*/
constructor(features?: Partial<DOMFeatures> | boolean);
/** @inheritdoc */
get features(): DOMFeatures;
/** @inheritdoc */
get algorithm(): DOMAlgorithm;
/** @inheritdoc */
get window(): Window;
/** @inheritdoc */
get implementation(): DOMImplementation;
/** @inheritdoc */
get compareCache(): CompareCache<Node>;
}
export { DOMImpl as DOM };
import { DOM } from "./dom";
declare const domInstance: DOM;
export { domInstance as dom };
export { DOMImplementation } from "./dom";
export { DOMParser } from "./parser";
export { XMLSerializer } from "./serializer";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("@oozcitak/util");
const DOMAlgorithmImpl_1 = require("./algorithm/DOMAlgorithmImpl");
const util_2 = require("./util");
/**
* Represents an object implementing DOM algorithms.
*/
class DOMImpl {
/**
* Initializes a new instance of `DOM`.
*
* @param features - DOM features supported by algorithms. All features are
* enabled by default unless explicity disabled.
*/
constructor(features) {
this._features = {
mutationObservers: true,
customElements: true,
slots: true
};
this._window = null;
if (features === undefined)
features = true;
if (util_1.isObject(features)) {
for (const key in features) {
this._features[key] = features[key];
}
}
else {
// enable/disable all features
for (const key in this._features) {
this._features[key] = features;
}
}
this._algorithm = new DOMAlgorithmImpl_1.DOMAlgorithmImpl();
this._compareCache = new util_1.CompareCache();
util_2.globalStore.dom = this;
}
/** @inheritdoc */
get features() { return this._features; }
/** @inheritdoc */
get algorithm() { return this._algorithm; }
/** @inheritdoc */
get window() {
if (this._window === null) {
this._window = this._algorithm.create.window();
}
return this._window;
}
/** @inheritdoc */
get implementation() { return this.window.document.implementation; }
/** @inheritdoc */
get compareCache() { return this._compareCache; }
}
exports.DOM = DOMImpl;
const dom_1 = require("./dom");
const domInstance = dom_1.DOM.instance;
exports.dom = domInstance;
var dom_2 = require("./dom");
exports.DOMImplementation = dom_2.DOMImplementation;
var parser_1 = require("./parser");

@@ -58,0 +9,0 @@ exports.DOMParser = parser_1.DOMParser;

@@ -6,3 +6,2 @@ import { Document } from "../dom/interfaces";

export declare class DOMParser {
private algo;
/**

@@ -9,0 +8,0 @@ * Initializes a new instance of `DOMParser`.

@@ -5,5 +5,4 @@ "use strict";

const interfaces_1 = require("./interfaces");
const util_1 = require("../util");
const util_2 = require("@oozcitak/util");
const infra_1 = require("@oozcitak/infra");
const algorithm_1 = require("../algorithm");
/**

@@ -16,5 +15,3 @@ * Represents a parser for XML and HTML content.

*/
constructor() {
this.algo = util_1.globalStore.dom.algorithm;
}
constructor() { }
/**

@@ -33,6 +30,7 @@ * Parses the given string and returns a document object.

lexer.skipWhitespaceOnlyText = true;
const doc = this.algo.create.document();
const doc = algorithm_1.create_document();
doc._contentType = mimeType;
let context = doc;
for (const token of lexer) {
let token = lexer.nextToken();
while (token.type !== interfaces_1.TokenType.EOF) {
switch (token.type) {

@@ -65,7 +63,8 @@ case interfaces_1.TokenType.Declaration:

// inherit namespace from parent
const [prefix, localName] = this.algo.namespace.extractQName(element.name);
const [prefix, localName] = algorithm_1.namespace_extractQName(element.name);
let namespace = context.lookupNamespaceURI(prefix);
// override namespace if there is a namespace declaration
// attribute
for (let [attName, attValue] of util_2.forEachObject(element.attributes)) {
for (const attName in element.attributes) {
const attValue = element.attributes[attName];
if (attName === "xmlns") {

@@ -75,3 +74,3 @@ namespace = attValue;

else {
const [attPrefix, attLocalName] = this.algo.namespace.extractQName(attName);
const [attPrefix, attLocalName] = algorithm_1.namespace_extractQName(attName);
if (attPrefix === "xmlns" && attLocalName === prefix) {

@@ -88,3 +87,4 @@ namespace = attValue;

// assign attributes
for (let [attName, attValue] of util_2.forEachObject(element.attributes)) {
for (const attName in element.attributes) {
const attValue = element.attributes[attName];
// skip the default namespace declaration attribute

@@ -94,3 +94,3 @@ if (attName === "xmlns") {

}
const [attPrefix, attLocalName] = this.algo.namespace.extractQName(attName);
const [attPrefix, attLocalName] = algorithm_1.namespace_extractQName(attName);
if (attPrefix === "xmlns") {

@@ -124,2 +124,3 @@ // prefixed namespace declaration attribute

}
token = lexer.nextToken();
}

@@ -126,0 +127,0 @@ return doc;

@@ -1,1 +0,1 @@

export { DOMParser } from './DOMParser';
export { DOMParser } from "./DOMParser";

@@ -1,2 +0,2 @@

import { XMLToken, XMLLexer } from './interfaces';
import { XMLToken, XMLLexer } from "./interfaces";
/**

@@ -6,5 +6,3 @@ * Represents a lexer for XML content in a string.

export declare class XMLStringLexer implements XMLLexer {
_str: string;
_length: number;
_index: number;
private _walker;
/**

@@ -25,34 +23,2 @@ * Initializes a new instance of `XMLStringLexer`.

/**
* Resets the lexer to the beginning of the string.
*/
private reset;
/**
* Determines whether the parser is at or past the end of the string.
*/
private get eof();
/**
* Consumes and returns a single character.
*/
private consumeChar;
/**
* Skips over whitespace characters.
*/
private skipSpace;
/**
* Unconsumes one character.
*/
private revert;
/**
* Skips over a number of characters.
*/
private seek;
/**
* Returns a single character without consuming.
*/
private peekChar;
/**
* Returns a given number of characters without consuming.
*/
private peek;
/**
* Branches from an opening bracket (`<`).

@@ -59,0 +25,0 @@ */

@@ -5,2 +5,3 @@ "use strict";

const interfaces_1 = require("./interfaces");
const util_1 = require("@oozcitak/util");
/**

@@ -16,5 +17,2 @@ * Represents a lexer for XML content in a string.

constructor(str) {
this._str = '';
this._length = 0;
this._index = 0;
/**

@@ -24,4 +22,3 @@ * Determines whether whitespace-only text nodes are skipped or not.

this.skipWhitespaceOnlyText = false;
this._str = str;
this._length = str.length;
this._walker = new util_1.StringWalker(str);
}

@@ -32,12 +29,12 @@ /**

nextToken() {
if (this.eof) {
if (this._walker.eof) {
return new XMLToken_1.EOFToken();
}
let token = new XMLToken_1.EOFToken();
const char = this.consumeChar();
const char = this._walker.c;
if (char === '<') {
this._walker.next();
token = this.openBracket();
}
else {
this.revert();
token = this.text();

@@ -56,63 +53,10 @@ }

/**
* Resets the lexer to the beginning of the string.
*/
reset() {
this._index = 0;
}
/**
* Determines whether the parser is at or past the end of the string.
*/
get eof() {
return (this._index >= this._length);
}
/**
* Consumes and returns a single character.
*/
consumeChar() {
const char = this._str[this._index];
this._index++;
return char;
}
/**
* Skips over whitespace characters.
*/
skipSpace() {
while (!this.eof && XMLStringLexer.isSpace(this._str[this._index])) {
this._index++;
}
}
/**
* Unconsumes one character.
*/
revert() {
if (this._index > 0) {
this._index--;
}
}
/**
* Skips over a number of characters.
*/
seek(count) {
this._index += count;
}
/**
* Returns a single character without consuming.
*/
peekChar() {
return this._str[this._index];
}
/**
* Returns a given number of characters without consuming.
*/
peek(count) {
return this._str.substr(this._index, count);
}
/**
* Branches from an opening bracket (`<`).
*/
openBracket() {
switch (this.consumeChar()) {
switch (this._walker.c) {
case '?':
if (this.peek(3) === 'xml') {
this.seek(3);
this._walker.next();
if (this._walker.startsWith('xml')) {
this._walker.seek(3);
return this.declaration();

@@ -124,18 +68,19 @@ }

case '!':
if (this.peek(2) === '--') {
this.seek(2);
this._walker.next();
if (this._walker.startsWith('--')) {
this._walker.seek(2);
return this.comment();
}
else if (this.peek(7) === '[CDATA[') {
this.seek(7);
else if (this._walker.startsWith('[CDATA[')) {
this._walker.seek(7);
return this.cdata();
}
else if (this.peek(7) === 'DOCTYPE') {
this.seek(7);
else if (this._walker.startsWith('DOCTYPE')) {
this._walker.seek(7);
return this.doctype();
}
case '/':
this._walker.next();
return this.closeTag();
default:
this.revert();
return this.openTag();

@@ -156,10 +101,10 @@ }

let startQuote = '';
this.skipSpace();
this._walker.skip(c => XMLStringLexer.isSpace(c));
inName = true;
inValue = false;
while (!this.eof) {
let char = this.consumeChar();
const nextChar = this.peekChar();
while (!this._walker.eof) {
let char = this._walker.take(1);
const nextChar = this._walker.c;
if (char === '?' && nextChar === '>') {
this.seek(1);
this._walker.seek(1);
return new XMLToken_1.DeclarationToken(version, encoding, standalone);

@@ -170,5 +115,5 @@ }

inValue = true;
this.skipSpace();
while (!this.eof && char !== '=') {
char = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof && char !== '=') {
char = this._walker.take(1);
}

@@ -178,4 +123,4 @@ if (char !== '=') {

}
this.skipSpace();
startQuote = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
startQuote = this._walker.take(1);
if (!XMLStringLexer.isQuote(startQuote)) {

@@ -201,3 +146,3 @@ throw new Error('Missing quote character before attribute value');

attValue = '';
this.skipSpace();
this._walker.skip(c => XMLStringLexer.isSpace(c));
}

@@ -218,30 +163,32 @@ else if (inValue) {

// name
this.skipSpace();
while (!this.eof) {
const char = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof) {
const char = this._walker.c;
if (char === '>') {
this._walker.next();
return new XMLToken_1.DocTypeToken(name, '', '');
}
else if (char === '[') {
this.revert();
break;
}
else if (XMLStringLexer.isSpace(char)) {
this._walker.next();
break;
}
else {
this._walker.next();
name += char;
}
}
this.skipSpace();
if (this.peek(6) === 'PUBLIC') {
this.seek(6);
this._walker.skip(c => XMLStringLexer.isSpace(c));
if (this._walker.startsWith('PUBLIC')) {
this._walker.seek(6);
// pubId
this.skipSpace();
let startQuote = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
let startQuote = this._walker.take(1);
if (!XMLStringLexer.isQuote(startQuote)) {
throw new Error('Missing quote character before pubId value');
}
while (!this.eof) {
const char = this.consumeChar();
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === startQuote) {

@@ -255,9 +202,9 @@ break;

// sysId
this.skipSpace();
startQuote = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
startQuote = this._walker.take(1);
if (!XMLStringLexer.isQuote(startQuote)) {
throw new Error('Missing quote character before sysId value');
}
while (!this.eof) {
const char = this.consumeChar();
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === startQuote) {

@@ -271,12 +218,12 @@ break;

}
else if (this.peek(6) === 'SYSTEM') {
this.seek(6);
else if (this._walker.startsWith('SYSTEM')) {
this._walker.seek(6);
// sysId
this.skipSpace();
let startQuote = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
let startQuote = this._walker.take(1);
if (!XMLStringLexer.isQuote(startQuote)) {
throw new Error('Missing quote character before sysId value');
}
while (!this.eof) {
const char = this.consumeChar();
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === startQuote) {

@@ -292,5 +239,5 @@ break;

let hasInternalSubset = false;
this.skipSpace();
while (!this.eof) {
const char = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === '>') {

@@ -305,4 +252,4 @@ return new XMLToken_1.DocTypeToken(name, pubId, sysId);

if (hasInternalSubset) {
while (!this.eof) {
const char = this.consumeChar();
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === ']') {

@@ -312,5 +259,5 @@ break;

}
this.skipSpace();
while (!this.eof) {
const char = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === '>') {

@@ -328,9 +275,9 @@ return new XMLToken_1.DocTypeToken(name, pubId, sysId);

let target = '';
while (!this.eof) {
const char = this.consumeChar();
const nextChar = this.peekChar();
while (!this._walker.eof) {
const char = this._walker.take(1);
const nextChar = this._walker.c;
const endTag = (char === '?' && nextChar === '>');
if (XMLStringLexer.isSpace(char) || endTag) {
if (endTag) {
this.seek(1);
this._walker.seek(1);
return new XMLToken_1.PIToken(target, '');

@@ -345,7 +292,7 @@ }

let data = '';
while (!this.eof) {
const char = this.consumeChar();
const nextChar = this.peekChar();
while (!this._walker.eof) {
const char = this._walker.take(1);
const nextChar = this._walker.c;
if (char === '?' && nextChar === '>') {
this.seek(1);
this._walker.seek(1);
return new XMLToken_1.PIToken(target, data);

@@ -365,9 +312,9 @@ }

let data = '';
while (!this.eof) {
const char = this.consumeChar();
while (!this._walker.eof) {
const char = this._walker.c;
if (char === '<') {
this.revert();
break;
}
data += char;
this._walker.next();
}

@@ -382,6 +329,6 @@ return new XMLToken_1.TextToken(data);

let data = '';
while (!this.eof) {
const char = this.consumeChar();
if (char === '-' && this.peek(2) === '->') {
this.seek(2);
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === '-' && this._walker.startsWith('->')) {
this._walker.seek(2);
return new XMLToken_1.CommentToken(data);

@@ -399,6 +346,6 @@ }

let data = '';
while (!this.eof) {
const char = this.consumeChar();
if (char === ']' && this.peek(2) === ']>') {
this.seek(2);
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === ']' && this._walker.startsWith(']>')) {
this._walker.seek(2);
return new XMLToken_1.CDATAToken(data);

@@ -422,6 +369,6 @@ }

// element name
this.skipSpace();
while (!this.eof) {
const char = this.consumeChar();
const nextChar = this.peekChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof) {
const char = this._walker.take(1);
const nextChar = this._walker.c;
if (char === '>') {

@@ -431,3 +378,3 @@ return new XMLToken_1.ElementToken(name, {}, false);

else if (char === '/' && nextChar === '>') {
this.seek(1);
this._walker.seek(1);
return new XMLToken_1.ElementToken(name, {}, true);

@@ -443,8 +390,8 @@ }

// attributes
this.skipSpace();
this._walker.skip(c => XMLStringLexer.isSpace(c));
inAttName = true;
inAttValue = false;
while (!this.eof) {
let char = this.consumeChar();
const nextChar = this.peekChar();
while (!this._walker.eof) {
let char = this._walker.take(1);
const nextChar = this._walker.c;
if (char === '>') {

@@ -454,3 +401,3 @@ return new XMLToken_1.ElementToken(name, attributes, false);

else if (char === '/' && nextChar === '>') {
this.seek(1);
this._walker.seek(1);
return new XMLToken_1.ElementToken(name, attributes, true);

@@ -461,5 +408,5 @@ }

inAttValue = true;
this.skipSpace();
while (!this.eof && char !== '=') {
char = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof && char !== '=') {
char = this._walker.take(1);
}

@@ -469,4 +416,4 @@ if (char !== '=') {

}
this.skipSpace();
startQuote = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
startQuote = this._walker.take(1);
if (!XMLStringLexer.isQuote(startQuote)) {

@@ -485,3 +432,3 @@ throw new Error('Missing quote character before attribute value');

attValue = '';
this.skipSpace();
this._walker.skip(c => XMLStringLexer.isSpace(c));
}

@@ -500,5 +447,5 @@ else if (inAttValue) {

let name = '';
this.skipSpace();
while (!this.eof) {
const char = this.consumeChar();
this._walker.skip(c => XMLStringLexer.isSpace(c));
while (!this._walker.eof) {
const char = this._walker.take(1);
if (char === '>') {

@@ -519,4 +466,3 @@ return new XMLToken_1.ClosingTagToken(name);

static isSpace(char) {
const ch = char.charCodeAt(0);
return ch === 9 || ch === 10 || ch === 13 || ch === 32;
return char === ' ' || char === '\n' || char === '\r' || char === '\t';
}

@@ -535,3 +481,3 @@ /**

[Symbol.iterator]() {
this.reset();
this._walker.seek(0, util_1.SeekOrigin.Start);
return {

@@ -538,0 +484,0 @@ next: function () {

@@ -1,1 +0,1 @@

export { XMLSerializerImpl as XMLSerializer } from './XMLSerializer';
export { XMLSerializerImpl as XMLSerializer } from "./XMLSerializer";

@@ -26,5 +26,3 @@ "use strict";

if (items !== undefined) {
for (const item of items) {
this.set(item[0], item[1]);
}
items.forEach(item => this.set(item[0], item[1]));
}

@@ -43,5 +41,3 @@ }

const mapCopy = new NamespacePrefixMap();
for (const [key, list] of this._items.entries()) {
mapCopy._items.set(key, list.slice(0));
}
this._items.forEach((list, key) => mapCopy._items.set(key, list.slice(0)));
return mapCopy;

@@ -72,3 +68,4 @@ }

let prefix = null;
for (prefix of candidatesList) {
for (let i = 0; i < candidatesList.length; i++) {
const prefix = candidatesList[i];
/**

@@ -75,0 +72,0 @@ * 2.1. If prefix matches preferred prefix, then stop running these steps

@@ -8,3 +8,2 @@ import { Node } from "../dom/interfaces";

private _xmlVersion;
private _algo;
/**

@@ -11,0 +10,0 @@ * Initializes a new instance of `PreSerializer`.

@@ -8,3 +8,3 @@ "use strict";

const infra_1 = require("@oozcitak/infra");
const util_1 = require("../util");
const algorithm_1 = require("../algorithm");
/**

@@ -21,3 +21,2 @@ * Pre-serializes XML nodes.

this._xmlVersion = xmlVersion;
this._algo = util_1.globalStore.dom.algorithm;
}

@@ -129,3 +128,3 @@ /**

if (requireWellFormed && (node.localName.includes(":") ||
!this._algo.xml.isName(node.localName))) {
!algorithm_1.xml_isName(node.localName))) {
throw new Error("Node local name contains invalid characters (well-formed required).");

@@ -397,5 +396,3 @@ }

*/
for (const childNode of node._children) {
children.push(this._serializeNode(childNode, inheritedNS, map, prefixIndex, requireWellFormed, level + 1));
}
node._children.forEach(childNode => children.push(this._serializeNode(childNode, inheritedNS, map, prefixIndex, requireWellFormed, level + 1)));
/**

@@ -451,5 +448,3 @@ * 20. Append the following to markup, in the order listed:

const children = [];
for (const childNode of node._children) {
children.push(this._serializeNode(childNode, namespace, prefixMap, prefixIndex, requireWellFormed, level));
}
node._children.forEach(childNode => children.push(this._serializeNode(childNode, namespace, prefixMap, prefixIndex, requireWellFormed, level)));
return {

@@ -480,3 +475,3 @@ node: node,

*/
if (requireWellFormed && (!this._algo.xml.isLegalChar(node.data, this._xmlVersion) ||
if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data, this._xmlVersion) ||
node.data.includes("--") || node.data.endsWith("-"))) {

@@ -512,3 +507,3 @@ throw new Error("Comment data contains invalid characters (well-formed required).");

*/
if (requireWellFormed && !this._algo.xml.isLegalChar(node.data, this._xmlVersion)) {
if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data, this._xmlVersion)) {
throw new Error("Text data contains invalid characters (well-formed required).");

@@ -549,5 +544,3 @@ }

const children = [];
for (const childNode of node._children) {
children.push(this._serializeNode(childNode, namespace, prefixMap, prefixIndex, requireWellFormed, level));
}
node._children.forEach(childNode => children.push(this._serializeNode(childNode, namespace, prefixMap, prefixIndex, requireWellFormed, level)));
return {

@@ -577,3 +570,3 @@ node: node,

*/
if (requireWellFormed && !this._algo.xml.isPubidChar(node.publicId)) {
if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) {
throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");

@@ -589,3 +582,3 @@ }

if (requireWellFormed &&
(!this._algo.xml.isLegalChar(node.systemId, this._xmlVersion) ||
(!algorithm_1.xml_isLegalChar(node.systemId, this._xmlVersion) ||
(node.systemId.includes('"') && node.systemId.includes("'")))) {

@@ -656,3 +649,3 @@ throw new Error("DocType system identifier contains invalid characters (well-formed required).");

*/
if (requireWellFormed && (!this._algo.xml.isLegalChar(node.data, this._xmlVersion) ||
if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data, this._xmlVersion) ||
node.data.includes("?>"))) {

@@ -726,3 +719,4 @@ throw new Error("Processing instruction data contains invalid characters (well-formed required).");

*/
for (const attr of node.attributes) {
for (let i = 0; i < node.attributes._attributeList.length; i++) {
const attr = node.attributes._attributeList[i];
/**

@@ -877,3 +871,3 @@ * 3.1. If the require well-formed flag is set (its value is true), and the

if (requireWellFormed && (attr.localName.includes(":") ||
!this._algo.xml.isName(attr.localName) ||
!algorithm_1.xml_isName(attr.localName) ||
(attr.localName === "xmlns" && attributeNamespace === null))) {

@@ -915,3 +909,4 @@ throw new Error("Attribute local name contains invalid characters (well-formed required).");

*/
for (const attr of node.attributes) {
for (let i = 0; i < node.attributes._attributeList.length; i++) {
const attr = node.attributes._attributeList[i];
/**

@@ -918,0 +913,0 @@ * _Note:_ The following conditional steps find namespace prefixes. Only

@@ -19,5 +19,3 @@ "use strict";

let count = 0;
for (const [key, subSet] of this._storage.entries()) {
count += subSet.size;
}
this._storage.forEach(subSet => count += subSet.size);
return count;

@@ -74,5 +72,3 @@ }

forEach(callback, thisArg) {
for (const val of this) {
callback.call(thisArg, val, this);
}
this._storage.forEach((subSet, key) => subSet.forEach(val => callback.call(thisArg, [key, val], this)));
}

@@ -79,0 +75,0 @@ /**

@@ -62,5 +62,3 @@ "use strict";

let markup = '';
for (const child of preNode.children) {
markup += this._serializeNode(child);
}
preNode.children.forEach(child => markup += this._serializeNode(child));
return markup;

@@ -75,5 +73,3 @@ }

let markup = '';
for (const preAttr of preNode.attributes) {
markup += ` ${this._serializeAttribute(preAttr)}`;
}
preNode.attributes.forEach(preAttr => markup += ` ${this._serializeAttribute(preAttr)}`);
return markup;

@@ -80,0 +76,0 @@ }

@@ -1,2 +0,2 @@

import { Node } from '../dom/interfaces';
import { Node } from "../dom/interfaces";
/**

@@ -3,0 +3,0 @@ * Contains type casts for DOM objects.

@@ -1,2 +0,2 @@

import { RegisteredObserver, TransientRegisteredObserver, EventListener, MouseEvent, Slotable, Node, Text, Element, ShadowRoot, CharacterData, Document, DocumentType, Attr, Comment, ProcessingInstruction, Slot, Window, CDATASection, DocumentFragment } from '../dom/interfaces';
import { RegisteredObserver, TransientRegisteredObserver, EventListener, MouseEvent, Slotable, Node, Text, Element, ShadowRoot, CharacterData, Document, DocumentType, Attr, Comment, ProcessingInstruction, Slot, Window, CDATASection, DocumentFragment } from "../dom/interfaces";
/**

@@ -3,0 +3,0 @@ * Contains user-defined type guards for DOM objects.

@@ -1,7 +0,3 @@

import { GlobalStore } from './GlobalStore';
export { Cast } from './Cast';
export { Guard } from './Guard';
/**
* Stores global variables.
*/
export declare const globalStore: GlobalStore;
export { Cast } from "./Cast";
export { Guard } from "./Guard";
export { EmptySet } from "./EmptySet";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const GlobalStore_1 = require("./GlobalStore");
var Cast_1 = require("./Cast");

@@ -8,6 +7,4 @@ exports.Cast = Cast_1.Cast;

exports.Guard = Guard_1.Guard;
/**
* Stores global variables.
*/
exports.globalStore = GlobalStore_1.GlobalStore.instance;
var EmptySet_1 = require("./EmptySet");
exports.EmptySet = EmptySet_1.EmptySet;
//# sourceMappingURL=index.js.map
{
"name": "@oozcitak/dom",
"version": "1.0.0",
"version": "1.1.0",
"keywords": [

@@ -22,3 +22,3 @@ "dom",

"engines": {
"node": ">=6.0"
"node": ">=8.0"
},

@@ -29,15 +29,18 @@ "files": [

"dependencies": {
"@oozcitak/util": "1.0.2",
"@oozcitak/util": "2.1.0",
"@oozcitak/infra": "1.0.4",
"@oozcitak/url": "0.0.8"
"@oozcitak/url": "1.0.0"
},
"devDependencies": {
"@types/benchmark": "*",
"@types/chalk": "*",
"@types/dedent": "*",
"@types/jest": "*",
"@types/node": "*",
"@types/jest": "^24.0.24",
"@types/jsdom": "*",
"@types/node": "^12.12.22",
"@types/xmldom": "*",
"@types/jsdom": "*",
"@types/benchmark": "*",
"@types/chalk": "*",
"benchmark": "*",
"chalk": "^3.0.0",
"dedent": "*",
"fast-xml-parser": "*",
"glob": "*",

@@ -47,7 +50,5 @@ "jest": "*",

"ts-jest": "*",
"typescript": "*",
"xmldom": "*",
"benchmark": "*",
"ts-node": "*",
"chalk": "*"
"ts-node": "^8.5.4",
"typescript": "^3.7.4",
"xmldom": "*"
},

@@ -67,6 +68,7 @@ "jest": {

"test": "npm run compile && jest --coverage",
"perf": "ts-node ./perf/perf.ts",
"prof": "npm run compile && rm -f isolate-*-v8.log && node --prof ./perf/prof.js && find . -name isolate-*-v8.log -exec mv {} isolate-v8.log ; && node --prof-process isolate-v8.log > isolate.log && rm isolate-v8.log",
"perf": "npm run compile && ts-node ./perf/perf.ts",
"prof-create": "npm run compile && rm -f isolate-*-v8.log && node --prof ./perf/prof-create.js && find . -name isolate-*-v8.log -exec mv {} isolate-v8.log ; && node --prof-process isolate-v8.log > isolate-create.log && rm isolate-v8.log",
"prof-parse": "npm run compile && rm -f isolate-*-v8.log && node --prof ./perf/prof-parse.js && find . -name isolate-*-v8.log -exec mv {} isolate-v8.log ; && node --prof-process isolate-v8.log > isolate-parse.log && rm isolate-v8.log",
"publish-public": "npm run test && npm publish --access public"
}
}

@@ -7,3 +7,3 @@ # DOM

[![Travis Build Status](https://img.shields.io/travis/oozcitak/dom?logo=travis&style=flat-square](http://travis-ci.org/oozcitak/dom)
[![Travis Build Status](https://img.shields.io/travis/oozcitak/dom?logo=travis&style=flat-square)](http://travis-ci.org/oozcitak/dom)
[![AppVeyor Build status](https://img.shields.io/appveyor/ci/oozcitak/dom?logo=appveyor&style=flat-square)](https://ci.appveyor.com/project/oozcitak/dom)

@@ -14,2 +14,19 @@ [![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/dom.svg?style=flat-square)](https://david-dm.org/oozcitak/dom)

# Version
Current version implements the standard as of commit [57512fa](https://dom.spec.whatwg.org/commit-snapshots/57512fac17cf2f1c4c85be4aec178c8086ee5ee4/).
Current version implements the standard as of commit [57512fa](https://dom.spec.whatwg.org/commit-snapshots/57512fac17cf2f1c4c85be4aec178c8086ee5ee4/) (Last Updated 24 September 2019).
# Installation
```
npm install @oozcitak/dom
```
# Usage
Create an instance of the `DOMImplementation` class to construct the DOM tree.
```js
const { DOMImplementation } = require("@oozcitak/dom");
const dom = new DOMImplementation();
const doc = dom.implementation.createDocument('ns', 'root');
```
The module also exports `DOMParser` and `XMLSerializer` classes as in the browser.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc