mirror of
https://github.com/codecrafters-io/build-your-own-x
synced 2026-07-03 01:09:25 +00:00
dom manupulatioin
This commit is contained in:
parent
32189f86a2
commit
465e77de4c
2 changed files with 21 additions and 0 deletions
|
|
@ -481,3 +481,10 @@ function startServer(port: number): void {
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
startServer(8080);
|
startServer(8080);
|
||||||
|
|
||||||
|
function foo(blaz: {
|
||||||
|
oddly: "long" | "type";
|
||||||
|
but: "hey" | "this" | "is" | number;
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
function new_fn(bar: number) {}
|
||||||
|
|
|
||||||
|
|
@ -55,3 +55,17 @@ const f = (
|
||||||
|
|
||||||
const $root = document.getElementById("root");
|
const $root = document.getElementById("root");
|
||||||
$root.appendChild(createElement(f));
|
$root.appendChild(createElement(f));
|
||||||
|
|
||||||
|
function removeBooleanProp($target, name) {
|
||||||
|
$target.removeAttribute(name);
|
||||||
|
$target[name] = false;
|
||||||
|
}
|
||||||
|
function removeProp($target, name, value) {
|
||||||
|
if (isCustomProp(name)) {
|
||||||
|
return;
|
||||||
|
} else if (name === "className") {
|
||||||
|
$target.removeAttribute("class");
|
||||||
|
} else if (typeof value === "boolean") {
|
||||||
|
removeBooleanProp($target, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue