mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 03:33:43 +08:00
dd3ed27930
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;
|
|
}
|