css-to-xpath
Advanced tools
Comparing version 0.0.1 to 0.0.2
(function() { | ||
var self = this; | ||
var parser, xpathBuilder, Expression, parse; | ||
var parser, xpathBuilder, Expression, parse, convertToXpath; | ||
parser = require("bo-selector").parser; | ||
@@ -14,3 +14,7 @@ xpathBuilder = require("xpath-builder").dsl(); | ||
}; | ||
exports.parse = parse; | ||
convertToXpath = function(selector) { | ||
return parse(selector).toXPath(); | ||
}; | ||
convertToXpath.parse = parse; | ||
module.exports = convertToXpath; | ||
}).call(this); |
{ | ||
"name": "css-to-xpath", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Converts CSS selectors to xpaths", | ||
@@ -34,3 +34,3 @@ "main": "js/css_to_xpath.js", | ||
"name": "Josh Chisholm", | ||
"email": "joshchisholm@gmail.com", | ||
"email": "josh@featurist.co.uk", | ||
"url": "http://featurist.co.uk/" | ||
@@ -37,0 +37,0 @@ }, |
# css-to-xpath | ||
Converts CSS3 selectors to their XPath equivalents | ||
Converts [CSS3 selectors](http://www.w3.org/TR/css3-selectors/#selectors) to their XPath equivalents. | ||
[![Build Status](https://secure.travis-ci.org/featurist/css-to-xpath.png?branch=master)](http://travis-ci.org/featurist/css-to-xpath) | ||
### Usage | ||
```js | ||
var cssToXPath = require('css-to-xpath'); | ||
cssToXPath('p:not(:has(a.x))'); | ||
``` | ||
...returns the string: | ||
``` | ||
.//p[not(.//a[contains(concat(' ', normalize-space(./@class), ' '), ' x ')])] | ||
``` | ||
### How? | ||
css-to-xpath parses css selectors using [bo-selector](https://github.com/featurist/bo-selector) and turns them into xpaths using [xpath-builder](https://github.com/featurist/xpath-builder) | ||
### Install | ||
npm install css-to-xpath | ||
### License | ||
BSD |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28791
278
29