{"id":15699596,"url":"https://github.com/yields/dom","last_synced_at":"2025-03-30T14:27:21.202Z","repository":{"id":8417406,"uuid":"10003424","full_name":"yields/dom","owner":"yields","description":"Create a dom like structure from html string.","archived":false,"fork":false,"pushed_at":"2013-05-11T18:23:30.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T16:16:46.896Z","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/yields.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2013-05-11T18:20:45.000Z","updated_at":"2013-10-15T15:14:21.000Z","dependencies_parsed_at":"2022-07-30T00:09:29.124Z","dependency_job_id":null,"html_url":"https://github.com/yields/dom","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yields","download_url":"https://codeload.github.com/yields/dom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246330366,"owners_count":20760091,"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-10-03T19:41:04.173Z","updated_at":"2025-03-30T14:27:21.173Z","avatar_url":"https://github.com/yields.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# dom\n\n  Create a dom like structure from html.\n\n## Installation\n\n    $ component install yields/dom\n\n## Example\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003edom\u003c/title\u003e\n    \u003cscript src='build/build.js'\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cscript\u003e\n      var el = document.querySelector('html')\n        , dom = require('dom')\n        , html = el.outerHTML\n        , refs = [];\n\n      console.log(JSON.stringify(dom(html), stringify, 2));\n\n      function stringify(key, val){\n        if (key \u0026\u0026 'object' == typeof val){\n          if (~refs.indexOf(val)) {\n            return val \u0026\u0026 val.name;\n          }\n          refs.push(val);\n        }\n        return val;\n      }\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\n```\n\n```json\n[\n  {\n    \"attrs\": {},\n    \"name\": \"html\",\n    \"text\": \"\\n  \",\n    \"els\": [\n      {\n        \"parent\": \"Circular(html)\",\n        \"next\": \"Circular(body)\",\n        \"attrs\": {},\n        \"name\": \"head\",\n        \"text\": \"\\n  \",\n        \"els\": [\n          {\n            \"parent\": \"Circular(head)\",\n            \"next\": \"Circular(script)\",\n            \"attrs\": {},\n            \"name\": \"title\",\n            \"text\": \"dom\",\n            \"els\": []\n          },\n          {\n            \"parent\": \"Circular(head)\",\n            \"prev\": \"Circular(title)\",\n            \"attrs\": {\n              \"src\": \"build/build.js\"\n            },\n            \"name\": \"script\",\n            \"text\": \"\",\n            \"els\": []\n          }\n        ]\n      },\n      {\n        \"parent\": \"Circular(html)\",\n        \"prev\": \"Circular(head)\",\n        \"attrs\": {},\n        \"name\": \"body\",\n        \"text\": \"\\n    \",\n        \"els\": [\n          {\n            \"parent\": \"Circular(body)\",\n            \"attrs\": {},\n            \"name\": \"script\",\n            \"text\": \"\\n      var el = document.querySelector('html')\\n        , dom = require('dom')\\n        , html = el.outerHTML\\n        , refs = [];\\n\\n      console.log(JSON.stringify(dom(html), stringify, 2));\\n\\n      function stringify(key, val){\\n        if (key \u0026\u0026 'object' == typeof val){\\n          if (!val) return;\\n          if ('next' == key) return circular(val.name);\\n          if ('prev' == key) return circular(val.name);\\n          if ('parent' == key) return circular(val.name);\\n          refs.push(val);\\n        }\\n        return val;\\n      }\\n\\n      function circular(name){\\n        return 'Circular(' + name + ')';\\n      }\\n    \",\n            \"els\": []\n          }\n        ]\n      }\n    ]\n  }\n] \n```\n\n## License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyields%2Fdom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyields%2Fdom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyields%2Fdom/lists"}