Closed WesleyBranton closed 4 years ago
I kind of did what @dannycolin suggested on Discourse, with some changes
Is there a reason why you didn't use and a forloop to add the data?
Oops! I didn't mean to edit your comment!
Is there a reason why you didn't use and a forloop to add the data?
You mean to fill the title, image and link or a for loop for each question?
I meant using <template>
instead of display: none
to hide the <li>
element.
Here's an excerpt from the MDN doc:
"The HTML Content Template () element is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded but may be instantiated subsequently during runtime using JavaScript." -- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template
And nvm the forloop I've seen it's done in an other function.
I did originally try using <template>
, but for some reason I wasn't able to use the .cloneNode()
on it. I was able to select it, but Javascript couldn't see any of the child nodes in it. If you can figure out how to do the <template>
instead of the display: none
then that would be great.
"The HTML Content Template () element is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded but may be instantiated subsequently during runtime using JavaScript." -- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template
🤔
I liked the current changes, looks more cleaner.. but if we can use the <template>
it will be even better.
If you can figure out how to do the
<template>
instead of thedisplay: none
then that would be great.
I'll look at it this week and keep you posted ;)
Can we proceed with this PR?
Sorry, I haven't had the time to work on it. I guess we could merge it and as soon as I have more free time I'll try to implement it with <template>
instead of hiding it in CSS.
No problem.. I think that works too. 🙂
I've added templating, as requested in issue #88. I kind of did what @dannycolin suggested on Discourse, with some changes. It should be tested to make sure that it performs the same as the previous method.