{"id":24206254,"url":"https://github.com/telenko/xdompath","last_synced_at":"2025-09-22T04:33:22.639Z","repository":{"id":57141789,"uuid":"193486299","full_name":"telenko/xdompath","owner":"telenko","description":"Library for query DOM nodes via XPATH language with new features (ShadowDOM support)","archived":false,"fork":false,"pushed_at":"2019-07-20T18:03:49.000Z","size":64,"stargazers_count":8,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-31T21:24:09.480Z","etag":null,"topics":["shadowdom","shadowdom-support","xml-model","xpath-language"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/telenko.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}},"created_at":"2019-06-24T10:43:12.000Z","updated_at":"2023-05-20T18:07:02.000Z","dependencies_parsed_at":"2022-09-03T06:53:10.264Z","dependency_job_id":null,"html_url":"https://github.com/telenko/xdompath","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/telenko/xdompath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Fxdompath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Fxdompath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Fxdompath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Fxdompath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telenko","download_url":"https://codeload.github.com/telenko/xdompath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Fxdompath/sbom","scorecard":{"id":873180,"data":{"date":"2025-08-11","repo":{"name":"github.com/telenko/xdompath","commit":"fab0188fe5b09fcfea8db7c6922015c34ceb461f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T04:56:09.697Z","repository_id":57141789,"created_at":"2025-08-24T04:56:09.697Z","updated_at":"2025-08-24T04:56:09.697Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276347148,"owners_count":25626597,"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-09-22T02:00:08.972Z","response_time":79,"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":["shadowdom","shadowdom-support","xml-model","xpath-language"],"created_at":"2025-01-14T00:19:48.175Z","updated_at":"2025-09-22T04:33:22.322Z","avatar_url":"https://github.com/telenko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### XDOMPATH\nLibrary for query DOM nodes similar to XPATH language with new features (ShadowDOM support)\n\n### Purpose of creating\nXPATH language is oriented only on clear XML document model, but real DOM model now differs from XML because of ShadowDOM technology. XDomPath is new extended language which can handle ShadowDOM and allows to use DOM with ShadowDOM as XML language.\n\n### API\n1) Import library into your file:\n```Javascript\n\timport { XDomPath } from '@telenko/xdompath';\n```\n2) Create a xdompath instance by using query as argument\n```Javascript\n\tconst allDivsPath = new XDomPath('.//div');\n```\n3) Select a scope to query for and run XDomPath:\n```Javascript\n\tconst divsArr = allDivsPath.perform(document.body);\n```\n### Extended XML model for DOM with ShadowDOM:\nXDomPath is trying to treat DOM with ShadowDOM as XML model. To achieve that DOM model XDomPath parses in such way:\n1) shadowRoot elements are parsed as **always first children** of host element\n2) child nodes of shadowRoot are parsed as direct children of shadowRoot element\n3) slotted elements are parsed as direct children of host element\n\n### Examples\n```Javascript\n//setup DOM\nconst container = document.createElement('div');\ncontainer.innerHTML = `\n    \u003cdiv id='with-shadow'\u003e\u003c/div\u003e\n    \u003cspan\u003esome text\u003c/span\u003e\n    \u003cdiv\u003e\n        \u003cp class='bold_paragraph'\u003eanother text\u003c/p\u003e\n    \u003c/div\u003e\n`;\nconst divWithShadow = container.children[0];\ndivWithShadow.attachShadow({ mode: \"open\" });\ndivWithShadow.shadowRoot.innerHTML = `\n    \u003cp class='bold_paragraph'\u003etext inside shadow\u003c/p\u003e\n    \u003cinput type='text'/\u003e\n    \u003cdiv\u003esome container inside shadow\u003c/div\u003e\n    \u003cp\u003etext\u003c/p\u003e\n`;\n```\n1) Deep querying through Light/Shadow DOM\n```Javascript\n//let's query\nconst queryDivs = new XDomPath('.//div');\nconst allDivs = queryDivs.perform(container);\nconsole.log(allDivs.length);//3\n\nconst divsInsideShadow = new XDomPath('.//shadow()//div');\nconst shadowDivs = queryDivs.perform(container);\nconsole.log(shadowDivs.length);//1\n\nconst particularText = new XDomPath('.//text()[.=\"text inside shadow\"]');\nconst texts = particularText.perform(container);\nconsole.log(texts.length);//1\n```\n2) Querying by class existence\n```Javascript\nconst withClassQuery = new XDomPath('.//p[class(\"bold_paragraph\")]');\nconst psWithClass = particularText.perform(container);\nconsole.log(psWithClass.length);//2\n```\n3) Querying focusable elements\n```Javascript\nconst withClassQuery = new XDomPath('.//focusable()');\nconst psWithClass = particularText.perform(container);\nconsole.log(psWithClass.length);//1\n```\n4) Using regular XPATH axes\n```Javascript\nconst withClassQuery = new XDomPath('.//p[class(\"bold_paragraph\")]/following-subling::input');\nconst psWithClass = particularText.perform(container);\nconsole.log(psWithClass.length);//1\n```\n### Supported features\n1) All XPATH axes\n2) Function list:\n-    text()\n-    position()\n-    last()\n-    not()\n-    name() -- planned, but not supported for now\n-    id() -- planned, but not supported for now\n-    string()\n-    substring()\n-    substring-after()\n-    substring-before()\n-    string-length()\n-    count()\n-    concat()\n-    normalize-space()\n-    starts-with()\n-    contains()\n-    translate() -- planned, but not supported for now\n-    ceiling()\n-    floor()\n-    round()\n-    sum() -- planned, but not supported for now\n\n   **new XDomPath functions:**\n\n-    shadow() -- returns nodes which are instances of ShadowRoot\n-    class() -- receives string and returns true if node has class\n-    focusable() -- returns nodes which are focusable HTML elements\n\n### Limitations\n1) Mathematical operations (except of comparison operators '=' '\u003c' '\u003e' '\u003c=' '\u003e=')\n2) Some particular functions (from item above)\n3) Union operator | (plan to support in future)\n4) 'or' 'and' operators inside filters\n5) '( )' group operators inside of filters:\n```Javascript\n         new XDomPath('(.//div)[0]');//will work\n         new XDomPath('.//div[(position() \u003c 3)]');//won't work\n```\n6) NodeList -\u003e String type conversion for now works by different algorithm:\n```Javascript\n    list[#text, #text, #text] -\u003e list[0].textContent;//only 1st item's textContent\n```\n\n### Dist folder\nDist folder contains of 2 compiled js files:\n-    xdompath.min.js - compiled version of XDomPath\n-    xdompath.global.min.js - compiled version, but auto-pushed to global window scope as\n```Javascript\n    window.XDomPath\n```\n\n### Current issues\n1) '..' parent axis working not properly for now. For now alias '/parent::' recommended to use instead\n\n### Plans\n1) Cover more XPATH features\n2) Introduce new method:\n```Javascript\n\t  XDomPath.defineFunction(...);\n```\nto make possible extend base set of functions with custom ones","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelenko%2Fxdompath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelenko%2Fxdompath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelenko%2Fxdompath/lists"}