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

el-component

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

el-component - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

4

component.json

@@ -5,3 +5,3 @@ {

"description": "creates HTML from jade like expressions",
"version": "0.0.1",
"version": "0.1.0",
"keywords": [],

@@ -15,2 +15,2 @@ "dependencies": {},

]
}
}
module.exports = el;
// see: http://www.w3.org/html/wg/drafts/html/master/single-page.html#void-elements
var voids = [
'area', 'base', 'br', 'col', 'embed',
'hr', 'img', 'input', 'keygen', 'link',
'menuitem', 'meta', 'param', 'source', 'track', 'wbr'
];
function el(tag, content, attrs) {
var attrStr, classes, ids;
var attrStr, classes, ids, text;

@@ -36,11 +42,17 @@ if (typeof content !== 'string') {

return ['<',
text = ['<',
tag,
attrStr ? ' ' + attrStr : '',
'>',
content,
'</',
tag,
'>'
].join('');
];
if(voids.indexOf(tag) < 0) {
text = text.concat([
content,
'</',
tag,
'>'
]);
}
return text.join('');
}
{
"name": "el-component",
"version": "0.0.0",
"version": "0.1.0",
"description": "create HTML from jade-like expressions",

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

@@ -29,2 +29,8 @@ var el = require('..');

});
it('should treat void elements differently from non void elements', function() {
el('img', { src: 'http://example.com/img.png' }).should.eql('<img src="http://example.com/img.png">');
el('iframe', { src: 'http://example.com' }).should.eql('<iframe src="http://example.com"></iframe>');
});
});
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