emberjs / emberjs/ember.js

[Bug] Whitespace issue in HBS 2

Open
#19,603 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug
Check the reproduction.

### 🔬 Minimal Reproduction
Component `foo`:

```hbs
{{#each (array 1 2) as |item index|~}}
{{~#if index}},{{/if}}{{yield item}}
{{~/each}}
```

Use it:

```hbs
(
{{#foo as |item|}}
{{~item~}}
{{/foo}}
)
```

This renders:

```html
( 1,2)
```

### 😕 Actual Behavior
Note the missing space before the closing parenthesis. There is a new line before the closing `span` tag so there should be a space.

Changing the usage to be something like:

```hbs
(
{{#foo as |item|}}
{{item}}
{{/foo}}
)
```

Fixes the issue. The space appears correctly.

### 🤔 Expected Behavior
A space to be there.

### 🌍 Environment

- Ember: 3.27.5
- Node.js/npm: 16.3
- OS: Linux
- Browser: Chrome

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.