mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 05:43:56 +08:00

Previously only `<div>one top element</div>` was allowed because we use `firstChild` instead of `children`. We also want `<div>one</div><div>two</div>` to work with this method.
7 lines
198 B
JavaScript
7 lines
198 B
JavaScript
export default function domFromString(string) {
|
|
const template = document.createElement("template");
|
|
string = string.trim();
|
|
template.innerHTML = string;
|
|
return template.content.children;
|
|
}
|