Skip to content

Commit

Permalink
Update: HUI.js v2.0 @StevenBlack
Browse files Browse the repository at this point in the history
  • Loading branch information
devhammed committed Jan 1, 2018
1 parent 276053f commit 9d8e8c6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions HUI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** HUI.js | JavaScript UI Layout Library
* @author Oyedele Hammed Horlah
* @version 2.0
* @since January 1, 2017
* @see http://www.oyedelehammed.ml/HUI.html
*/

function hui( tag, attrs ) {
var children = [].slice.call( arguments, 2 ),
d = document;
var node = d.createElement( tag );
if ( attrs ) {
for ( var attr in attrs ) node.setAttribute( attr, attrs[attr] );
}
if ( children ) {
children.forEach(function( child ) {
node.appendChild(
(typeof child == 'string') ? d.createTextNode( child ) : child
);
});
}
return node;
}
function huiRender( node, view ) {
document.querySelector(view).appendChild( node );
}

0 comments on commit 9d8e8c6

Please sign in to comment.