{"id":20514164,"url":"https://github.com/webreflection/domcontentloaded","last_synced_at":"2025-04-14T00:05:45.424Z","repository":{"id":14300601,"uuid":"17009216","full_name":"WebReflection/DOMContentLoaded","owner":"WebReflection","description":"fixing the (in)famous event that does not trigger once \"loaded\"","archived":false,"fork":false,"pushed_at":"2014-07-10T17:18:43.000Z","size":249,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-24T03:11:53.697Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-20T04:35:49.000Z","updated_at":"2024-11-19T08:23:24.000Z","dependencies_parsed_at":"2022-07-15T15:17:36.058Z","dependency_job_id":null,"html_url":"https://github.com/WebReflection/DOMContentLoaded","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2FDOMContentLoaded","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2FDOMContentLoaded/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2FDOMContentLoaded/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2FDOMContentLoaded/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/DOMContentLoaded/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232004131,"owners_count":18458907,"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-15T21:15:03.566Z","updated_at":"2024-12-31T15:32:10.305Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"DOMContentLoaded\n================\n\nfixing the (in)famous event that does not trigger once \"loaded\".\n\nPlease [read the post](http://webreflection.blogspot.com/2014/02/the-underestimated-problem-about-script.html) to know more about issues you might have relying this event.\n\n### How To\nSimply include [the inline version of the script](./dcl.js) on top of any of your HTML pages (few extra bytes, really nothing to worry about) and stop worrying about not being initialized once the **DOM Content** ... has been **Loaded** !!!\n\nCan you believe it ?\n\n### Content Security Policy\nIf you are under this restriction, here the deprecated `sha1` version of [the script](./dcl.js): `sha1-//cbZaIlYySeh0GGSwpZKzOAkvg=`\n\nWhile if you are targeting modern browsers, here the `sha256` version: `sha256-XpSHSiwcWV9TTNd43i/nMFtZA8u8gQVfVXEy6Wa68a0=`\n\nThese digests have been tested without problems via server side headers, as well as meta tag:\n```html\n\u003cmeta\n  http-equiv=\"Content-Security-Policy\"\n  content=\"script-src 'unsafe-inline' 'self' 'sha1-//cbZaIlYySeh0GGSwpZKzOAkvg=' 'sha256-XpSHSiwcWV9TTNd43i/nMFtZA8u8gQVfVXEy6Wa68a0='\"\n\u003e\n```\n\nBear in mind you must specify `'unsafe-inline'` in addition to `'self'` for backward compatibility.\n\n\n### Example\nJust try to write something like:\n```javascript\ndocument.addEventListener('DOMContentLoaded', function (e) {\n  alert([e.type, e.currentTarget === document]);\n});\n```\nin [this page console](http://webreflection.github.io/DOMContentLoaded/example.html) and you should have your _always notified_ `DOMContentLoaded` event.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fdomcontentloaded","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fdomcontentloaded","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fdomcontentloaded/lists"}