{"id":16349422,"url":"https://github.com/stevemao/javascript-cant-replace-html","last_synced_at":"2026-01-25T12:03:38.163Z","repository":{"id":66063333,"uuid":"64281843","full_name":"stevemao/javascript-cant-replace-html","owner":"stevemao","description":"Things that you can only do with HTML","archived":false,"fork":false,"pushed_at":"2016-07-31T02:16:05.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-19T17:38:10.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/stevemao.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-07-27T06:07:46.000Z","updated_at":"2018-12-13T17:24:24.000Z","dependencies_parsed_at":"2023-02-21T00:16:33.599Z","dependency_job_id":null,"html_url":"https://github.com/stevemao/javascript-cant-replace-html","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"a7024ca6af0b5e10790d0685f3848e83932d6992"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stevemao/javascript-cant-replace-html","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevemao%2Fjavascript-cant-replace-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevemao%2Fjavascript-cant-replace-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevemao%2Fjavascript-cant-replace-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevemao%2Fjavascript-cant-replace-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevemao","download_url":"https://codeload.github.com/stevemao/javascript-cant-replace-html/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevemao%2Fjavascript-cant-replace-html/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28752671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T10:25:12.305Z","status":"ssl_error","status_checked_at":"2026-01-25T10:25:11.933Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-11T00:59:40.650Z","updated_at":"2026-01-25T12:03:38.144Z","avatar_url":"https://github.com/stevemao.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Since we write a lot of JavaScript now, we tend to write less HTML and css code.\n\nWe used to have Ext.js that turns your HTML into something like this:\n\n```html\n\u003cdiv class=\"div\"\u003e\n  \u003cdiv class=\"content\"\u003e\n    \u003cdiv class=\"body\"\u003e\n      \u003cdiv class=\"text\"\u003e\n        \u003cdiv class=\"link\"\u003e\n          A clickable link here\n        \u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\nWe now have React.js that encourages you to write HTML in your JavaScript. They even build the whole event system. People using JavaScript (EG: form validation) to make sure the HTML has consistent behaviors across different browsers.\n\nIt seems like every HTML tag just have some special use agent. For example, an `an` tag is an anchor link. You can click to go to another website. Text is blue with underscore. You could write JavaScript (or/and css) to turn a `\u003cdiv\u003e` into `\u003ca\u003e`. Or can you?\n\n*Note:* This list does not include things like calling `createElement()` in your JavaScript, because an `\u003ca\u003e` created by `createElement()` is a real `\u003ca\u003e`.\n\n*Note:* There are other important reasons: semantics, free functionalities, default styles and performance.\n\n## ARIA\n\nNo, you can't command your VoiceOver to call a `\u003cdiv\u003e` an anchor link. In fact, you can hardly control your VoiceOver in general.\n\n## Context Menu\n\nEG: \"Open Link In New Tab\". You can't add this to your \"right click menu\" in JavaScript. No You can't. [You can't even do customize context menu in most browsers](http://caniuse.com/#search=context).\n\n## Search engine\n\nYes, search engines do run JavaScript now. No they won't treat a `\u003cdiv\u003e` with a click event listener the same as an `\u003ca\u003e`. [They will probably ignore the changes made by JavaScript in your `\u003chead\u003e` metadata](http://stackoverflow.com/a/413455/2075423).\n\n## Sync form post\n\nSurprise! [The only way to do a sync form post is through HTML](http://stackoverflow.com/a/133997/2075423). Read more on [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects) and [`HTMLFormElement.submit()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit).\n\n## `\u003ciframe\u003e`\n\nThis is the only way to have a \"browser\" inside your website.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevemao%2Fjavascript-cant-replace-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevemao%2Fjavascript-cant-replace-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevemao%2Fjavascript-cant-replace-html/lists"}