Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

domino doesn't work on node 0.10 #22

Closed
fortes opened this Issue · 6 comments

2 participants

@fortes

I'm not having much luck using querySelectorAll on documents. For example, modifying the example from the readme slightly produces weird results:

var domino = require('domino');

var window = domino.createWindow('<div><h1>Hello world</h1><p>Hi there.</p></div>');
var document = window.document;

// Expected: 1, Actual: 0
console.log(document.querySelectorAll('div').length);
// Outputs 1 -- behaves as expected
console.log(document.body.querySelectorAll('div').length);

Note that the same issue happens with getElementsByTagName.

Continuing with the example above, we get some more weird behavior even with sibling elements:

// Outputs 1 as expected
console.log(document.body.querySelector('h1').length);
// Outputs 0, expected 1
console.log(document.body.querySelector('p').length);
@cscott
Collaborator

Hm. Works fine for me (using node 0.8.22 and domino 1.0.9:

> domino = require('domino'); undefined
undefined
> d=domino.createDocument("<div><h1>Hello world</h1><p>Hi there.</p></div>"); undefined
undefined
> d.querySelectorAll('div').length
1
> d.body.querySelectorAll('div').length
1
> d.body.querySelectorAll('h1').length
1
> d.body.querySelectorAll('p').length
1
> w=domino.createWindow("<div><h1>Hello world</h1><p>Hi there.</p></div>"); undefined
undefined
> d=w.document; undefined
undefined
> d.querySelectorAll('div').length
1
> d.body.querySelectorAll('div').length
1
> d.body.querySelectorAll('h1').length
1
> d.body.querySelectorAll('p').length
1

Are you perhaps using an out-of-date version of domino?

@fortes

Ah, looks like it's an issue with Node 0.10 (I was using 0.10.2). Once I switch to 0.8.22, I get the expected results.

Any idea what's going on in 0.10?

@cscott
Collaborator

No, but let me know anything you find out. Maybe we should flag the incompatibility in the package.json until we track down the issue?

@cscott
Collaborator

Have you tried 'npm test' inside a checked-out copy of domino? what other failures are there under node 0.10?

@fortes

There are a bunch of failures. Tests don't even complete, so I don't know the final count. Tons of the following warning:

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

Probably a good idea to mark incompatible until this is resolved.

@cscott
Collaborator

FWIW, that warning seems to come from mocha, not domino.

@fgnass fgnass closed this in 74b731b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.