| 1232 | } |
| 1233 | |
| 1234 | function unescape(html) { |
| 1235 | // explicitly match decimal, hex, and named HTML entities |
| 1236 | return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function (_, n) { |
| 1237 | n = n.toLowerCase(); |
| 1238 | if (n === 'colon') return ':'; |
| 1239 | if (n.charAt(0) === '#') { |
| 1240 | return n.charAt(1) === 'x' |
| 1241 | ? String.fromCharCode(parseInt(n.substring(2), 16)) |
| 1242 | : String.fromCharCode(+n.substring(1)); |
| 1243 | } |
| 1244 | return ''; |
| 1245 | }); |
| 1246 | } |
| 1247 | |
| 1248 | function replace(regex, opt) { |
| 1249 | regex = regex.source; |