Socket
Socket
Sign inDemoInstall

simple-dom

Package Overview
Dependencies
0
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.5 to 0.2.6

46

dist/simple-dom-test.js

@@ -195,5 +195,11 @@ (function() {

$$document$element$$Element.prototype.setAttribute = function(_name, value) {
$$document$element$$Element.prototype.setAttribute = function(_name, _value) {
var attributes = this.attributes;
var name = _name.toLowerCase();
var value;
if (typeof _value === 'string') {
value = _value;
} else {
value = '' + _value;
}
var attr;

@@ -282,3 +288,5 @@ for (var i=0, l=attributes.length; i<l; i++) {

this.documentElement = new $$document$element$$default('html');
this.head = new $$document$element$$default('head');
this.body = new $$document$element$$default('body');
this.documentElement.appendChild(this.head);
this.documentElement.appendChild(this.body);

@@ -613,2 +621,33 @@ this.appendChild(this.documentElement);

QUnit.test("head + metatags", function(assert) {
var document = new simple$dom$document$$default();
var meta = $$support$$element('meta', { name: "description", content: "something here" });
var head = document.head;
head.appendChild(meta);
var actual = new simple$dom$html$serializer$$default(simple$dom$void$map$$default).serialize(head.firstChild);
assert.strictEqual(head.firstChild.tagName, "META", "sanity check: the meta element was actually inserted");
assert.equal(actual, '<meta name="description" content="something here">');
});
QUnit.test("setAttribute converts non strings", function (assert) {
var document = new simple$dom$document$$default();
var div = document.createElement('div');
div.setAttribute('a', 0);
assert.strictEqual(div.getAttribute('a'), '0');
div.setAttribute('a', 1);
assert.strictEqual(div.getAttribute('a'), '1');
div.setAttribute('a', null);
assert.strictEqual(div.getAttribute('a'), 'null');
div.setAttribute('a', undefined);
assert.strictEqual(div.getAttribute('a'), 'undefined');
div.setAttribute('a', true);
assert.strictEqual(div.getAttribute('a'), 'true');
div.setAttribute('a', false);
assert.strictEqual(div.getAttribute('a'), 'false');
});
QUnit.module('Node');

@@ -1284,2 +1323,7 @@

QUnit.test('serializes element with attribute number value correctly', function (assert) {
var actual = this.serializer.serialize($$support$$element('div', {"height": 500}));
assert.equal(actual, '<div height="500"></div>');
});
QUnit.test('serializes single void element correctly', function (assert) {

@@ -1286,0 +1330,0 @@ var actual = this.serializer.serialize($$support$$element('img', { src: 'foo' }));

@@ -195,5 +195,11 @@ (function() {

simple$dom$document$element$$Element.prototype.setAttribute = function(_name, value) {
simple$dom$document$element$$Element.prototype.setAttribute = function(_name, _value) {
var attributes = this.attributes;
var name = _name.toLowerCase();
var value;
if (typeof _value === 'string') {
value = _value;
} else {
value = '' + _value;
}
var attr;

@@ -282,3 +288,5 @@ for (var i=0, l=attributes.length; i<l; i++) {

this.documentElement = new simple$dom$document$element$$default('html');
this.head = new simple$dom$document$element$$default('head');
this.body = new simple$dom$document$element$$default('body');
this.documentElement.appendChild(this.head);
this.documentElement.appendChild(this.body);

@@ -285,0 +293,0 @@ this.appendChild(this.documentElement);

@@ -11,3 +11,5 @@ import Node from './document/node';

this.documentElement = new Element('html');
this.head = new Element('head');
this.body = new Element('body');
this.documentElement.appendChild(this.head);
this.documentElement.appendChild(this.body);

@@ -14,0 +16,0 @@ this.appendChild(this.documentElement);

@@ -38,5 +38,11 @@ import Node from './node';

Element.prototype.setAttribute = function(_name, value) {
Element.prototype.setAttribute = function(_name, _value) {
var attributes = this.attributes;
var name = _name.toLowerCase();
var value;
if (typeof _value === 'string') {
value = _value;
} else {
value = '' + _value;
}
var attr;

@@ -43,0 +49,0 @@ for (var i=0, l=attributes.length; i<l; i++) {

2

package.json
{
"name": "simple-dom",
"version": "0.2.5",
"version": "0.2.6",
"description": "A simple JS DOM.",

@@ -5,0 +5,0 @@ "main": "dist/simple-dom.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc