Skip to content

Commit 3f11d56

Browse files
committedFeb 11, 2025
Fix for h() js render function
1 parent cd0717c commit 3f11d56

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎teachprogramming/lib/static/langauge_reference.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
const hasIterationProtocol = variable => variable !== null && Symbol.iterator in Object(variable)
5959
function h(type, params, children) {
6060
const el = document.createElement(type)
61-
for (let [k,v] of Object.entries(params)) {el[k] = v}
61+
for (let [k,v] of Object.entries(params)) {el.setAttribute(k,v)}
6262
if (typeof(children)==="string" ) {el.appendChild(document.createTextNode(children))}
6363
else if (hasIterationProtocol(children)) {for (let c of children) {el.append(c)}}
6464
else if (children ) {el.appendChild(children)}

‎teachprogramming/lib/static/projects.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
const hasIterationProtocol = variable => variable !== null && Symbol.iterator in Object(variable)
2323
function h(type, params, children) {
2424
const el = document.createElement(type)
25-
for (let [k,v] of Object.entries(params)) {el[k] = v}
25+
for (let [k,v] of Object.entries(params)) {el.setAttribute(k,v)}
2626
if (typeof(children)==="string" ) {el.appendChild(document.createTextNode(children))}
2727
else if (hasIterationProtocol(children)) {for (let c of children) {el.append(c)}}
2828
else if (children ) {el.appendChild(children)}

‎teachprogramming/static/projects/web/wordle/client.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h1>Wordle</h1>
2424
export const hasIterationProtocol = variable => variable !== null && Symbol.iterator in Object(variable);
2525
function h(type, params, children) {
2626
const el = document.createElement(type)
27-
for (let [k,v] of Object.entries(params)) {el[k] = v}
27+
for (let [k,v] of Object.entries(params)) {el.setAttribute(k,v)}
2828
if (typeof(children)==="string" ) {el.appendChild(document.createTextNode(children))}
2929
else if (hasIterationProtocol(children)) {for (let c of children) {el.append(c)}}
3030
else if (children ) {el.appendChild(children)}

0 commit comments

Comments
 (0)