wrapper for the "getElement" and "querySelector" methods. Return the element or an error.
Add the $base parameter for query and queryAll.
Todo: Create tests and update the documentation.
npm install @8area8/domstrict --savevar get = require("@8area8/domstrict");
var $element = get.id("foo");- Returns an HTMLElement OR throws an Error.import Get from "@8area8/domstrict";
const $element = Get.queryAll(".bar");- Returns an Array<Element> OR throws an Error.class Get {
static id(idName: string): HTMLElement;
static class(idName: string): Element[];
static query(selector: string): Element;
static queryAll(selector: string): Element[];
}/** Get an element by Id. Return the element or throw an Error. */
static id(idName: string): HTMLElement;/** Get elements by class. Return an array or throw an Error. */
static class(className: string): Element[]/** Get an element by query selector. Return the element or throw an Error. */
static query(selector: string): Element/** Get an element by query selector. Return an array or throw an Error. */
static queryAll(selector: string): Element[]npm run test