{"id":15022332,"url":"https://github.com/georapbox/mutation-observer-element","last_synced_at":"2026-02-03T23:32:43.969Z","repository":{"id":57682364,"uuid":"489394032","full_name":"georapbox/mutation-observer-element","owner":"georapbox","description":"A custom element that offers a declarative interface to the MutationObserver API.","archived":false,"fork":false,"pushed_at":"2025-12-18T07:02:30.000Z","size":380,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-21T15:26:05.869Z","etag":null,"topics":["custom-elements","web-components"],"latest_commit_sha":null,"homepage":"https://georapbox.github.io/mutation-observer-element/","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/georapbox.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-06T14:55:22.000Z","updated_at":"2025-12-18T07:02:35.000Z","dependencies_parsed_at":"2024-09-21T12:00:59.251Z","dependency_job_id":"d4d97d7e-955d-4b24-ae31-9e286a51472a","html_url":"https://github.com/georapbox/mutation-observer-element","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"f376bbf276ee68b1d379b0f6719931c30d2c26e2"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/georapbox/mutation-observer-element","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Fmutation-observer-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Fmutation-observer-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Fmutation-observer-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Fmutation-observer-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georapbox","download_url":"https://codeload.github.com/georapbox/mutation-observer-element/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Fmutation-observer-element/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29061567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"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":["custom-elements","web-components"],"created_at":"2024-09-24T19:57:48.339Z","updated_at":"2026-02-03T23:32:43.952Z","avatar_url":"https://github.com/georapbox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://img.shields.io/npm/v/@georapbox/mutation-observer-element.svg)](https://www.npmjs.com/package/@georapbox/mutation-observer-element)\n[![npm license](https://img.shields.io/npm/l/@georapbox/mutation-observer-element.svg)](https://www.npmjs.com/package/@georapbox/mutation-observer-element)\n\n[demo]: https://georapbox.github.io/mutation-observer-element/\n[license]: https://github.com/georapbox/mutation-observer-element/blob/main/LICENSE\n[changelog]: https://github.com/georapbox/mutation-observer-element/blob/main/CHANGELOG.md\n\n# \u0026lt;mutation-observer\u0026gt;\n\nA custom element that offers a declarative interface to the [MutationObserver API](https://developer.mozilla.org/docs/Web/API/MutationObserver).\n\n[API documentation](#api) \u0026bull; [Demo][demo]\n\n## Install\n\n```sh\n$ npm install --save @georapbox/mutation-observer-element\n```\n\n## Usage\n\n### Script\n\n```js\nimport { MutationObserverElement } from './node_modules/@georapbox/mutation-observer-element/dist/mutation-observer.js';\n\n// Manually define the element.\nMutationObserverElement.defineCustomElement();\n```\n\nAlternatively, you can import the automatically defined custom element.\n\n```js\nimport './node_modules/@georapbox/mutation-observer-element/dist/mutation-observer-defined.js';\n```\n\n### Markup\n\n```html\n\u003cmutation-observer \n  attr=\"*\"\n  attr-old-value\n  char-data\n  char-data-old-value\n  child-list\n\u003e\n  \u003cbutton class=\"btn-primary\"\u003eClick to mutate me\u003c/button\u003e\n\u003c/mutation-observer\u003e\n```\n\n## API\n\n### Properties\n| Name | Reflects | Type | Default | Description |\n| ---- | -------- | ---- | ------- | ----------- |\n| `attr` | ✓ | String | `\"\"` | A space-separated string of attribute names to monitor (e.g., \"title class href\"). Use \"*\" to monitor all attributes. |\n| `attrOldValue`\u003cbr\u003e\u003csmall\u003e`attr-old-value`\u003c/small\u003e | ✓ | Boolean | `false` | Set to `true` to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes. |\n| `childList`\u003cbr\u003e\u003csmall\u003e`child-list`\u003c/small\u003e | ✓ | Boolean | `false` | Set to `true` to monitor the target node for the addition of new child nodes or removal of existing child nodes. |\n| `charData`\u003cbr\u003e\u003csmall\u003e`char-data`\u003c/small\u003e | ✓ | Boolean | `false` | Set to `true` to monitor the specified target node for changes to the character data contained within the node or nodes. |\n| `charDataOldValue`\u003cbr\u003e\u003csmall\u003e`char-data-old-value`\u003c/small\u003e | ✓ | Boolean | `false` | Set to `true` to record the previous value of a node's text whenever the text changes on nodes being monitored. |\n| `disabled` | ✓ | Boolean | `false` | Set to `true` to stop monitoring for mutations. |\n\n\u003e NOTE: From the properties above, at least one of `attr`, `child-list` or `char-data` must be present, otherwise, no changes are monitored and no mutation events are emitted.\n\n### Slots\n\n| Name | Description |\n| ---- | ----------- |\n| (default) | The default slot where the target node or nodes to be monitored are placed. |\n\n### Methods\n\n| Name | Type | Description | Arguments |\n| ---- | ---- | ----------- | --------- |\n| `defineCustomElement` | Static | Defines/registers the custom element with the name provided. If no name is provided, the default name is used. The method checks if the element is already defined, hence will skip trying to redefine it. | `elementName='mutation-observer'` |\n\n### Events\n\n| Name | Description | Event Detail |\n| ---- | ----------- | ------------ |\n| `mutation-observer:mutate` | Emitted when the element is mutated. | `{ mutationList: MutationRecord[]` |\n\n## Changelog\n\nFor API updates and breaking changes, check the [CHANGELOG][changelog].\n\n## Development setup\n\n### Prerequisites\n\nThe project requires `Node.js` and `npm` to be installed on your environment. Preferrably, use [nvm](https://github.com/nvm-sh/nvm) Node Version Manager and use the version of Node.js specified in the `.nvmrc` file by running `nvm use`.\n\n### Install dependencies\n\nInstall the project dependencies by running the following command.\n\n```sh\nnpm install\n```\n\n### Build for development\n\nWatch for changes and start a development server by running the following command.\n\n```sh\nnpm start\n```\n\n### Linting\n\nLint the code by running the following command.\n\n```sh\nnpm run lint\n```\n\n### Testing\n\nRun the tests by running any of the following commands.\n\n```sh\nnpm test\nnpm run test:watch # watch mode\n```\n\n### Build for production\n\nCreate a production build by running the following command.\n\n```sh\nnpm run build\n```\n\n## License\n\n[The MIT License (MIT)][license]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorapbox%2Fmutation-observer-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorapbox%2Fmutation-observer-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorapbox%2Fmutation-observer-element/lists"}