Skip to content

Adding NamedNodeMap to global export #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cjs/interface/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {EventTarget} = require('./event-target.js');
const {InputEvent} = require('./input-event.js');
const {ImageClass} = require('./image.js');
const {MutationObserverClass} = require('./mutation-observer.js');
const {NamedNodeMap} = require('./named-node-map.js');
const {NodeList} = require('./node-list.js');
const {Range} = require('./range.js');
const {Text} = require('./text.js');
Expand All @@ -48,6 +49,7 @@ const globalExports = assign(
Event,
EventTarget,
InputEvent,
NamedNodeMap,
NodeList
}
);
Expand Down
2 changes: 1 addition & 1 deletion cjs/shared/symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports.DATASET = DATASET;
const DOCTYPE = Symbol('doctype');
exports.DOCTYPE = DOCTYPE;

// ised in parser and Document to attach once a DOMParser
// used in parser and Document to attach once a DOMParser
const DOM_PARSER = Symbol('DOMParser');
exports.DOM_PARSER = DOM_PARSER;

Expand Down
2 changes: 2 additions & 0 deletions esm/interface/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {EventTarget} from './event-target.js';
import {InputEvent} from './input-event.js';
import {ImageClass} from './image.js';
import {MutationObserverClass} from './mutation-observer.js';
import {NamedNodeMap} from './named-node-map.js';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind moving this above the previous line? Just to preserve the alphabetical order, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, thanks for your feedback 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

import {NodeList} from './node-list.js';
import {Range} from './range.js';
import {Text} from './text.js';
Expand All @@ -48,6 +49,7 @@ const globalExports = assign(
Event,
EventTarget,
InputEvent,
NamedNodeMap,
NodeList
}
);
Expand Down
2 changes: 1 addition & 1 deletion esm/shared/symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const DATASET = Symbol('dataset');
// used in Document to attach the DocType
export const DOCTYPE = Symbol('doctype');

// ised in parser and Document to attach once a DOMParser
// used in parser and Document to attach once a DOMParser
export const DOM_PARSER = Symbol('DOMParser');

// used to reference an end node
Expand Down
4 changes: 2 additions & 2 deletions test/interface/named-node-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const assert = require('../assert.js').for('NamedNodeMap');

const {parseHTML} = global[Symbol.for('linkedom')];

const {document} = parseHTML('<html><div tmp>abc</div></html>');
const {document, NamedNodeMap} = parseHTML('<html><div tmp>abc</div></html>');

let node = document.documentElement.firstElementChild;

assert(typeof NamedNodeMap !== 'undefined', true, 'NamedNodeMap undefined in global export');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to add a unit test related to the change here. I couldn't find similar checks for other exported objects but felt bad not adding something...

assert(node.id, '', 'no id');
assert(!node.hasAttribute('id'), true, 'no id');
node.id = 'test';
Expand Down
4 changes: 1 addition & 3 deletions types/interface/document.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ export class Document extends NonElementParentNode implements globalThis.Documen
setAttributeNS(_: any, name: any, value: any): void;
setAttributeNodeNS(attr: any): import("../mixin/parent-node.js").NodeStruct;
[CLASS_LIST]: import("../dom/token-list.js").DOMTokenList;
[DATASET]: import("../dom/string-map.js").DOMStringMap; /**
* @type {globalThis.Document['defaultView']}
*/
[DATASET]: import("../dom/string-map.js").DOMStringMap;
[STYLE]: import("./css-style-declaration.js").CSSStyleDeclaration;
readonly childNodes: NodeList;
readonly children: NodeList;
Expand Down
2 changes: 1 addition & 1 deletion types/shared/node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function parentElement({ parentNode }: {
parentNode: any;
}): any;
export function previousSibling({ [PREV]: prev }: {
"__@PREV@37916": any;
"__@PREV@38087": any;
}): any;
export function nextSibling(node: any): any;
import { PREV } from "./symbols.js";