src/view.js
function (htmlString, returnAll) {
				if (RUNTIME_CHECKS) {
					if (typeof htmlString !== 'string') {
						throw '"htmlString" argument must be a string';
					}
					if (arguments.length > 1 && typeof returnAll !== 'boolean') {
						throw '"returnAll" argument must be a boolean value';
					}
				}

				HTML_PARSER_EL.innerHTML = htmlString;

				if (RUNTIME_CHECKS && !returnAll && HTML_PARSER_EL.children.length > 1) {
					throw 'The parsed HTML contains more than one root element.' +
						'Specify returnAll = true to return all of them';
				}

				var ret = returnAll ? HTML_PARSER_EL.children : HTML_PARSER_EL.firstChild;
				while (HTML_PARSER_EL.firstChild) {
					HTML_PARSER_EL.removeChild(HTML_PARSER_EL.firstChild);
				}
				return ret;
			}
function (htmlString, returnAll) {
				if (RUNTIME_CHECKS) {
					if (typeof htmlString !== 'string') {
						throw '"htmlString" argument must be a string';
					}
					if (arguments.length > 1 && typeof returnAll !== 'boolean') {
						throw '"returnAll" argument must be a boolean value';
					}
				}

				HTML_PARSER_EL.innerHTML = htmlString;

				if (RUNTIME_CHECKS && !returnAll && HTML_PARSER_EL.children.length > 1) {
					throw 'The parsed HTML contains more than one root element.' +
						'Specify returnAll = true to return all of them';
				}

				var ret = returnAll ? HTML_PARSER_EL.children : HTML_PARSER_EL.firstChild;
				while (HTML_PARSER_EL.firstChild) {
					HTML_PARSER_EL.removeChild(HTML_PARSER_EL.firstChild);
				}
				return ret;
			}
function ( htmlString , returnAll ) { if ( RUNTIME_CHECKS ) { if ( typeof htmlString !== 'string' ) { throw '"htmlString" argument must be a string' ; } if ( arguments . length > 1 && typeof returnAll !== 'boolean' ) { throw '"returnAll" argument must be a boolean value' ; } } HTML_PARSER_EL . innerHTML = htmlString ; if ( RUNTIME_CHECKS && ! returnAll && HTML_PARSER_EL . children . length > 1 ) { throw 'The parsed HTML contains more than one root element.' + 'Specify returnAll = true to return all of them' ; } var ret = returnAll ? HTML_PARSER_EL . children : HTML_PARSER_EL . firstChild ; while ( HTML_PARSER_EL . firstChild ) { HTML_PARSER_EL . removeChild ( HTML_PARSER_EL . firstChild ) ; } return ret ; }
Helper function that parses an HTML string into an HTMLElement hierarchy and returns the first element in the NodeList, unless the returnAll flag is true, in which case the whole node list is returned.
@instance
@arg {string} htmlString - The string to be parsed
@arg {boolean} returnAll - If true will return all top level elements
Helper function that parses an HTML string into an HTMLElement hierarchy and returns the first element in the NodeList unless the returnAll flag is true in which case the whole node list is returned .