{"id":18780286,"url":"https://github.com/jlmakes/tealight","last_synced_at":"2026-04-01T21:50:26.944Z","repository":{"id":57745321,"uuid":"110866432","full_name":"jlmakes/tealight","owner":"jlmakes","description":"DOM queries that always return an array.","archived":false,"fork":false,"pushed_at":"2021-01-01T04:10:58.000Z","size":46,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-27T23:42:00.723Z","etag":null,"topics":["dom-library","query"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jlmakes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-15T17:44:12.000Z","updated_at":"2024-02-21T13:55:57.000Z","dependencies_parsed_at":"2022-08-30T12:31:14.848Z","dependency_job_id":null,"html_url":"https://github.com/jlmakes/tealight","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/jlmakes/tealight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlmakes%2Ftealight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlmakes%2Ftealight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlmakes%2Ftealight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlmakes%2Ftealight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlmakes","download_url":"https://codeload.github.com/jlmakes/tealight/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlmakes%2Ftealight/sbom","scorecard":{"id":523509,"data":{"date":"2025-08-11","repo":{"name":"github.com/jlmakes/tealight","commit":"84a026f88e768ca59c90d52f00ecb45c314e438b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T03:41:47.832Z","repository_id":57745321,"created_at":"2025-08-20T03:41:47.832Z","updated_at":"2025-08-20T03:41:47.832Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom-library","query"],"created_at":"2024-11-07T20:25:38.056Z","updated_at":"2026-04-01T21:50:26.924Z","avatar_url":"https://github.com/jlmakes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://jlmakes.com/logos/svg/tealight.svg\" alt=\"Flaming tea light\" width=\"120px\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://jlmakes.com/logos/svg/tealight-logotype.svg\" alt=\"Tealight\" width=\"130px\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eDOM queries that always return an array.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://travis-ci.org/jlmakes/tealight\"\u003e\u003cimg src=\"https://img.shields.io/travis/jlmakes/tealight.svg\" alt=\"Build status\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://coveralls.io/github/jlmakes/tealight\"\u003e\u003cimg src=\"https://img.shields.io/coveralls/jlmakes/tealight.svg\" alt=\"Coverage\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/tealight\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/tealight.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/jlmakes/tealight/blob/master/src/index.js\"\u003e\u003cimg src=\"https://img.shields.io/badge/min+gzip-0.4KB-blue.svg\" alt=\"0.4KB min+gzip\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/jlmakes/tealight/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"MIT License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://saucelabs.com/u/tealight\"\u003e\n\t\t\u003cimg src=\"https://saucelabs.com/browser-matrix/tealight.svg\" alt=\"Browser compatibility matrix\" width=\"100%\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n## Introduction\n\nModern browsers enable us to perform DOM queries natively, e.g:\n\n```js\nlet cookies = document.querySelectorAll(\".cookie\");\n```\n\nBut we all want to loop over the returned elements. So in practice, we’ve got to do a little more work, particularly converting the resulting `NodeList` to an array, e.g:\n\n```js\nlet cookies;\ntry {\n  let query = document.querySelectorAll(\".cookie\");\n  cookies = Array.prototype.slice.call(query);\n} catch (err) {\n  console.error(err.message);\n}\n\ncookies.forEach(cookie =\u003e {\n  // ...\n});\n```\n\n**Tealight** provides a familiar API to perform native queries, without the extra work.\n\n```js\ntealight(\".cookie\").forEach(cookie =\u003e {\n  // ...\n});\n```\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n## Installation\n\n### Browser\n\nA simple and fast way to get started is to include this script on your page:\n\n```html\n\u003cscript src=\"https://unpkg.com/tealight\"\u003e\u003c/script\u003e\n```\n\nThis will create the global variable `tealight`.\n\n### Module\n\n```bash\n$ npm install tealight\n```\n\n#### CommonJS\n\n```js\nconst tealight = require(\"tealight\");\n```\n\n#### ES2015\n\n```js\nimport tealight from \"tealight\";\n```\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n## Usage\n\n`tealight` accepts a single argument `target` and will **always return an array of 0 or more DOM nodes**.\n\nFor the examples below, we will query against this HTML fragment:\n\n```html\n\u003cdiv id=\"jar\"\u003e\n  \u003cdiv class=\"chocolate-chip cookie\"\u003e\u003c/div\u003e\n  \u003cdiv class=\"peanut-butter cookie\"\u003e\u003c/div\u003e\n  \u003cdiv class=\"short-bread cookie\"\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\n\u003cbr\u003e\n\n### `tealight(target: string): Array\u003cHTMLElement\u003e`\n\n`string` targets will be used as CSS selectors.\n\n```js\ntealight(\"#jar\");\n// =\u003e [ \u003cdiv#jar\u003e ]\n```\n\n```js\ntealight(\".cookie\");\n// =\u003e [ \u003cdiv.chocolate-chip.cookie\u003e, \u003cdiv.peanut-butter.cookie\u003e, \u003cdiv.short-bread.cookie\u003e ]\n```\n\n\u003cbr\u003e\n\n### `tealight(target: HTMLElement): Array\u003cHTMLElement\u003e`\n\n`HTMLElement` targets will simply be wrapped in an `Array`\n\n```js\nconst node = document.querySelector(\"#jar\");\n\ntealight(node);\n// =\u003e [ \u003cdiv#jar\u003e ]\n```\n\n\u003cbr\u003e\n\n### `tealight(target: HTMLCollection) : Array\u003cHTMLElement\u003e`\n\n`HTMLCollection` arguments will be converted to `Array`.\n\n```js\nconst nodeList = document.querySelectorAll(\".cookie\");\n\ntealight(nodeList);\n// =\u003e [ \u003cdiv.chocolate-chip.cookie\u003e, \u003cdiv.peanut-butter.cookie\u003e, \u003cdiv.short-bread.cookie\u003e ]\n```\n\n\u003cbr\u003e\n\n### `tealight(target: Array\u003cany\u003e): Array\u003cHTMLElement\u003e`\n\n`Array` targets will be filtered, leaving only `HTMLElement`\n\n```js\nlet node = document.querySelector(\"#jar\");\nlet array = [node, null, \".cookie\"];\n\ntealight(array);\n// =\u003e [ \u003cdiv#jar\u003e ]\n```\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n---\n\nCopyright 2020 Julian Lloyd\n\u003cbr\u003e\nOpen source under the [MIT License](https://github.com/jlmakes/tealight/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlmakes%2Ftealight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlmakes%2Ftealight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlmakes%2Ftealight/lists"}