Socket
Socket
Sign inDemoInstall

min-document

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

min-document - npm Package Compare versions

Comparing version 0.2.4 to 0.2.6

27

index.js

@@ -50,2 +50,22 @@ function DOMText(value) {

function DocumentFragment() {
this.childNodes = []
this.parentNode = null
}
DocumentFragment.prototype.type = "DocumentFragment"
DocumentFragment.prototype.nodeType = 11
DocumentFragment.prototype.nodeName = "#document-fragment"
DocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild
DocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild
DocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild
DocumentFragment.prototype.toString =
function _DocumentFragment_toString() {
return this.childNodes.map(function (node) {
return String(node)
}).join("")
}
module.exports = Document()

@@ -56,3 +76,4 @@

createTextNode: createTextNode,
createElement: createElement
createElement: createElement,
createDocumentFragment: createDocumentFragment
}

@@ -69,2 +90,6 @@ }

function createDocumentFragment() {
return new DocumentFragment()
}
function _Element_toString() {

@@ -71,0 +96,0 @@ var strings = []

2

package.json
{
"name": "min-document",
"version": "0.2.4",
"version": "0.2.6",
"description": "A minimal DOM implementation",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -8,2 +8,4 @@ var test = require("tape")

assert.equal(typeof document.createElement, "function")
assert.equal(typeof document.createDocumentFragment, "function")
assert.end()

@@ -27,1 +29,26 @@ })

})
test("can createDocumentFragment", function (assert) {
var frag = document.createDocumentFragment()
var h1 = document.createElement("h1")
var h2 = document.createElement("h2")
frag.appendChild(h1)
assert.equal(String(frag), "<h1>\n</h1>")
frag.appendChild(h2)
assert.equal(String(frag), "<h1>\n</h1><h2>\n</h2>")
frag.removeChild(h1)
assert.equal(String(frag), "<h2>\n</h2>")
frag.replaceChild(h1, h2)
assert.equal(String(frag), "<h1>\n</h1>")
assert.end()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc