Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mithril-node-render

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mithril-node-render - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

README.md

11

index.js
'use strict';
var VOID_TAGS = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr',
'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
function isArray(thing) {

@@ -13,4 +16,4 @@ return Object.prototype.toString.call(thing) === '[object Array]';

function createAttrString(attrs) {
if (!Object.keys(attrs).length) {
return;
if (!attrs || !Object.keys(attrs).length) {
return '';
}

@@ -65,4 +68,4 @@

var children = createChildrenContent(view);
if (!children) {
return ['<', view.tag, createAttrString(view.attrs), ' />'].join('');
if (!children && VOID_TAGS.indexOf(view.tag) >= 0) {
return '<' + view.tag + createAttrString(view.attrs) + '>';
}

@@ -69,0 +72,0 @@ return [

{
"name": "mithril-node-render",
"version": "0.1.3",
"version": "0.1.4",
"description": "Node rending of mithril views",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,14 +14,14 @@ 'use strict';

'<div id="bar">content</div>', 'should render id');
t.equal(render(m('br')), '<br />', 'should render short nodes when no children');
t.equal(render(m('br')), '<br>', 'should render short nodes when no children');
t.equal(render(m('span', {
'data-foo': 'bar',
selected: 'selected'
})), '<span data-foo="bar" selected="selected" />', 'should render attributes');
})), '<span data-foo="bar" selected="selected"></span>', 'should render attributes');
t.equal(render(m('ul', 'huhu')), '<ul>huhu</ul>', 'should render string');
t.equal(render([m('span', 'foo'), m('div', 'bar')]),
'<span>foo</span><div>bar</div>', 'should render arrays');
t.equal(render(m('span', m('div'))), '<span><div /></span>', 'should render children');
t.equal(render(m('span', m('div'))), '<span><div></div></span>', 'should render children');
t.equal(render(m('span', {
onmousemove: function(event) {}
})), '<span />', 'should not render events');
})), '<span></span>', 'should not render events');
t.equal(render(m('span', {

@@ -32,4 +32,4 @@ style: {

}
})), '<span style="padding-left:10px;color:red" />', 'should render children');
})), '<span style="padding-left:10px;color:red"></span>', 'should render children');
t.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