Skip to content
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

Exposing parentElement on treeAdapter.createElement #285

Closed
pmdartus opened this issue Nov 18, 2018 · 2 comments
Closed

Exposing parentElement on treeAdapter.createElement #285

pmdartus opened this issue Nov 18, 2018 · 2 comments

Comments

@pmdartus
Copy link
Contributor

pmdartus commented Nov 18, 2018

While implementing support for custom elements in JSDOM, I am facing the following limitation. The create an element for a token algorithm use the intended parent to retrieve the associated document for a newly created node.

In it's current implementation the JSDOM treeAdapter shares the same document for all the created node. However this approach doesn't work in the context of template element, since the HTMLTemplateElment content is associated with an inert template document.

What do you think about extended the current createElement signature to pass the intededParent as parameter?

// The intendedParent can be undefined when this hook is invoked for the root html element.
createElement(tagName: string, namespaceURI: string, attrs: Attribute[], intendedParent?: Element): Element;

An alternative viable approach would be to expose in some way the current element stack.

@inikulin
Copy link
Owner

Sorry for this taking that long. I'm alright with adding this change and will be happy to merge a PR for it if you mind to create one.

@fb55
Copy link
Collaborator

fb55 commented Feb 12, 2022

The alternative viable approach has been implemented in #385.

@fb55 fb55 closed this as completed Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants