Created
May 17, 2014 10:50
-
-
Save hekike/103adb574e882e578115 to your computer and use it in GitHub Desktop.
htm-select attr selector: *=, ^= $=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var select = require('../'); | |
var tokenize = require('html-tokenize'); | |
var fs = require('fs'); | |
var s = select('ul > li dt[name*="sample"]', function (e) { | |
console.log('*** MATCH ***'); | |
e.createReadStream().on('data', function (row) { | |
console.log([ row[0], row[1].toString() ]); | |
}); | |
}); | |
fs.createReadStream(__dirname + '/page.html').pipe(tokenize()).pipe(s); | |
s.resume(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Throws error with these selectors:
[attr$=value]: Attribute ends with value
[attr^=value]: Attribute starts with value
[attr*=value]: Attribute contains value
[attr~=value]: Attribute, split by whitespace, contains value.