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

Change NodeTemplatePart.replace type signature #74

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

seanpdoyle
Copy link
Contributor

Replace ChildNode with Node in NodeTemplatePart.replace(...nodes) signature.

According to the 3.2. Template Parts and Custom Template Process Callback section of the specification, the NodeTemplatePart interface declares replace(...nodes: Array<string | Node>):

interface NodeTemplatePart : TemplatePart {
  readonly attribute ContainerNode parentNode;
  readonly attribute Node? previousSibling;
  readonly attribute Node? nextSibling;
  [NewObject] readonly NodeList replacementNodes;
  void replace((Node or DOMString)... nodes);
  void replaceHTML(DOMString html);
}

This commit changes the type signature and adds coverage for replacing a NodeTemplatePart with a DocumentFragment instance.

Replace `ChildNode` with `Node` in `NodeTemplatePart.replace(...nodes)`
signature.

According to the [3.2. Template Parts and Custom Template Process
Callback][] section of the specification, the `NodeTemplatePart`
interface declares `replace(...nodes: Array<string | Node>)`:

```typescript
interface NodeTemplatePart : TemplatePart {
  readonly attribute ContainerNode parentNode;
  readonly attribute Node? previousSibling;
  readonly attribute Node? nextSibling;
  [NewObject] readonly NodeList replacementNodes;
  void replace((Node or DOMString)... nodes);
  void replaceHTML(DOMString html);
}
```

This commit changes the type signature and adds coverage for replacing a
`NodeTemplatePart` with a `DocumentFragment` instance.

[3.2. Template Parts and Custom Template Process Callback]: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md#32-template-parts-and-custom-template-process-callback
@seanpdoyle seanpdoyle requested a review from a team as a code owner December 13, 2024 14:47
@keithamus keithamus merged commit 743b970 into github:main Dec 13, 2024
1 check passed
@seanpdoyle seanpdoyle deleted the replace-child-node branch December 13, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants