[ignoreWhitespace] are newlines equal to spaces?
- Vorherrschende Sprache
- JavaScript
- Sterne
- 217
- Forks
- 45
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'd like to use html-differ to write a test system for [marked](https://github.com/chjj/marked), where generated html output is to be compared to pre-written html code, to determine if the two are _equivalent_, so I would like to ignore whitespace differences, when they are not meaningful (as in `
` tags), but I noticed that newlines are treated differently than spaces:
```html
A link. Not anymore.
```
is not considered equal to
```html
A link.
Not anymore.
```
when, IMO, they should be.
I've tracked this to be probably determined by this line of [code] (line 39 on the **right**).
I'm aware this issue is related to CSS, and not HTML itself. According to CSS [specification], when the `white-space` property is **not** `pre`, `pre-wrap`, or `pre-line`, segment breaks (i.e. newlines) are usually [converted] to a space `U+0020`.
[specification]: https://www.w3.org/TR/css-text-3/#white-space-processing
[converted]: https://www.w3.org/TR/css-text-3/#line-break-transform
[code]: https://github.com/bem/html-differ/pull/66/files#diff-6d186b954a58d5bb740f73d84fe39073R39
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit dem im pull request #66 referenzierten Code, insbesondere mit Zeile 39 auf der rechten Seite, und reproduziere die beiden HTML-Beispiele aus dem issue. Prüfe, wie Textknoten für Zeilenumbrüche und Leerzeichen verglichen werden; abgeschlossen ist die Aufgabe, wenn die Beispiele als gleichwertig behandelt werden, ohne Leerraum zu ändern, den CSS beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- css, javascript
- Bereich
- testing
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100