Variadic Element#append (like HTML DOM)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 793
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
I'm always frustrated when I have to write multiple lines to append a few elements and text nodes. 😓
Describe the solution you'd like
A clear and concise description of what I want to happen is this:
pcui.Container.prototype.appendMany = function() {
for (let i=0; i<arguments.length; i++) {
let arg = arguments[i];
let node;
if (typeof arg === 'string') {
node = new pcui.Label({text: arg});
} else {
node = arg;
}
this.append(node);
}
}
Which would be used like:
var key = document.createElement('code');
key.innerText = "pos";
var val = document.createElement('code');
val.innerText = '{x: 1, y: 2, z: 3}';
Appending everything with a single call while generating labels on the fly:
this.container.appendMany("Key: ", key, "Value: ", val);
It would create something like:

Describe alternatives you've considered
this.container.append(new pcui.Label({text:"Key: "}));
this.container.append(key);
this.container.append(new pcui.Label({text:"Value: "}));
this.container.append(val);
This would mirror the original HTML DOM API specification, which would make pcui elements feel more natural (at least to me 😅).
Original HTML DOM API: https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/append
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Element#append entry point and compare its current behavior with the linked HTML DOM ParentNode.append specification. Verify the requested single-call behavior for strings and elements, and consider the existing append usage shown in the issue. Done means one append call accepts the mixed values described and produces the requested order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100