{"id":21236585,"url":"https://github.com/edg2s/rangefix","last_synced_at":"2025-07-10T18:30:43.240Z","repository":{"id":20868475,"uuid":"24155473","full_name":"edg2s/rangefix","owner":"edg2s","description":"Workaround for browser bugs in Range.prototype.getClientRects and Range.prototype.getBoundingClientRect.","archived":false,"fork":false,"pushed_at":"2023-07-18T22:16:59.000Z","size":383,"stargazers_count":37,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-30T00:10:13.137Z","etag":null,"topics":["javascript","polyfill","workaround"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edg2s.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2014-09-17T17:44:17.000Z","updated_at":"2024-06-18T04:58:37.000Z","dependencies_parsed_at":"2024-06-18T17:11:24.180Z","dependency_job_id":"39321bbb-f1ed-49b8-b557-4dc11639f646","html_url":"https://github.com/edg2s/rangefix","commit_stats":{"total_commits":97,"total_committers":5,"mean_commits":19.4,"dds":0.1649484536082474,"last_synced_commit":"d0213a31eef1dba35f852e797bf5e2bc1dbf6f45"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edg2s%2Frangefix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edg2s%2Frangefix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edg2s%2Frangefix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edg2s%2Frangefix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edg2s","download_url":"https://codeload.github.com/edg2s/rangefix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225648843,"owners_count":17502186,"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":["javascript","polyfill","workaround"],"created_at":"2024-11-21T00:12:26.269Z","updated_at":"2025-07-10T18:30:43.234Z","avatar_url":"https://github.com/edg2s.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Workaround for browser bugs in Range.prototype.getClientRects and Range.prototype.getBoundingClientRect.\n\nIn particular:\n\n* Chrome \u003c= 54: Selections spanning multiple nodes return rectangles for all the parents of the endContainer. See https://code.google.com/p/chromium/issues/detail?id=324437.\n* Chrome 55: Images get no rectangle when they are wrapped in a node and you select across them.\n* Safari: Similar to the Chrome \u003c= 54 bug, but only triggered near the edge of a block node, or programmatically near an inline node.\n* Firefox: Similar to the Chrome \u003c= 54 bug, but only triggered near the edge of a inline node\n* Chrome: Selection across a space which spans two lines results in a bounding rectangle which doesn't cover all the individual rectangles.\n* Firefox: Selections across a space which spans two lines, and text on the next line results in a bounding rectangle which doesn't cover all the individual rectangles.\n\nThere are no known issues in Edge. When no issues are detected the library will fall through to native behaviour.\n\nInstall\n=======\n\n```bash\n$ npm install rangefix\n```\n\nUsage\n=====\n\n**CommonJS**\n\n```javascript\nvar RangeFix = require( 'rangefix' );\n```\n\n**AMD**\n\n```javascript\ndefine( [ 'rangefix' ], function ( Rangefix ) {\n\t// ...\n} );\n```\n\n**Browser global**\n\n```html\n\u003cscript src=\"path/to/rangefix.js\"\u003e\u003c/script\u003e\n```\n\n**API**\n\nReplace instances of `Range.prototype.getClientRects`/`getBoundingClientRect` with `RangeFix.getClientRects`/`getBoundingClientRect`:\n\n```javascript\nvar range = document.getSelection().getRangeAt( 0 );\n\n// Before\nvar rects = range.getClientRects();\nvar boundingRect = range.getBoundingClientRect();\n\n// After\nvar rects = RangeFix.getClientRects( range );\nvar boundingRect = RangeFix.getBoundingClientRect( range );\n```\n\nDemo\n====\nhttp://edg2s.github.io/rangefix/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedg2s%2Frangefix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedg2s%2Frangefix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedg2s%2Frangefix/lists"}