Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f8c6b74
)
improve comments
author
Jason Woofenden
<jason@jasonwoof.com>
Sun, 14 May 2017 02:37:42 +0000
(22:37 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Sun, 14 May 2017 02:37:42 +0000
(22:37 -0400)
editor.js
patch
|
blob
|
history
diff --git
a/editor.js
b/editor.js
index
83cc246
..
564befc
100644
(file)
--- a/
editor.js
+++ b/
editor.js
@@
-225,7
+225,8
@@
function new_cursor_position (args) {
return null
}
return null
}
-// encode text so it can be safely placed inside an html attribute
+// html encoding for attributes
+// encoding nbsp is not required, but hopefully it is useful
enc_attr_regex = new RegExp('(&)|(")|(\u00A0)', 'g')
function enc_attr (txt) {
return txt.replace(enc_attr_regex, function(match, amp, quote) {
enc_attr_regex = new RegExp('(&)|(")|(\u00A0)', 'g')
function enc_attr (txt) {
return txt.replace(enc_attr_regex, function(match, amp, quote) {
@@
-238,6
+239,8
@@
function enc_attr (txt) {
return ' '
})
}
return ' '
})
}
+// html encoding for text (does nothing to stop whitespace collapse)
+// encoding nbsp is not required, but hopefully it is useful
enc_text_regex = new RegExp('(&)|(<)|(\u00A0)', 'g')
function enc_text (txt) {
return txt.replace(enc_text_regex, function(match, amp, lt) {
enc_text_regex = new RegExp('(&)|(<)|(\u00A0)', 'g')
function enc_text (txt) {
return txt.replace(enc_text_regex, function(match, amp, lt) {