{"id":51110783,"url":"https://github.com/bramus/scrollparent-polyfill","last_synced_at":"2026-06-24T17:30:51.426Z","repository":{"id":361170932,"uuid":"1253364381","full_name":"bramus/scrollparent-polyfill","owner":"bramus","description":"Polyfill for `Element.scrollParent()`","archived":false,"fork":false,"pushed_at":"2026-05-29T12:02:43.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T14:04:25.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/bramus.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"bramus","-custom":["https://www.paypal.me/bramus","https://www.bram.us/"]}},"created_at":"2026-05-29T11:41:18.000Z","updated_at":"2026-05-29T12:02:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bramus/scrollparent-polyfill","commit_stats":null,"previous_names":["bramus/scrollparent-polyfill"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bramus/scrollparent-polyfill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fscrollparent-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fscrollparent-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fscrollparent-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fscrollparent-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramus","download_url":"https://codeload.github.com/bramus/scrollparent-polyfill/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fscrollparent-polyfill/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34743465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-24T17:30:50.420Z","updated_at":"2026-06-24T17:30:51.418Z","avatar_url":"https://github.com/bramus.png","language":"TypeScript","funding_links":["https://github.com/sponsors/bramus","https://www.paypal.me/bramus","https://www.bram.us/"],"categories":[],"sub_categories":[],"readme":"# `Element.scrollParent()` polyfill\n\nA lightweight JavaScript polyfill for `Element.scrollParent()`, modeled after the standard behavior of scroll container resolution in the CSSOM View and CSS Overflow specifications.\n\nIt utilizes `get-containing-block` to correctly resolve the scroll parent for absolutely and fixed-positioned elements, skipping static ancestor containers that do not clip them.\n\n## Features\n\n- **Specification-Compliant Resolution**: Resolves standard scroll containers accurately by checking computed `overflow-x` and `overflow-y` styles (`auto`, `scroll`, `hidden`).\n- **Absolute \u0026 Fixed Support**: Correctly skips non-containing blocks for absolute and fixed positioned elements to find their true scrolling ancestor.\n- **CSS Overflow Propagation**: Accounts for UA-specific overflow propagation from the `\u003cbody\u003e` and `\u003chtml\u003e` elements to the viewport.\n- **Prototype Polyfill**: Automatically polyfills `Element.prototype.scrollParent()`.\n- **Flexible API**: Can be used as an imported standalone utility or called directly on DOM element prototypes.\n- **Fully Typed**: Written in TypeScript with standard types exported.\n- **ESM Support**: Built as an ES Module.\n\n## Installation\n\n```bash\nnpm install scrollparent-polyfill\n```\n\n## Usage\n\n### 1. As a Polyfill\n\nSimply import the package to automatically install the method on `Element.prototype`:\n\n```javascript\nimport 'scrollparent-polyfill';\n\nconst element = document.querySelector('.my-child-element');\n\n// Call standard camelCase method\nconst scrollParent = element.scrollParent();\n\nconsole.log('Scroll parent is:', scrollParent);\n```\n\n### 2. As a Standalone Utility\n\nIf you prefer not to modify the global `Element.prototype`, you can import the helper function directly:\n\n```javascript\nimport { getScrollParent } from 'scrollparent-polyfill';\n\nconst element = document.querySelector('.my-child-element');\nconst scrollParent = getScrollParent(element);\n\nconsole.log('Scroll parent is:', scrollParent);\n```\n\n## API\n\n### `getScrollParent(node)`\n\n**Parameters:**\n- `node` (`Element`): The element to find the scroll parent for.\n\n**Returns:**\n- `Element | null | undefined`:\n  - The scroll parent element if found.\n  - `document.scrollingElement` if no other scroll parent is found (or if overflow propagates to the viewport).\n  - `undefined` if the element is invalid or not connected to the document.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramus%2Fscrollparent-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramus%2Fscrollparent-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramus%2Fscrollparent-polyfill/lists"}