{"id":22354372,"url":"https://github.com/jonmagic/chrome-neighboring-forms-bug","last_synced_at":"2026-02-07T06:02:24.484Z","repository":{"id":66375184,"uuid":"72558015","full_name":"jonmagic/chrome-neighboring-forms-bug","owner":"jonmagic","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-01T17:07:59.000Z","size":170,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T05:34:22.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/jonmagic.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-01T17:07:45.000Z","updated_at":"2023-11-30T02:05:00.000Z","dependencies_parsed_at":"2023-02-21T04:45:14.762Z","dependency_job_id":null,"html_url":"https://github.com/jonmagic/chrome-neighboring-forms-bug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonmagic/chrome-neighboring-forms-bug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fchrome-neighboring-forms-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fchrome-neighboring-forms-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fchrome-neighboring-forms-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fchrome-neighboring-forms-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonmagic","download_url":"https://codeload.github.com/jonmagic/chrome-neighboring-forms-bug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fchrome-neighboring-forms-bug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267815187,"owners_count":24148356,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":"2024-12-04T13:12:41.896Z","updated_at":"2026-02-07T06:02:24.460Z","avatar_url":"https://github.com/jonmagic.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chrome Neighboring Forms Bug\n\nI found what appears to be a bug in Chrome 54, evident when inserting html that contains neighboring forms. In the following example I create a template element, set it's innerHTML to three forms each with their own input field, import the node, and then append it to a container div in the document. The javascript is pretty simple:\n\n```javascript\nvar container = document.querySelector(\".container\")\nvar forms = \"\u003cform action='/a'\u003e\u003cinput type='text' value='a'\u003e\u003c/form\u003e\u003cform action='/b'\u003e\u003cinput type='text' value='b'\u003e\u003c/form\u003e\u003cform action='/c'\u003e\u003cinput type='text' value='c'\u003e\u003c/form\u003e\"\n\nfunction prepareNode(html) {\n  var template = document.createElement(\"template\")\n  template.innerHTML = html\n  return document.importNode(template.content, true)\n}\n\ncontainer.appendChild(prepareNode(forms))\n```\n\n### Safari handles this correctly.\n\n![safari](safari.png)\n\n### But Chrome nests the forms\n\n![chrome](chrome.png)\n\n### The solution\n\nI figured out that nesting each `form` in a `div` will prevent the undesired behavior.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonmagic%2Fchrome-neighboring-forms-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonmagic%2Fchrome-neighboring-forms-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonmagic%2Fchrome-neighboring-forms-bug/lists"}