Add $a as alias for querySelectorAll

This commit is contained in:
Florine W. Dekker 2021-11-14 11:03:39 +01:00
parent 7e289927de
commit 05177b4e39
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
3 changed files with 12 additions and 4 deletions

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,6 +1,6 @@
{
"name": "@fwdekker/template",
"version": "2.5.4",
"version": "2.5.5",
"description": "The base template for pages on fwdekker.com.",
"author": "F.W. Dekker",
"license": "MIT",
@ -34,8 +34,8 @@
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-focus": "^1.0.0",
"grunt-webpack": "^4.0.3",
"webpack": "^5.52.1",
"webpack-cli": "^4.8.0"
"grunt-webpack": "^5.0.0",
"webpack": "^5.64.0",
"webpack-cli": "^4.9.1"
}
}

View File

@ -17,6 +17,14 @@ const stringToHtml = function(string, query) {
*/
const $ = q => document.querySelector(q);
/**
* Alias for `document.querySelectorAll`.
*
* @param q {string} the query string
* @returns {NodeListOf<HTMLElement>} the elements identified by the query string
*/
const $a = q => document.querySelectorAll(q);
/**
* Runs the given function once the page is loaded.
*