Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zswang/element-path
Path of element get and query.
https://github.com/zswang/element-path
element path
Last synced: about 1 month ago
JSON representation
Path of element get and query.
- Host: GitHub
- URL: https://github.com/zswang/element-path
- Owner: zswang
- Created: 2018-04-26T08:14:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-13T02:03:53.000Z (over 6 years ago)
- Last Synced: 2024-10-02T08:46:03.061Z (about 1 month ago)
- Topics: element, path
- Language: JavaScript
- Homepage:
- Size: 48.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Element-Path
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coverage-image]][coverage-url]
Path of element get and query.
## Examples
```js
var ep = new ElementPath()
var element = document.querySelect('a:nth-child(2)')
var path = ep.get(element)
console.log(element === ep.query(path))
// true
``````js
var ep = new ElementPath({
tags: 'textarea,section,div'
})
var element = document.querySelect('a:nth-child(2)')
var path = ep.get(element)
console.log(element === ep.query(path))
// true
```## License
MIT © [zswang](http://weibo.com/zswang)
[npm-url]: https://npmjs.org/package/element-path
[npm-image]: https://badge.fury.io/js/element-path.svg
[travis-url]: https://travis-ci.org/zswang/element-path
[travis-image]: https://travis-ci.org/zswang/element-path.svg?branch=master
[coverage-url]: https://coveralls.io/github/zswang/element-path?branch=master
[coverage-image]: https://coveralls.io/repos/zswang/element-path/badge.svg?branch=master&service=github