{"id":16483714,"url":"https://github.com/pie6k/jquery.initialize","last_synced_at":"2025-12-12T04:46:17.665Z","repository":{"id":26813795,"uuid":"30272380","full_name":"pie6k/jquery.initialize","owner":"pie6k","description":"jQuery plugin for dynamically created elements initialization","archived":false,"fork":false,"pushed_at":"2023-06-23T17:32:17.000Z","size":72,"stargazers_count":162,"open_issues_count":3,"forks_count":42,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T08:04:50.224Z","etag":null,"topics":["ajax","html","javascript","jquery","mutationobserver"],"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/pie6k.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,"governance":null}},"created_at":"2015-02-04T00:24:30.000Z","updated_at":"2024-05-31T17:00:44.000Z","dependencies_parsed_at":"2023-02-16T17:31:43.607Z","dependency_job_id":"c5efae7d-a146-418c-a3b1-4593efb712d6","html_url":"https://github.com/pie6k/jquery.initialize","commit_stats":{"total_commits":70,"total_committers":11,"mean_commits":6.363636363636363,"dds":0.6714285714285715,"last_synced_commit":"c342d4d61d1617f3cce09c8c1feb47c07c208314"},"previous_names":["pietrasiak/jquery.initialize"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pie6k%2Fjquery.initialize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pie6k%2Fjquery.initialize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pie6k%2Fjquery.initialize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pie6k%2Fjquery.initialize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pie6k","download_url":"https://codeload.github.com/pie6k/jquery.initialize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"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":["ajax","html","javascript","jquery","mutationobserver"],"created_at":"2024-10-11T13:14:48.606Z","updated_at":"2025-12-12T04:46:17.620Z","avatar_url":"https://github.com/pie6k.png","language":"JavaScript","readme":"**Note from author (pie6k). I've created this lib few years ago and it was nice\nback then. Now you should probably not be using jQuery for things like that and\ngo with [React](https://react.dev/) or something similar. Thank you.**\n—*2018-11-21*\n\nBug reports are still accepted.\n\n# jQuery.initialize\n\n**`jQuery.initialize`** plugin is created to help maintain dynamically created\nelements on the page.\n\n## Synopsis\n\njQuery.initialize will iterate over each element that matches the selector and\napply the callback function. It will then listen for any changes to the\n[Document Object Model](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model)\nand apply the callback function to any new elements inserted into to the\ndocument that match the original selector.\n\n    $.initialize([selector], [callback]);\n\nThis allows developers to define an initialisation callback that is applied\nwhenever a new element matching the selector is inserted into the DOM. It works\nfor elements loaded via AJAX also.\n\nSimple demo - [click here](https://pie6k.github.io/jquery.initialize/test.html)\n\n## Example of use\n  \n    $.initialize(\".some-element\", function() {\n        $(this).css(\"color\", \"blue\");\n    });\n\t\nBut now if new element matching `.some-element` selector will appear on page,\nit will be instantly initialised. The way new item is added is not important,\nyou do not need to care about any callbacks etc.\n  \n    $(\"\u003cdiv/\u003e\").addClass(\"some-element\").appendTo(\"body\"); //new element will have blue color!\n\n### Unobserving\n\nTo cease observation of the document, you may disconnect the observer by\ncalling `disconnect()` on the returned\n[`MutationObserver`](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)\ninstance which stops it from receiving further notifications until and unless\n`observe()` is called again.  . E.g.,\n\n    var obs = $.initialize([selector], [callback]); // Returns MutationObserver\n    obs.disconnect();\n\n## Options\n\n### `target`\n\nBy default, the entire document is observed for changes. This may result in\npoor performance. A specific node in the DOM can be observed by specifying a\ntarget:\n\n    $.initialize(\".some-element\", function() {\n        $(this).css(\"color\", \"blue\");\n    }, { target: document.getElementById('observe-this-element') });\n    \nOtherwise, target will default to `document.documentElement`.\n\n### `observer`\n\nA custom\n[`MutationObserverInit`](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#MutationObserverInit)\nmay be provided. If not provided, it will default to internal configuration.\n\n## Browser Compatibility\n\nPlugin is based on **`MutationObserver`**. It will works on IE9+ (**read note\nbelow**) and every modern browser.\n\nNote: To make it work on IE9 and IE10 you'll need to add MutationObserver\npolyfill - like ones here: \u003chttps://github.com/webcomponents/webcomponentsjs\u003e\n\n-----------------\n[Performance test](https://jsfiddle.net/x8vtfxtb/5/) (thanks to **@bezborodow** and **@liuhongbo**)\n\n## Todo\n\n - make it `bower` and `npm` compatible, add advanced performance test.\n\n## Contributors\n- [Adam Pietrasiak](https://github.com/pie6k)\n- [Damien Bezborodov](https://github.com/bezborodow)\n- [Michael Hulse](https://github.com/mhulse)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpie6k%2Fjquery.initialize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpie6k%2Fjquery.initialize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpie6k%2Fjquery.initialize/lists"}