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.12.0 to 1.13.0

2

lib/algorithm/DocumentAlgorithm.js

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

if (util_1.Guard.isElementNode(inclusiveDescendant)) {
inclusiveDescendant._attributeList._attributeList.forEach(attr => attr._nodeDocument = document);
inclusiveDescendant._attributeList._asArray().forEach(attr => attr._nodeDocument = document);
}

@@ -96,0 +96,0 @@ /**

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

*/
return element._attributeList._attributeList.includes(attribute);
return element._attributeList._asArray().indexOf(attribute) !== -1;
}

@@ -101,3 +101,3 @@ exports.element_has = element_has;

*/
element._attributeList._attributeList.push(attribute);
element._attributeList._asArray().push(attribute);
attribute._element = element;

@@ -147,4 +147,4 @@ // mark that the document has namespaces

*/
const index = element._attributeList._attributeList.indexOf(attribute);
element._attributeList._attributeList.splice(index, 1);
const index = element._attributeList._asArray().indexOf(attribute);
element._attributeList._asArray().splice(index, 1);
attribute._element = null;

@@ -191,5 +191,5 @@ }

*/
const index = element._attributeList._attributeList.indexOf(oldAttr);
const index = element._attributeList._asArray().indexOf(oldAttr);
if (index !== -1) {
element._attributeList._attributeList[index] = newAttr;
element._attributeList._asArray()[index] = newAttr;
}

@@ -221,4 +221,3 @@ oldAttr._element = null;

}
const index = element._attributeList._attributeList.findIndex(attr => attr._qualifiedName === qualifiedName);
return (index === -1 ? null : element._attributeList._attributeList[index]);
return element._attributeList._asArray().find(attr => attr._qualifiedName === qualifiedName) || null;
}

@@ -241,4 +240,3 @@ exports.element_getAnAttributeByName = element_getAnAttributeByName;

const ns = namespace || null;
const index = element._attributeList._attributeList.findIndex(attr => attr._namespace === ns && attr._localName === localName);
return (index === -1 ? null : element._attributeList._attributeList[index]);
return element._attributeList._asArray().find(attr => attr._namespace === ns && attr._localName === localName) || null;
}

@@ -245,0 +243,0 @@ exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeByNamespaceAndLocalName;

@@ -56,6 +56,6 @@ "use strict";

copy = ElementAlgorithm_1.element_createAnElement(document, node._localName, node._namespace, node._namespacePrefix, node._is, false);
node._attributeList._attributeList.forEach(attribute => {
for (const attribute of node._attributeList) {
const copyAttribute = node_clone(attribute, document);
ElementAlgorithm_1.element_append(copyAttribute, copy);
});
}
}

@@ -191,3 +191,3 @@ else {

a._localName !== b._localName ||
a._attributeList._attributeList.length !== b._attributeList._attributeList.length)
a._attributeList.length !== b._attributeList.length)
return false;

@@ -213,8 +213,10 @@ }

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

@@ -392,4 +394,4 @@ if (!attrA)

*/
for (let i = 0; i < element._attributeList._attributeList.length; i++) {
const attr = element._attributeList._attributeList[i];
for (let i = 0; i < element._attributeList.length; i++) {
const attr = element._attributeList[i];
if (attr._namespacePrefix === "xmlns" && attr._value === namespace) {

@@ -435,4 +437,4 @@ return attr._localName;

*/
for (let i = 0; i < node._attributeList._attributeList.length; i++) {
const attr = node._attributeList._attributeList[i];
for (let i = 0; i < node._attributeList.length; i++) {
const attr = node._attributeList[i];
if (attr._namespace === infra_1.namespace.XMLNS &&

@@ -439,0 +441,0 @@ attr._namespacePrefix === "xmlns" &&

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

hasAttributes() {
return !infra_1.list.isEmpty(this._attributeList._attributeList);
return this._attributeList.length !== 0;
}

@@ -83,3 +83,5 @@ /** @inheritdoc */

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

@@ -130,4 +132,4 @@ }

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

@@ -196,4 +198,4 @@ attribute = attr;

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

@@ -226,4 +228,4 @@ return true;

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

@@ -272,4 +274,4 @@ attribute = attr;

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

@@ -320,4 +322,4 @@ return true;

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

@@ -324,0 +326,0 @@ found = true;

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

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

@@ -77,0 +77,0 @@ attr._namespacePrefix === null && attr._value === key)

import { Element, Attr, NamedNodeMap } from "./interfaces";
/**
* Represents a collection of nodes.
* Represents a collection of attributes.
*/
export declare class NamedNodeMapImpl implements NamedNodeMap {
export declare class NamedNodeMapImpl extends Array<Attr> implements NamedNodeMap {
_element: Element;
_attributeList: Attr[];
/**

@@ -14,5 +13,4 @@ * Initializes a new instance of `NamedNodeMap`.

private constructor();
_asArray(): Array<Attr>;
/** @inheritdoc */
get length(): number;
/** @inheritdoc */
item(index: number): Attr | null;

@@ -32,6 +30,2 @@ /** @inheritdoc */

/**
* Returns an iterator for attributes.
*/
[Symbol.iterator](): Iterator<Attr>;
/**
* Creates a new `NamedNodeMap`.

@@ -38,0 +32,0 @@ *

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

/**
* Represents a collection of nodes.
* Represents a collection of attributes.
*/
class NamedNodeMapImpl {
class NamedNodeMapImpl extends Array {
/**

@@ -16,13 +16,7 @@ * Initializes a new instance of `NamedNodeMap`.

constructor(element) {
this._attributeList = [];
super();
this._element = element;
}
_asArray() { return this; }
/** @inheritdoc */
get length() {
/**
* The length attribute’s getter must return the attribute list’s size.
*/
return this._attributeList.length;
}
/** @inheritdoc */
item(index) {

@@ -35,3 +29,3 @@ /**

*/
return this._attributeList[index] || null;
return this[index] || null;
}

@@ -94,13 +88,2 @@ /** @inheritdoc */

/**
* Returns an iterator for attributes.
*/
[Symbol.iterator]() {
const it = this._attributeList[Symbol.iterator]();
return {
next() {
return it.next();
}
};
}
/**
* Creates a new `NamedNodeMap`.

@@ -107,0 +90,0 @@ *

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

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

@@ -468,0 +468,0 @@ * 5.2.1. If attr equals attr1, then return the result of adding

{
"name": "@oozcitak/dom",
"version": "1.12.0",
"version": "1.13.0",
"keywords": [

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

@@ -0,0 +0,0 @@ # DOM

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

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