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.7.1 to 1.8.0

lib/parser/DOMParserImpl.d.ts

8

lib/dom/HTMLCollectionImpl.d.ts

@@ -26,3 +26,3 @@ import { Node, Element, HTMLCollection } from "./interfaces";

/** @inheritdoc */
[index: number]: any;
[index: number]: Element | undefined;
/** @inheritdoc */

@@ -33,4 +33,8 @@ [key: string]: any;

*/
get(target: HTMLCollection, key: string | symbol, receiver: any): Element | null;
get(target: HTMLCollection, key: PropertyKey, receiver: any): Element | null | undefined;
/**
* Implements a proxy set trap to provide array-like access.
*/
set(target: HTMLCollection, key: PropertyKey, value: Element, receiver: any): boolean;
/**
* Creates a new `HTMLCollection`.

@@ -37,0 +41,0 @@ *

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

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

@@ -106,14 +107,32 @@ * Represents a collection of elements.

get(target, key, receiver) {
if (typeof key === 'string' && HTMLCollectionImpl.reservedNames.indexOf(key) === -1) {
const index = Number(key);
if (isNaN(Number(index)))
return target.namedItem(key);
else
return target.item(index);
if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) {
return Reflect.get(target, key, receiver);
}
const index = Number(key);
if (isNaN(index)) {
return target.namedItem(key) || undefined;
}
else {
return Reflect.get(target, key, receiver);
return target.item(index) || undefined;
}
}
/**
* Implements a proxy set trap to provide array-like access.
*/
set(target, key, value, receiver) {
if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) {
return Reflect.set(target, key, value, receiver);
}
const index = Number(key);
const node = isNaN(index) ?
target.namedItem(key) || undefined : target.item(index) || undefined;
if (node && node._parent) {
algorithm_1.mutation_replace(node, value, node._parent);
return true;
}
else {
return false;
}
}
/**
* Creates a new `HTMLCollection`.

@@ -130,3 +149,3 @@ *

HTMLCollectionImpl.reservedNames = ['_root', '_live', '_filter', 'length',
'item', 'namedItem', 'get'];
'item', 'namedItem', 'get', 'set'];
//# sourceMappingURL=HTMLCollectionImpl.js.map

@@ -21,2 +21,4 @@ import { Node, NodeList } from "./interfaces";

/** @inheritdoc */
[index: number]: Node | undefined;
/** @inheritdoc */
keys(): Iterable<number>;

@@ -32,2 +34,10 @@ /** @inheritdoc */

/**
* Implements a proxy get trap to provide array-like access.
*/
get(target: NodeList, key: PropertyKey, receiver: any): Node | undefined;
/**
* Implements a proxy set trap to provide array-like access.
*/
set(target: NodeList, key: PropertyKey, value: Node, receiver: any): boolean;
/**
* Creates a new `NodeList`.

@@ -34,0 +44,0 @@ *

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

@@ -18,2 +20,3 @@ * Represents an ordered set of nodes.

this._root = root;
return new Proxy(this, this);
}

@@ -125,2 +128,37 @@ /** @inheritdoc */

/**
* Implements a proxy get trap to provide array-like access.
*/
get(target, key, receiver) {
if (!util_1.isString(key)) {
return Reflect.get(target, key, receiver);
}
const index = Number(key);
if (isNaN(index)) {
return Reflect.get(target, key, receiver);
}
return target.item(index) || undefined;
}
/**
* Implements a proxy set trap to provide array-like access.
*/
set(target, key, value, receiver) {
if (!util_1.isString(key)) {
return Reflect.set(target, key, value, receiver);
}
const index = Number(key);
if (isNaN(index)) {
return Reflect.set(target, key, value, receiver);
}
const node = target.item(index) || undefined;
if (!node)
return false;
if (node._parent) {
algorithm_1.mutation_replace(node, value, node._parent);
return true;
}
else {
return false;
}
}
/**
* Creates a new `NodeList`.

@@ -127,0 +165,0 @@ *

@@ -23,2 +23,4 @@ import { Node, NodeList } from "./interfaces";

/** @inheritdoc */
[index: number]: Node | undefined;
/** @inheritdoc */
keys(): Iterable<number>;

@@ -34,2 +36,10 @@ /** @inheritdoc */

/**
* Implements a proxy get trap to provide array-like access.
*/
get(target: NodeListStaticImpl, key: PropertyKey, receiver: any): Node | undefined;
/**
* Implements a proxy set trap to provide array-like access.
*/
set(target: NodeListStaticImpl, key: PropertyKey, value: Node, receiver: any): boolean;
/**
* Creates a new `NodeList`.

@@ -36,0 +46,0 @@ *

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

@@ -21,2 +22,3 @@ * Represents an ordered list of nodes.

this._filter = function (node) { return true; };
return new Proxy(this, this);
}

@@ -111,2 +113,34 @@ /** @inheritdoc */

/**
* Implements a proxy get trap to provide array-like access.
*/
get(target, key, receiver) {
if (!util_1.isString(key)) {
return Reflect.get(target, key, receiver);
}
const index = Number(key);
if (isNaN(index)) {
return Reflect.get(target, key, receiver);
}
return target._items[index] || undefined;
}
/**
* Implements a proxy set trap to provide array-like access.
*/
set(target, key, value, receiver) {
if (!util_1.isString(key)) {
return Reflect.set(target, key, value, receiver);
}
const index = Number(key);
if (isNaN(index)) {
return Reflect.set(target, key, value, receiver);
}
if (index >= 0 && index < target._items.length) {
target._items[index] = value;
return true;
}
else {
return false;
}
}
/**
* Creates a new `NodeList`.

@@ -113,0 +147,0 @@ *

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

export { DOMParser } from "./DOMParser";
export { DOMParserImpl as DOMParser } from "./DOMParserImpl";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Export classes
var DOMParser_1 = require("./DOMParser");
exports.DOMParser = DOMParser_1.DOMParser;
var DOMParserImpl_1 = require("./DOMParserImpl");
exports.DOMParser = DOMParserImpl_1.DOMParserImpl;
//# sourceMappingURL=index.js.map

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

import { Document } from "../dom/interfaces";
/**
* Represents a parser for XML and HTML content.
*/
export interface DOMParser {
/**
* Parses the given string and returns a document object.
*
* @param source - the string containing the document tree.
* @param mimeType - the mime type of the document
*/
parseFromString(source: string, mimeType: MimeType): Document;
}
/**
* Defines the mime type of the document.
*/
export declare type MimeType = 'text/html' | 'text/xml' | 'application/xml' | 'application/xhtml+xml' | 'image/svg+xml';
/**
* Represents a token.

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

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

export { XMLSerializer } from "./XMLSerializer";
export { XMLSerializerImpl as XMLSerializer } from "./XMLSerializerImpl";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Export classes
var XMLSerializer_1 = require("./XMLSerializer");
exports.XMLSerializer = XMLSerializer_1.XMLSerializer;
var XMLSerializerImpl_1 = require("./XMLSerializerImpl");
exports.XMLSerializer = XMLSerializerImpl_1.XMLSerializerImpl;
//# sourceMappingURL=index.js.map
{
"name": "@oozcitak/dom",
"version": "1.7.1",
"version": "1.8.0",
"keywords": [

@@ -28,3 +28,3 @@ "dom",

"dependencies": {
"@oozcitak/util": "4.0.0",
"@oozcitak/util": "5.0.0",
"@oozcitak/infra": "1.0.4",

@@ -31,0 +31,0 @@ "@oozcitak/url": "1.0.0"

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

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