Docs
Internals
stringToDOM()
⚠️

This function is part of the internal API. You should only be using this if you are making your own framework.


stringToDOM()

Syntax: stringToDOM(content, svg)
Example: stringToDOM('<div>Hello World</div>')

The stringToDOM function takes a string of HTML or SVG and returns a DOM object. This is useful for creating DOM elements from strings.

import { stringToDOM } from 'million';
 
const dom = stringToDOM('<div>Hello World</div>');
 
dom.innerHTML; // 'Hello World'
dom.tagName; // 'DIV'
 
const svg = stringToDOM('<g><rect /></g>'); // creates SVG!