Skip to content

Commit

Permalink
Revert xpath version and move the dependency to lib
Browse files Browse the repository at this point in the history
The npm xpath package has been updated to more closely match
the xpath spec. However, this leads to problems using generic
xpath selectors to select into a DOM rendered from normal HTML.
Selectors that don't have a namespace fail to select anything.

This behaviour makes scraping of the kind enabled by thresher
impossible, but the previous version of the xpath lib was still
the best working implementation we found in npm during testing.

The fix is to bring the last working version of the xpath lib
into this repo (it's only a single file). At a later stage, we
can take later versions of the xpath lib that might have other
improvements, but restore the historical handling of namespaces.
This is tracked in issue #17.
  • Loading branch information
blahah committed Apr 10, 2015
1 parent 0c22408 commit 1d31dc0
Show file tree
Hide file tree
Showing 4 changed files with 4,341 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// jsdom lets us re-render the DOM from raw HTML
var jsdom = require('jsdom-little').jsdom;
// xpath lets us use xpath selectors on the rendered DOM
var xpath = require('xpath');
var xpath = require('./xpath.js');

var dom = module.exports;

Expand Down
Loading

0 comments on commit 1d31dc0

Please sign in to comment.