{"id":21118473,"url":"https://github.com/dangeredwolf/nquery","last_synced_at":"2025-03-14T11:10:55.054Z","repository":{"id":42932943,"uuid":"234110440","full_name":"dangeredwolf/nQuery","owner":"dangeredwolf","description":"A small, modular alternative to jQuery","archived":false,"fork":false,"pushed_at":"2023-01-06T02:31:35.000Z","size":386,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T05:09:42.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dangeredwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-01-15T15:26:47.000Z","updated_at":"2022-08-05T06:53:14.000Z","dependencies_parsed_at":"2023-02-05T03:16:52.740Z","dependency_job_id":null,"html_url":"https://github.com/dangeredwolf/nQuery","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangeredwolf%2FnQuery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangeredwolf%2FnQuery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangeredwolf%2FnQuery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangeredwolf%2FnQuery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dangeredwolf","download_url":"https://codeload.github.com/dangeredwolf/nQuery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243565415,"owners_count":20311704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-20T03:00:11.351Z","updated_at":"2025-03-14T11:10:55.025Z","avatar_url":"https://github.com/dangeredwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nQuery [![Build Status](https://travis-ci.com/dangeredwolf/nQuery.svg?branch=master)](https://travis-ci.com/dangeredwolf/nQuery) [![devDependencies Status](https://david-dm.org/dangeredwolf/nQuery/dev-status.svg)](https://david-dm.org/dangeredwolf/nQuery?type=dev)\n\nA small, modular, fast alternative to jQuery.\n\nnQuery is currently in **Alpha**. It is therefore not recommended that you use nQuery in production yet.\n\n### N stands for Nano\n\nAt less than 10 KB minified, it's way smaller than jQuery 3.4.1's 87 KB size. It makes nQuery viable even for simple webpages.\n\n### N stands for Nitro\n\nnQuery is fast, and was designed from the beginning to offer simple, jQuery-compatible calls, but cutting out overhead and getting you closer to the raw attributes, functions, and events the browser already provides for you. \n\n`test/test.html` provides a few simple performance tests which you can run and verify for yourself.\n\nWe ran these tests using nQuery 0.2.0 in Chrome 79\n\n------\n\nAdd/Remove Class (Queries and (Chained) Function Calls):\n\n* **jQuery 3.4.1 - 13.7±0.5 ns avg**\n* **nQuery 0.2.0 - 6.2±0.1 ns avg**\n* **Raw JS (querySelector/classList) - 5.5±0.1 ns avg**\n\nHaving nearly double the overall performance is great in larger applications.\n\n------\n\nAdd/Remove Class (Function Calls):\n\n* **jQuery 3.4.1 - 11.7±0.3 ns avg**\n* **nQuery 0.2.0 - 4.8±0.1 ns avg**\n* **Raw JS (querySelector/classList) - 4.9±0.05 ns avg**\n\nWhat's really impressive is that nQuery was able to beat plain javascript by 0.1 ns, something that came up even over multiple test runs.\n\n------\n\nQuery Calls:\n\n* **jQuery 3.4.1 - 1.8±0.1 ns avg**\n* **nQuery 0.2.0 - 1.3±0.1 ns avg**\n* **Raw JS - 0.6±0.05 ns avg**\n\n------\n\n### nQuery is familiar to jQuery users\n\nExample code:\n```\n$(document).ready(() =\u003e {\n\n    console.log(\"Hello world! The document is ready.\");\n    \n    $(\"button\").click(() =\u003e {\n        console.log(\"You clicked the button!\");\n        $(\"button\").first().addClass(\"clicked\").removeClass(\"notclicked\");\n    });\n    \n});\n```\n\nnQuery can act as a drop-in replacement for jQuery in simple applications.\n\n### nQuery is designed for modern browsers\n\nnQuery is built with modern browser features in mind.\n\nnQuery requires a JavaScript engine that supports ECMAScript 2015 features. (Arrow functions, classes).\n\n### nQuery is free and open source software\n\nnQuery is released under the permissive [MIT license](https://github.com/dangeredwolf/nQuery/blob/master/LICENSE).\n\n### Supported browsers\n\nIf there's a compatibility issue with one of these browsers, please report the issue so we can fix it.\n\n* Chrome 60+ \n* Microsoft Edge 15+\n* Firefox 55+\n* Opera 47+\n* Safari 10+\n* iOS 10+\n\nEffective 2020-09-12 (version 0.4.0), Internet Explorer is not supported in any way.\n\n### Building / Testing\n\nnQuery is built using [Node.js](https://nodejs.org/en/). A recent Current or LTS version should work fine.\n\nnQuery does not have runtime dependencies, only dev dependencies.\n\nBuild using `npm run build` or `npm start` (generates `nquery.js` and `nquery.min.js` file)\n\n---------------------\n\nWe have a dedicated test sandbox which also contains the benchmarks at `test/test.html`.\n\nNote: This is set up by default to use the uncompressed, development version of nQuery.\n\n### Selective builds\n\nIf you only need certain functions, any non-core function can be removed, and you can add your own using the primary function tree or with `nQuery.fn.extend` (work in progress, not fully functional).\n\n`src/modules.js` is where the module index is stored. You can make your modifications here.\n\n```\nimport append from \"./element/append.mjs\";\nm.push(append);\n```\n\nEach entry looks something like this.\n\n* `m` is the module list for Element objects\n* `m_window` is the module list for Window objects\n* `m_document` is the module list for Document objects\n\nIf a function works in more than one place, for example, the scroll event (works on elements or window), you can push it to multiple arrays.\n\n```\nlet scroll = (...args) =\u003e eventHandler(\"scroll\", ...args);\nm.push(scroll);\nm_window.push(scroll); // you can push to both!\n```\n\n### Global variables\n\n**`window.nQuery`**\n\nnQuery accessor. Always set.\n\n**`window.$`**\n\nnQuery accessor shorthand. Set by default.\n\n**`window.jQuery`**\n\nnQuery accessor. Optional; useful if you have code that accessed jQuery using `window.jQuery` and you're switching to nQuery.\n\n**`window.nQueryObject`**\n\nThe root nQuery object so your code can compare whether something is an `instanceof nQueryObject`. You should not access this alone, as it's a superclass without methods.\n\n**`window.nQueryDocument`**\n**`window.nQueryElement`**\n**`window.nQueryWindow`**\n\nExtended classes of the `nQueryObject`, but these are the objects that correspond with what functions it support. `$(\"p\")` is an instance of `nQueryObject` and `nQueryElement` but NOT `nQueryWindow`, as an example.\n\nCreating new objects with these alone is possible, but not recommended. `window.$`/`window.nQuery` will always create the correct object given the input.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdangeredwolf%2Fnquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdangeredwolf%2Fnquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdangeredwolf%2Fnquery/lists"}