curran / curran/google-diff-match-patch
[JS] patch_fromText breaks on IE8
- Lingua principale
- Python
- Stelle
- 17
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
```
What steps will reproduce the problem?
1. Performs patch_fromText on a diff string.
2. The diff string is:
var diffString = "@@ -3,14 +3,12 @@\n mple\n-st\n co\n-nt\n+mm\n ent\n"
3. var patches = dmp.patch_fromText(diffString);
What is the expected output? What do you see instead?
The array of patches object. But I see nothing, and IE8 gives an error of
"Invalid patch string: @@ -3,14 +3,12 @@"
What version of the product are you using? On what operating system?
I'm using diff_match_patch_20120106.zip, on Windows XP with IE8.
Please provide any additional information below.
I traced down to the issue that IE8 or below appends \r into the string.
Therefore, on line 2062 of the uncompressed version, when only splitting on \n,
it will fail and thus can't match with the regex for patchHeader.
I modified line 2062 to the below and it works:
var text = textline.split(/\r\n|\r|\n/);
```
Original issue reported on code.google.com by `ese...@gmail.com` on 21 Jun 2012 at 3:17
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Apri l’implementazione JavaScript non compressa intorno alla riga 2062 e segui patch_fromText con la stringa diff fornita in IE8. Il lavoro è completato quando la stringa viene analizzata nell’array di patch previsto senza l’errore “Invalid patch string”; verifica la riproduzione fornita in IE8.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 48/100