Trimming newlines near elements
Ouverte
- Langage dominant
- JavaScript
- Étoiles
- 9k
- Forks
- 181
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When running the following code:
```javascript
import htm from 'https://unpkg.com/htm?module'
function h(type, props, ...children) {
return { type, props, children };
}
const html = htm.bind(h);
console.log( html`
bold
regular
```
I am getting the following object:
```javascript
{
type: 'div',
props: null,
children: [{type: 'b' /* , ... */}, 'regular']
}
```
The string have been auto-formatted but still seems to be a valid HTML code. Now I have implemented my own `h()` function as I'd like to compose the DOM elements in my way. However, I don't see any obvious way to split `bold` and `regular` elements with a space except for inserting ` ` (#234). I'd appreciate any comments on this.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Start by reproducing the JavaScript tagged-template example in the issue and inspect the returned children around the element. Read the related #234 reference for context on whitespace handling. Done means the formatted template preserves the intended separation between “bold” and “regular” without requiring .
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript
- Domaine
- frontend
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100