html-element
Advanced tools
Comparing version 1.2.3 to 1.2.4
require('./index.js') | ||
var util = require('util'); | ||
var h1=document.createElement('h1'); | ||
var h3=document.createElement('h3'); | ||
var h4=document.createElement('h4'); | ||
var h5=document.createElement('h5'); | ||
h1.setAttribute('n', 'v'); | ||
h1.style.setProperty('color','red'); | ||
h1.textContent = 'w0f w0f'; | ||
h1.appendChild(h3) | ||
h1.appendChild(h4) | ||
h1.insertBefore(h5, h4); | ||
h1.src ="bla" | ||
h1.className="cls"; | ||
console.log(h1.outerHTML); | ||
console.log(util.inspect(h1, true, null)); |
17
index.js
@@ -108,2 +108,19 @@ global.Document = Document | ||
Element.prototype.removeChild = function(rChild) { | ||
var self = this; | ||
this.childNodes.forEach(function(child, index){ | ||
if (child === rChild) delete self.childNodes[index]; | ||
}) | ||
} | ||
Element.prototype.insertBefore = function(newChild, existingChild) { | ||
var self = this; | ||
this.childNodes.forEach(function(child, index){ | ||
if (child === existingChild) { | ||
index === 0 ? self.childNodes.unshift(newChild) | ||
: self.childNodes.splice(index, 0, newChild); | ||
} | ||
}) | ||
} | ||
Element.prototype.__defineGetter__('innerHTML', function () { | ||
@@ -110,0 +127,0 @@ var s = '' |
{ | ||
"name": "html-element", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"homepage": "https://github.com/1N50MN14/html-element", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -17,2 +17,4 @@ # html-element | ||
- replaceChild(node) | ||
- removeChild(node) | ||
- insertBefore(new, existing) | ||
- toString() | ||
@@ -19,0 +21,0 @@ - setAttribute(name, value) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9821
221
45