mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
parent
45ffc6fb88
commit
df8969f1c4
2 changed files with 1 additions and 20 deletions
|
@ -30,7 +30,7 @@
|
||||||
"node": ">=4.0.0 <7.0.0"
|
"node": ">=4.0.0 <7.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsdom": "^8.3.0",
|
"jsdom": "^9.4.0",
|
||||||
"source-map-support": "^0.4.0"
|
"source-map-support": "^0.4.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
|
|
@ -52,25 +52,6 @@ XMLSerializer.prototype.serializeToString = function(node) {
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
function DOMParser() {
|
|
||||||
}
|
|
||||||
|
|
||||||
DOMParser.prototype.parseFromString = function(string, contentType) {
|
|
||||||
// Create a new document, since we're supposed to always return one.
|
|
||||||
var doc = document.implementation.createHTMLDocument(''),
|
|
||||||
body = doc.body,
|
|
||||||
last;
|
|
||||||
// Set the body's HTML, then change the DOM according the specs.
|
|
||||||
body.innerHTML = string;
|
|
||||||
// Remove all top-level children (<html><head/><body/></html>)
|
|
||||||
while (last = doc.lastChild)
|
|
||||||
doc.removeChild(last);
|
|
||||||
// Insert the first child of the body at the top.
|
|
||||||
doc.appendChild(body.firstChild);
|
|
||||||
return doc;
|
|
||||||
};
|
|
||||||
|
|
||||||
window.XMLSerializer = XMLSerializer;
|
window.XMLSerializer = XMLSerializer;
|
||||||
window.DOMParser = DOMParser;
|
|
||||||
|
|
||||||
module.exports = window;
|
module.exports = window;
|
||||||
|
|
Loading…
Reference in a new issue