npm

Need private packages and team management tools?Check out npm Orgs. »

parse-element-selector

1.1.0 • Public • Published

parse-element-selector

parse string w3 element selector used in hyperscript functions

ExampleFeaturesAPILicense

Example

var parse = require('parse-element-selector')
 
var d01 = parse('div.c1#i1[style="color:blue"].c2'), // {tag:'div', attributes:{id:'i1', class:'c1 c2'}}
    d02 = parse('svg:circle'), // {tag:'circle', prefix:'svg'}
    d03 = parse('circle[xmlns=http://www.w3.org/2000/svg]') // {tag:'circle', xmlns: 'http://www.w3.org/2000/svg'}

API

Object returned is always in the form {tag, xmlns, prefix, attributes} so that tag, xmlns and/or prefix can be used for document.createElement or document.createElementNS before applying the remaining attributes if any. Properties not found are not declared (i.e. parse('') => {})

License

Released under the MIT License

install

npm i parse-element-selector

Downloadsweekly downloads

8

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability