You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
454 B
18 lines
454 B
2 years ago
|
var doc = document;
|
||
|
exports = function(str) {
|
||
|
var fragment = doc.createElement('body');
|
||
|
fragment.innerHTML = str;
|
||
|
return fragment.childNodes[0];
|
||
|
};
|
||
|
if (doc.createRange && doc.body) {
|
||
|
var range = doc.createRange();
|
||
|
range.selectNode(doc.body);
|
||
|
if (range.createContextualFragment) {
|
||
|
exports = function(str) {
|
||
|
return range.createContextualFragment(str).childNodes[0];
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = exports;
|