Skip to content

imagifyjs? #423

Answered by nfrasser
skywalk1411 asked this question in Q&A
Jan 2, 2023 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

@skywalk1411 please see the reference implementation here:

/**
* @param {Document} doc The document implementaiton
*/
function getDefaultRender(doc) {
return ({ tagName, attributes, content, eventListeners }) => {
const link = doc.createElement(tagName);
for (const attr in attributes) {
link.setAttribute(attr, attributes[attr]);
}
if (eventListeners && link.addEventListener) {
for (const event in eventListeners) {
link.addEventListener(event, eventListeners[event]);
}
}
link.appendChild(doc.createTextNode(content));

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@skywalk1411
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by skywalk1411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants