-
Notifications
You must be signed in to change notification settings - Fork 0
HTML & DOM
Brandon Jordan edited this page Sep 7, 2025
·
9 revisions
createElement(...elements);Creates and returns an HTML element. Appends elements to the created element.
createElement(
createElement(),
);It can also contain objects for the configuration of the element, either containing attributes or properties.
createElement({tag: "button"}, text("Button Text"));Shorthand creates an HTML text node.
text(string);Remove any script tags from an HTML string.
sanitizeHTML("<script>console.log(\"hacked!\");</script>")Returns an HTMLElement containing unescaped and sanitized HTML (script tags removed).
unescapeHTML("<script>console.log(\"hacked!\");</script><div>Just some HTML code. :-)</div>");Get the element tag name in lowercase.
tagName(element);Check if an element accepts text input.
inputTag(element);Generate a selector for an element based on ID and class.
getSelector(element);Create an image element that will lazy load the image when appended. attrs is passed to an element() function.
lazyImage(src, attrs = {});