Skip to content

Commit 9d8e8c6

Browse files
committed
Update: HUI.js v2.0 @StevenBlack
1 parent 276053f commit 9d8e8c6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

HUI.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/** HUI.js | JavaScript UI Layout Library
2+
* @author Oyedele Hammed Horlah
3+
* @version 2.0
4+
* @since January 1, 2017
5+
* @see http://www.oyedelehammed.ml/HUI.html
6+
*/
7+
8+
function hui( tag, attrs ) {
9+
var children = [].slice.call( arguments, 2 ),
10+
d = document;
11+
var node = d.createElement( tag );
12+
if ( attrs ) {
13+
for ( var attr in attrs ) node.setAttribute( attr, attrs[attr] );
14+
}
15+
if ( children ) {
16+
children.forEach(function( child ) {
17+
node.appendChild(
18+
(typeof child == 'string') ? d.createTextNode( child ) : child
19+
);
20+
});
21+
}
22+
return node;
23+
}
24+
function huiRender( node, view ) {
25+
document.querySelector(view).appendChild( node );
26+
}

0 commit comments

Comments
 (0)