
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@mass-edge/xpathjs
Advanced tools
XPathJS is a pure JavaScript implementation of XPath 1.0 and DOM Level 3 XPath specifications.
XPathJS is a pure JavaScript implementation of XPath 1.0 and DOM Level 3 XPath specifications.
npm install xpathjs
then import 'xpathjs'
at the top of your js file
or
Add <script src="https://unpkg.com/@mass-edge/xpathjs@0.2.2/dist/xpathjs.min.js"></script>
in the <head> of your HTML document.
Initialize XPathJS:
// bind XPath methods to document and window objects
// NOTE: This will overwrite native XPath implementation if it exists
window.XPathJS.bindDomLevel3XPath();
You can now use XPath expressions to query the DOM:
var result = document.evaluate(
'//ul/li/text()', // XPath expression
document, // context node
null, // namespace resolver
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE
);
// loop through results
for (var i = 0; i < result.snapshotLength; i++) {
var node = result.snapshotItem(i);
alert(node.nodeValue);
}
Take a look at some working examples to get a better idea of how to use XPathJS.
We would strongly recommend for you to take a look at the CAVEATS document to get a better understanding of XPathJS limitations.
More examples, configuration options, and caveat info coming soon...
So how did XPathJS come to be? Well originally we were looking for an implementation of a cross-browser XForms solution in hopes to alleviate the pain and complexity that comes with creating normal HTML forms. Unfortunately, we found out that there is neither an XForms engine that is fully implemented, nor does it support all browsers. So we thought, ok let's try to build our own! Then we realized that XForms makes extensive use of XPath. And again, we could not find a fully functional cross-browser XPath implementation. Long story short, that's how XPathJS was born.
By releasing XPathJS, we hope to help promote the adoption of open standards in the community.
XPathJS is developed by Andrej Pavlovic. You are more than welcome to contribute by logging issues, sending pull requests, or just giving feedback.
FAQs
XPathJS is a pure JavaScript implementation of XPath 1.0 and DOM Level 3 XPath specifications.
We found that @mass-edge/xpathjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.