All files / src/internal/client/dom reconciler.js

100% Statements 25/25
100% Branches 7/7
100% Functions 2/2
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 252x 2x 2x 2x 2303x 2303x 2303x 2303x 2x 2x 2x 2x 2x 11816x 6113x 35004x 35004x 24000x 24000x 35004x 11816x 4283x 4283x 11816x  
import { is_array } from '../utils.js';
 
/** @param {string} html */
export function create_fragment_from_html(html) {
	var elem = document.createElement('template');
	elem.innerHTML = html;
	return elem.content;
}
 
/**
 * @param {import('#client').Dom} current
 */
export function remove(current) {
	if (is_array(current)) {
		for (var i = 0; i < current.length; i++) {
			var node = current[i];
			if (node.isConnected) {
				node.remove();
			}
		}
	} else if (current.isConnected) {
		current.remove();
	}
}