Skip to content

tcr/cssax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSS Querying Sax Parser

For HTML/XML.

npm install cssax

Then:

var cssax = require('../cssax');

var stream = cssax.createStream();
stream.query('title').on('match', function (tag, attributes) {
  this.readText(function (text) {
    console.log(JSON.stringify(text));
  });
});

require('fs').createReadStream('file.html').pipe(stream);

Supported selectors:

  • *
  • E
  • E F
  • E > F
  • E + F
  • E ~ F
  • E.class
  • E#id
  • E[attr]
  • E[attr=value]
  • E[attr*=value]
  • E[attr^=value]
  • E[attr$=value]
  • E[attr|=value]
  • E[attr~=value]
  • E:nth-child(an+b)

About

CSS querying parser for HTML/XML streams.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published