Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

unexpected loop behavior when rendering templates.

Open
#590 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start by reproducing the provided template with @repeat and @set, then trace the template-rendering path that handles loop variables and substitutions. Compare it with the working direct-DOM loop example; done means the template example renders the expected background and foreground values without the workaround.

Written by the indexing model from the issue text.

Description

Hello and thank you so much for this wonderful language!

Hyperscript completely solves all my tasks on the front end, with the exception of a small problem: SET command in the template's loop doesn't work.

The code from the example of using templates does not work:

<template id="color-template">
  <ul>
    @repeat in colors
      @set bg to it -- this command return lenght of it, but not it as Object
      @set fg to getContrastingColor(it) -- the same problem
      <li style="background: ${bg}; color: ${unescaped fg}">${bg}</li>
    @end
  </ul>
</template>

And this code works:

<template id="color-template">
    @repeat in colors
        <li style="background: ${it}; color: ${getContrastingColor(it)}">${it}</li>
    @end
</template>

I found a workaround: using loops directly in DOM elements (when more complex logic is required). I'm not very versed in JavaScript (that's why I chose Hyperscript) to send the pull request, but I hope that this bug causes inconvenience to someone else and it can be fixed.

Dominant language
JavaScript
Stars
3.8k
Forks
171
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bigskysoftware/_hyperscript

All issues in bigskysoftware/_hyperscript

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.