Socket
Socket
Sign inDemoInstall

@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.15.2 to 1.15.3

2

lib/algorithm/EventTargetAlgorithm.d.ts

@@ -27,3 +27,3 @@ import { EventListenerOptions, AddEventListenerOptions, EventListenerEntry, EventTarget } from "../dom/interfaces";

*/
export declare function eventTarget_removeEventListener(eventTarget: EventTarget, listener: EventListenerEntry, index?: number): void;
export declare function eventTarget_removeEventListener(eventTarget: EventTarget, listener: EventListenerEntry, index: number): void;
/**

@@ -30,0 +30,0 @@ * Removes all event listeners.

@@ -10,2 +10,6 @@ "use strict";

function eventTarget_flatten(options) {
/**
* 1. If options is a boolean, then return options.
* 2. Return options’s capture.
*/
if (util_1.isBoolean(options)) {

@@ -25,2 +29,9 @@ return options;

function eventTarget_flattenMore(options) {
/**
* 1. Let capture be the result of flattening options.
* 2. Let once and passive be false.
* 3. If options is a dictionary, then set passive to options’s passive and
* once to options’s once.
* 4. Return capture, passive, and once.
*/
const capture = eventTarget_flatten(options);

@@ -43,8 +54,24 @@ let once = false;

function eventTarget_addEventListener(eventTarget, listener) {
/**
* 1. If eventTarget is a ServiceWorkerGlobalScope object, its service
* worker’s script resource’s has ever been evaluated flag is set, and
* listener’s type matches the type attribute value of any of the service
* worker events, then report a warning to the console that this might not
* give the expected results. [SERVICE-WORKERS]
*/
// TODO: service worker
/**
* 2. If listener’s callback is null, then return.
*/
if (listener.callback === null)
return;
// return if the listener is already defined
/**
* 3. If eventTarget’s event listener list does not contain an event listener
* whose type is listener’s type, callback is listener’s callback, and capture
* is listener’s capture, then append listener to eventTarget’s event listener
* list.
*/
for (let i = 0; i < eventTarget._eventListenerList.length; i++) {
const entry = eventTarget._eventListenerList[i];
if (entry.type === listener.type && entry.callback === listener.callback
if (entry.type === listener.type && entry.callback.handleEvent === listener.callback.handleEvent
&& entry.capture === listener.capture) {

@@ -54,3 +81,2 @@ return;

}
// add to listener list
eventTarget._eventListenerList.push(listener);

@@ -65,19 +91,16 @@ }

*/
function eventTarget_removeEventListener(eventTarget, listener, index = -1) {
function eventTarget_removeEventListener(eventTarget, listener, index) {
/**
* 1. If eventTarget is a ServiceWorkerGlobalScope object and its service
* worker’s set of event types to handle contains type, then report a
* warning to the console that this might not give the expected results.
* [SERVICE-WORKERS]
*/
// TODO: service worker
/**
* 2. Set listener’s removed to true and remove listener from eventTarget’s
* event listener list.
*/
listener.removed = true;
// check if the listener is defined
if (index === -1) {
for (let i = 0; i < eventTarget._eventListenerList.length; i++) {
const entry = eventTarget._eventListenerList[i];
if (entry.type === listener.type && entry.callback === listener.callback
&& entry.capture === listener.capture) {
index = i;
break;
}
}
}
// remove from list
if (index !== -1) {
eventTarget._eventListenerList.splice(index, 1);
}
eventTarget._eventListenerList.splice(index, 1);
}

@@ -91,10 +114,13 @@ exports.eventTarget_removeEventListener = eventTarget_removeEventListener;

function eventTarget_removeAllEventListeners(eventTarget) {
// check if the listener is defined
/**
* To remove all event listeners, given an EventTarget object eventTarget,
* for each listener of eventTarget’s event listener list, remove an event
* listener with eventTarget and listener.
*/
for (const e of eventTarget._eventListenerList) {
e.removed = true;
}
// empty list
eventTarget._eventListenerList = [];
eventTarget._eventListenerList.length = 0;
}
exports.eventTarget_removeAllEventListeners = eventTarget_removeAllEventListeners;
//# sourceMappingURL=EventTargetAlgorithm.js.map

@@ -211,11 +211,8 @@ "use strict";

if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) {
if (a._attributeList.length !== b._attributeList.length)
return false;
const attrMap = new Map();
const attrMap = {};
for (const attrA of a._attributeList) {
attrMap.set((attrA._namespace || '') + attrA._localName + attrA._value, attrA);
attrMap[attrA._localName] = attrA;
}
for (let i = 0; i < b._attributeList.length; i++) {
const attrB = b._attributeList[i];
const attrA = attrMap.get((attrB._namespace || '') + attrB._localName + attrB._value);
for (const attrB of b._attributeList) {
const attrA = attrMap[attrB._localName];
if (!attrA)

@@ -222,0 +219,0 @@ return false;

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

*/
constructor(host, mode = "closed") {
constructor(host, mode) {
super();

@@ -19,0 +19,0 @@ this._host = host;

@@ -47,3 +47,10 @@ "use strict";

if (this.skipIfStartsWith('xml')) {
return this.declaration();
if (XMLStringLexer.isSpace(this._str[this._index])) {
return this.declaration();
}
else {
// a processing instruction starting with xml. e.g. <?xml-stylesheet href="doc.xsl" type="text/xsl"?>
this.seek(-3);
return this.pi();
}
}

@@ -192,2 +199,3 @@ else {

const name = this.takeUntil2('>', '/', true);
this.skipSpace();
if (this.skipIfStartsWith('>')) {

@@ -194,0 +202,0 @@ return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: false };

@@ -9,4 +9,159 @@ import { Node } from "../dom/interfaces";

export declare class XMLSerializerImpl implements XMLSerializer {
private static _VoidElementNames;
/** @inheritdoc */
serializeToString(root: Node): string;
/**
* Produces an XML serialization of the given node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _xmlSerialization;
/**
* Produces an XML serialization of a node.
*
* @param node - node to serialize
* @param namespace - context namespace
* @param prefixMap - namespace prefix map
* @param prefixIndex - generated namespace prefix index
* @param requireWellFormed - whether to check conformance
*/
private _serializeNodeNS;
/**
* Produces an XML serialization of a node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeNode;
/**
* Produces an XML serialization of an element node.
*
* @param node - node to serialize
* @param namespace - context namespace
* @param prefixMap - namespace prefix map
* @param prefixIndex - generated namespace prefix index
* @param requireWellFormed - whether to check conformance
*/
private _serializeElementNS;
/**
* Produces an XML serialization of a document node.
*
* @param node - node to serialize
* @param namespace - context namespace
* @param prefixMap - namespace prefix map
* @param prefixIndex - generated namespace prefix index
* @param requireWellFormed - whether to check conformance
*/
private _serializeDocumentNS;
/**
* Produces an XML serialization of a comment node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeComment;
/**
* Produces an XML serialization of a text node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
* @param level - current depth of the XML tree
*/
private _serializeText;
/**
* Produces an XML serialization of a document fragment node.
*
* @param node - node to serialize
* @param namespace - context namespace
* @param prefixMap - namespace prefix map
* @param prefixIndex - generated namespace prefix index
* @param requireWellFormed - whether to check conformance
*/
private _serializeDocumentFragmentNS;
/**
* Produces an XML serialization of a document type node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeDocumentType;
/**
* Produces an XML serialization of a processing instruction node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeProcessingInstruction;
/**
* Produces an XML serialization of a CDATA node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeCData;
/**
* Produces an XML serialization of the attributes of an element node.
*
* @param node - node to serialize
* @param map - namespace prefix map
* @param prefixIndex - generated namespace prefix index
* @param localPrefixesMap - local prefixes map
* @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace
* attributes
* @param requireWellFormed - whether to check conformance
*/
private _serializeAttributesNS;
/**
* Records namespace information for the given element and returns the
* default namespace attribute value.
*
* @param node - element node to process
* @param map - namespace prefix map
* @param localPrefixesMap - local prefixes map
*/
private _recordNamespaceInformation;
/**
* Generates a new prefix for the given namespace.
*
* @param newNamespace - a namespace to generate prefix for
* @param prefixMap - namespace prefix map
* @param prefixIndex - generated namespace prefix index
*/
private _generatePrefix;
/**
* Produces an XML serialization of an attribute value.
*
* @param value - attribute value
* @param requireWellFormed - whether to check conformance
*/
private _serializeAttributeValue;
/**
* Produces an XML serialization of an element node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeElement;
/**
* Produces an XML serialization of a document node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeDocument;
/**
* Produces an XML serialization of a document fragment node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeDocumentFragment;
/**
* Produces an XML serialization of the attributes of an element node.
*
* @param node - node to serialize
* @param requireWellFormed - whether to check conformance
*/
private _serializeAttributes;
}
{
"name": "@oozcitak/dom",
"version": "1.15.2",
"version": "1.15.3",
"keywords": [

@@ -5,0 +5,0 @@ "dom",

@@ -23,3 +23,3 @@ # DOM

# Usage
Create an instance of the `DOMImplementation` class to construct the DOM tree.
Create an instance of the [`DOMImplementation`](https://dom.spec.whatwg.org/#interface-domimplementation) class to construct the DOM tree.

@@ -33,2 +33,2 @@ ```js

The module also exports `DOMParser` and `XMLSerializer` classes as in the browser.
The module also exports [`DOMParser`](https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser) and [`XMLSerializer`](https://w3c.github.io/DOM-Parsing/#the-xmlserializer-interface) 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 too big to display

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