Skip to content

Commit ff0f2e9

Browse files
committed
Remove dead HTMLDecode code. Fixes jsdom#828.
1 parent 4354ea4 commit ff0f2e9

File tree

4 files changed

+1
-23
lines changed

4 files changed

+1
-23
lines changed

lib/jsdom/browser/htmlencoding.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,20 +1476,6 @@ var entityRegExp = /&(?:#([0-9]+)|#x([0-9a-f]+)|([a-z0-9]+));/gi;
14761476
var attributeModeSpecialCharRegExp = /["&<>\xA0]/g;
14771477
var nonAttributeModeSpecialCharRegExp = /[&<>\xA0]/g;
14781478

1479-
exports.HTMLDecode = function decode(s) {
1480-
if (!s) return '';
1481-
return s.replace(entityRegExp, function ($0, decimalStr, hexStr, entityName) {
1482-
if (decimalStr) {
1483-
return String.fromCharCode(parseInt(decimalStr, 10));
1484-
} else if (hexStr) {
1485-
return String.fromCharCode(parseInt(hexStr, 16));
1486-
} else {
1487-
// Fall back to the original string if we don't know the entity, as per browser behavior:
1488-
return charByEntityName[entityName] || $0;
1489-
}
1490-
});
1491-
};
1492-
14931479
function specialCharToEntity(s) {
14941480
var entity = specialCharEntities[s];
14951481
return entity ? entity : s;

lib/jsdom/browser/htmltodom.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
var HTMLDecode = require('./htmlencoding').HTMLDecode;
2-
31
function HtmlToDom(parser) {
42

53
if(parser && parser.write) {

lib/jsdom/browser/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ var http = require('http'),
22
URL = require('url'),
33
HtmlToDom = require('./htmltodom').HtmlToDom,
44
domToHtml = require('./domtohtml').domToHtml,
5-
htmlencoding = require('./htmlencoding'),
6-
HTMLEncode = htmlencoding.HTMLEncode,
7-
HTMLDecode = htmlencoding.HTMLDecode,
85
jsdom = require('../../jsdom'),
96
Location = require('./location'),
107
History = require('./history'),

lib/jsdom/level3/core.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ var events = require("../level2/events"),
33
defineGetter = require('../utils').defineGetter,
44
defineSetter = require('../utils').defineSetter,
55
HtmlToDom = require('../browser/htmltodom').HtmlToDom,
6-
domToHtml = require('../browser/domtohtml').domToHtml,
7-
htmlencoding = require('../browser/htmlencoding'),
8-
HTMLEncode = htmlencoding.HTMLEncode,
9-
HTMLDecode = htmlencoding.HTMLDecode;
6+
domToHtml = require('../browser/domtohtml').domToHtml;
107

118
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325
129
core = Object.create(core);

0 commit comments

Comments
 (0)