Bu web sitesi JavaScript ile daha iyi çalışır.
Ana Sayfa
Keşfet
Yardım
Giriş Yap
jan
/
mustache.js
şunun yansıması
https://github.com/janl/mustache.js
İzle
1
Yıldızla
0
Çatalla
0
Kod
Konular
0
Sürümler
46
Wiki
Aktivite
Kaynağa Gözat
Merge pull request
#530
from janl/improve-html-escaping
Improve HTML escaping
tags/v2.2.1
David da Silva
10 yıl önce
ebeveyn
53b1c955f9
378bcca8a5
işleme
34ebd1cb1a
3 değiştirilmiş dosya
ile
6 ekleme
ve
4 silme
Görünümü Böl
Diff Seçenekleri
İstatistikleri Göster
Yama Dosyasını İndir
Diff Dosyasını İndir
+4
-2
mustache.js
+1
-1
test/_files/escaped.js
+1
-1
test/_files/escaped.txt
+ 4
- 2
mustache.js
Dosyayı Görüntüle
@@ -63,11 +63,13 @@
'>': '>',
'"': '"',
"'": ''',
'/': '/'
'/': '/',
'`': '`',
'=': '='
};
function escapeHtml (string) {
return String(string).replace(/[&<>"'\/]/g, function fromEntityMap (s) {
return String(string).replace(/[&<>"'
`=
\/]/g, function fromEntityMap (s) {
return entityMap[s];
});
}
+ 1
- 1
test/_files/escaped.js
Dosyayı Görüntüle
@@ -2,5 +2,5 @@
title: function () {
return "Bear > Shark";
},
entities: "" \"'<>/"
entities: "" \"'<>
`=
/"
})
+ 1
- 1
test/_files/escaped.txt
Dosyayı Görüntüle
@@ -1,2 +1,2 @@
<h1>Bear > Shark</h1>
And even &quot; "'<>/, but not " "'<>/.
And even &quot; "'<>&#x
60;=&#x
2F;, but not " "'<>
`=
/.
Yaz
Önizleme
Yükleniyor…
İptal
Kaydet