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

@xmldom/xmldom

Package Overview
Dependencies
Maintainers
0
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xmldom/xmldom - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

31

CHANGELOG.md

@@ -7,2 +7,33 @@ # Changelog

## [0.9.3](https://github.com/xmldom/xmldom/compare/0.9.2...0.9.3)
### Fixed
- restore more `Node` and `ProcessingInstruction` types [`#725`](https://github.com/xmldom/xmldom/issues/725) / [`#726`](https://github.com/xmldom/xmldom/pull/726)
- `getElements*` methods return `LiveNodeList<Element>` [`#731`](https://github.com/xmldom/xmldom/issues/731) / [`#734`](https://github.com/xmldom/xmldom/pull/734)
- Add more missing `Node` props [`#728`](https://github.com/xmldom/xmldom/pull/728), triggered by unclosed [`#724`](https://github.com/xmldom/xmldom/pull/724)
### Docs
- Update supported runtimes in readme (NodeJS >= 14.6 and other [ES5 compatible runtimes](https://compat-table.github.io/compat-table/es5/))
### Chore
- updates devDependencies
Thank you,
[@Ponynjaa](https://github.com/Ponynjaa),
[@ayZagen](https://github.com/ayZagen),
[@sserdyuk](https://github.com/sserdyuk),
[@wydengyre](https://github.com/wydengyre),
[@mykola-mokhnach](https://github.com/mykola-mokhnach),
[@benkroeger](https://github.com/benkroeger),
for your contributions.
# Changelog
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.9.2](https://github.com/xmldom/xmldom/compare/0.9.1...0.9.2)

@@ -9,0 +40,0 @@

193

index.d.ts

@@ -336,2 +336,7 @@ declare module '@xmldom/xmldom' {

};
type GetRootNodeOptions = {
composed?: boolean;
};
/**

@@ -354,4 +359,3 @@ * The DOM Node interface is an abstract base class upon which many other DOM API objects are

* **This behavior is slightly different from the in the specs**:
* - undeclared properties: nodeType, baseURI, isConnected, parentElement, textContent
* - missing methods: contains, getRootNode, isEqualNode, isSameNode
* - unimplemented interfaces: EventTarget
*

@@ -386,2 +390,14 @@ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247

/**
* Always returns `about:blank` currently.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI)
*/
readonly baseURI: 'about:blank';
/**
* Returns true if this node is inside of a document or is the document node itself.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected)
*/
readonly isConnected: boolean;
/**
* The namespace URI of this node.

@@ -402,2 +418,8 @@ */

readonly nodeName: string;
/**
* Returns the type of node.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeType)
*/
readonly nodeType: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeValue) */

@@ -418,2 +440,8 @@ nodeValue: string | null;

/**
* Returns the parent `Node` if it is of type `Element`, otherwise `null`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/parentElement)
*/
readonly parentElement: Element | null;
/**
* The prefix of the namespace for this node.

@@ -428,3 +456,16 @@ */

readonly previousSibling: Node | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/textContent) */
textContent: string | null;
/**
* Zero based line position inside the parsed source,
* if the `locator` was not disabled.
*/
lineNumber?: number;
/**
* One based column position inside the parsed source,
* if the `locator` was not disabled.
*/
columnNumber?: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/appendChild) */

@@ -434,2 +475,36 @@ appendChild(node: Node): Node;

/**
* Checks whether `other` is an inclusive descendant of this node.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/contains)
*/
contains(other: Node | null | undefined): boolean;
/**
* Searches for the root node of this node.
*
* **This behavior is slightly different from the one in the specs**:
* - ignores `options.composed`, since `ShadowRoot`s are unsupported, therefore always
* returning root.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode)
*
* @see https://dom.spec.whatwg.org/#dom-node-getrootnode
* @see https://dom.spec.whatwg.org/#concept-shadow-including-root
*/
getRootNode(options: GetRootNodeOptions): Node;
/**
* Checks whether the given node is equal to this node.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode)
*/
isEqualNode(other: Node): boolean;
/**
* Checks whether the given node is this node.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode)
*/
isSameNode(other: Node): boolean;
/**
* Returns a copy of node. If deep is true, the copy also includes the node's descendants.

@@ -628,6 +703,2 @@ *

*
* @param {string} localName
* The local name of the attribute.
* @returns {Attr | null}
* The attribute with the given local name, or null if no such attribute exists.
* @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name

@@ -639,9 +710,2 @@ */

*
* @param {string | null} namespaceURI
* The namespace URI of the attribute.
* @param {string} localName
* The local name of the attribute.
* @returns {Attr | null}
* The attribute with the given namespace URI and local name, or null if no such attribute
* exists.
* @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace

@@ -656,6 +720,2 @@ */

*
* @param {string} localName
* The local name of the attribute to be removed.
* @returns {Attr}
* The attribute node that was removed.
* @throws {DOMException}

@@ -671,8 +731,2 @@ * With code:

*
* @param {string | null} namespaceURI
* The namespace URI of the attribute to be removed.
* @param {string} localName
* The local name of the attribute to be removed.
* @returns {Attr}
* The attribute node that was removed.
* @throws {DOMException}

@@ -689,7 +743,2 @@ * With code:

*
* @param {Attr} attr
* The attribute to set.
* @returns {Attr | null}
* The old attribute with the same local name and namespace URI as the new one, or null if no
* such attribute exists.
* @throws {DOMException}

@@ -706,7 +755,2 @@ * With code:

*
* @param {Attr} attr
* The attribute to set.
* @returns {Attr | null}
* The old attribute with the same local name and namespace URI as the new one, or null if no
* such attribute exists.
* @throws {DOMException}

@@ -728,3 +772,3 @@ * Throws a DOMException with the name "InUseAttributeError" if the attribute is already an

*/
class NodeList implements Iterable<Node> {
class NodeList<T extends Node = Node> implements Iterable<T> {
/**

@@ -741,7 +785,7 @@ * Returns the number of nodes in the collection.

*/
item(index: number): Node | null;
item(index: number): T | null;
/**
* Returns a string representation of the NodeList.
*/
toString(nodeFilter: (node: Node) => Node | undefined): string;
toString(nodeFilter: (node: T) => T | undefined): string;
/**

@@ -752,3 +796,3 @@ * Filters the NodeList based on a predicate.

*/
filter(predicate: (node: Node) => boolean): Node[];
filter(predicate: (node: T) => boolean): T[];
/**

@@ -760,6 +804,12 @@ * Returns the first index at which a given node can be found in the NodeList, or -1 if it is

*/
indexOf(node: Node): number;
[index: number]: Node | undefined;
indexOf(node: T): number;
[Symbol.iterator](): Iterator<Node>;
/**
* Index based access returns `undefined`, when accessing indexes >= `length`.
* But it would break a lot of code (like `Array.from` usages),
* if it would be typed as `T | undefined`.
*/
[index: number]: T;
[Symbol.iterator](): Iterator<T>;
}

@@ -771,3 +821,3 @@

*/
interface LiveNodeList extends NodeList {}
interface LiveNodeList<T extends Node = Node> extends NodeList<T> {}
/**

@@ -840,3 +890,3 @@ * Represents a live collection of nodes that is automatically updated when its associated

*/
getElementsByClassName(classNames: string): LiveNodeList;
getElementsByClassName(classNames: string): LiveNodeList<Element>;

@@ -865,3 +915,3 @@ /**

*/
getElementsByTagName(qualifiedName: string): LiveNodeList;
getElementsByTagName(qualifiedName: string): LiveNodeList<Element>;

@@ -878,3 +928,3 @@ /**

localName: string
): LiveNodeList;
): LiveNodeList<Element>;

@@ -980,8 +1030,3 @@ getQualifiedName(): string;

*/
var CharacterData: {
// instanceof pre ts 5.3
(val: unknown): val is CharacterData;
// instanceof post ts 5.3
[Symbol.hasInstance](val: unknown): val is CharacterData;
};
var CharacterData: InstanceOf<CharacterData>;

@@ -1084,4 +1129,16 @@ /**

interface ProcessingInstruction extends Node {
interface ProcessingInstruction extends CharacterData {
nodeType: typeof Node.PROCESSING_INSTRUCTION_NODE;
/**
* A string representing the textual data contained in this object.
* For `ProcessingInstruction`, that means everything that goes after the `target`, excluding
* `?>`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/data)
*/
data: string;
/**
* A string containing the name of the application.
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ProcessingInstruction/target) */
readonly target: string;
}

@@ -1107,3 +1164,2 @@ var ProcessingInstruction: InstanceOf<ProcessingInstruction>;

*
* @type DOMImplementation
* @readonly

@@ -1126,5 +1182,2 @@ */

*
* @param name
* String that sets the attribute object's name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createAttribute)

@@ -1147,5 +1200,2 @@ */

*
* @param data
* Sets the comment object's data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createComment)

@@ -1185,2 +1235,19 @@ */

createElementNS(namespace: string | null, qualifiedName: string): Element;
/**
* Creates an EntityReference object.
* The current implementation does not fill the `childNodes` with those of the corresponding
* `Entity`
*
* The name of the entity to reference. No namespace well-formedness checks are performed.
*
* @deprecated
* In DOM Level 4.
* @returns {EntityReference}
* @throws {DOMException}
* With code `INVALID_CHARACTER_ERR` when `name` is not valid.
* @throws {DOMException}
* with code `NOT_SUPPORTED_ERR` when the document is of type `html`
* @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
*/
createEntityReference(name: string): EntityReference;

@@ -1212,5 +1279,2 @@ /**

* Returns a reference to the first object with the specified value of the ID attribute.
*
* @param elementId
* String that specifies the ID value.
*/

@@ -1234,3 +1298,3 @@ getElementById(elementId: string): Element | null;

*/
getElementsByClassName(classNames: string): LiveNodeList;
getElementsByClassName(classNames: string): LiveNodeList<Element>;

@@ -1259,3 +1323,3 @@ /**

*/
getElementsByTagName(qualifiedName: string): LiveNodeList;
getElementsByTagName(qualifiedName: string): LiveNodeList<Element>;

@@ -1275,3 +1339,3 @@ /**

localName: string
): LiveNodeList;
): LiveNodeList<Element>;
/**

@@ -1402,3 +1466,2 @@ * Returns a copy of node. If deep is true, the copy also includes the node's descendants.

}
// END ./lib/dom.js

@@ -1405,0 +1468,0 @@

{
"name": "@xmldom/xmldom",
"version": "0.9.2",
"version": "0.9.3",
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",

@@ -43,3 +43,3 @@ "keywords": [

"engines": {
"node": ">=14.0.0"
"node": ">=14.6"
},

@@ -50,12 +50,12 @@ "devDependencies": {

"@jazzer.js/jest-runner": "2.1.0",
"auto-changelog": "2.4.0",
"eslint": "8.57.0",
"auto-changelog": "2.5.0",
"eslint": "8.57.1",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-anti-trojan-source": "1.1.1",
"eslint-plugin-es5": "1.5.0",
"eslint-plugin-n": "17.10.2",
"eslint-plugin-n": "17.10.3",
"eslint-plugin-prettier": "5.2.1",
"get-stream": "6.0.1",
"jest": "29.7.0",
"nodemon": "3.1.4",
"nodemon": "3.1.5",
"np": "8.0.4",

@@ -62,0 +62,0 @@ "prettier": "3.3.3",

@@ -37,3 +37,3 @@ # @xmldom/xmldom

The target runtimes `xmldom` supports are currently Node >= v10 (ES5) and Rhino ([not tested as part of CI](https://github.com/xmldom/xmldom/discussions/214)).
The target runtimes `xmldom` supports are currently Node >= v14.6 (and very likely any other [ES5 compatible runtime](https://compat-table.github.io/compat-table/es5/)).

@@ -103,3 +103,3 @@ When deciding how to fix bugs or implement features, `xmldom` tries to stay as close as possible to the various [related specifications/standards](#specs).

`if (node.nodeType === node.ELEMENT_NODE) {...`
1. `ELEMENT_NODE` (`1`)

@@ -117,10 +117,10 @@ 2. `ATTRIBUTE_NODE` (`2`)

12. `NOTATION_NODE` (`12`)
attribute:
- `nodeValue` | `prefix`
- `nodeValue` | `prefix` | `textContent`
readonly attribute:
- `nodeName` | `nodeType` | `parentNode` | `childNodes` | `firstChild` | `lastChild` | `previousSibling` | `nextSibling` | `attributes` | `ownerDocument` | `namespaceURI` | `localName`
method:
- `nodeName` | `nodeType` | `parentNode` | `parentElement` | `childNodes` | `firstChild` | `lastChild` | `previousSibling` | `nextSibling` | `attributes` | `ownerDocument` | `namespaceURI` | `localName` | `isConnected` | `baseURI`
method:
* `insertBefore(newChild, refChild)`

@@ -133,2 +133,6 @@ * `replaceChild(newChild, oldChild)`

* `normalize()`
* `contains(otherNode)`
* `getRootNode()`
* `isEqualNode(otherNode)`
* `isSameNode(otherNode)`
* `isSupported(feature, version)`

@@ -156,3 +160,3 @@ * `hasAttributes()`

- `INVALID_ACCESS_ERR` (`15`)
attributes:

@@ -191,3 +195,3 @@ - `code` with a value matching one of the above constants.

* [Element](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614) : Node
readonly attribute:

@@ -326,19 +330,19 @@ - `tagName`

xmldom implements the following interfaces (only the ones marked with `*` are currently exposed):
- `Attr` *
xmldom implements the following interfaces:
- `Attr`
- `CDATASection`
- `CharacterData`
- `Comment`
- `Document` *
- `Document`
- `DocumentFragment`
- `DocumentType` *
- `DOMException` *
- `DOMImplementation` *
- `Element` *
- `DocumentType`
- `DOMException`
- `DOMImplementation`
- `Element`
- `Entity`
- `EntityReference`
- `LiveNodeList`
- `NamedNodeMap` *
- `Node` *
- `NodeList` *
- `NamedNodeMap`
- `Node`
- `NodeList`
- `Notation`

@@ -345,0 +349,0 @@ - `ProcessingInstruction`

Sorry, the diff of this file is too big to display

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