prototype extending of NodeList

I am using "html5" node.js library, based on "jsdom" library (https://github.com/aredridel/html5)

My code is:

var  HTML5 = require('/usr/lib/node_modules/html5/lib/html5'),
     Script = process.binding('evals').Script,
     util = require('util'),
     fs = require('fs');
var p = new HTML5.Parser();
p.parse_fragment(fs.readFileSync('test.xml'));

Now I have p object which has p.tree.body_pointer._childNodes of NodeList (try p.tree.body_pointer._childNodes.constructor to see that).

I want to extend it by my method to be able calling p.tree.body_pointer._childNodes.foo().

I tried NodeList.prototype.foo = function(){ return "OK"} but I get NodeList is not defined error message.

I guess NodeList is declared inside something I can't find. Looking in the source code I found it under core or dom but both are not available from my code.

Also I scaned HTML5 object - but no success.

Any idea?

Three solutions I can think of:

// either ...
var NodeList = p.tree.body_pointer._childNodes.constructor;
// ...or...
var core = require('html5/node_modules/jsdom/lib/jsdom/level3/core');
var NodeList = core.dom.level3.core.NodeList;
// ...or...
var jsdom = require('html5/node_modules/jsdom');
var NodeList = jsdom.dom.level3.core.NodeList;
// ...and then...
NodeList.prototype.foo = function() { ... };

All three aren't real pretty, though.