0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Create element with innerHTML

This commit is contained in:
Allen Heavey 2015-03-03 17:54:00 +08:00
parent 5865eb032a
commit 2a3ab88cde
3 changed files with 10 additions and 2 deletions

View file

@ -277,9 +277,13 @@ function createElement ( doc, tag, props, children ) {
} }
} }
if ( children ) { if ( children ) {
if (Array.isArray(children)) {
for ( i = 0, l = children.length; i < l; i += 1 ) { for ( i = 0, l = children.length; i < l; i += 1 ) {
el.appendChild( children[i] ); el.appendChild( children[i] );
} }
} else if (typeof children === 'string') {
el.innerHTML = children;
}
} }
return el; return el;
} }

File diff suppressed because one or more lines are too long

View file

@ -146,9 +146,13 @@ function createElement ( doc, tag, props, children ) {
} }
} }
if ( children ) { if ( children ) {
if (Array.isArray(children)) {
for ( i = 0, l = children.length; i < l; i += 1 ) { for ( i = 0, l = children.length; i < l; i += 1 ) {
el.appendChild( children[i] ); el.appendChild( children[i] );
} }
} else if (typeof children === 'string') {
el.innerHTML = children;
}
} }
return el; return el;
} }