> All my tests are runing on both enviroments (browser and nodejs), and they
> include tests with dom elements.
> To use dom elements on nodejs take a look at jsdom.
I tried that and had a lot of problems. First, jsdom define a
getter/setter for the "id" attribute in core.Element, which
core.Document inherit the prototype chain from [1]. So, that screwed the
mootools document.id() implementation. I could handle it changing the
jsdom s/getter and checking if the passed argument was typeof ==
'function'.
There were a similar problem with the "head" getter/setter.
Also, the slick part of mootools don't play very well when directly
loaded in mootools, since it try to access exports. I had to drop the
closure and use mootools-loader [2].
Now, I'm facing a problem with document.getElement( '#foo' ) : in the
getElement method [3], this, instead of being Document is…
'{ '0': '#', '1': 'f', '2': 'o', '3': 'o' }' :)
I suppose you were using core-1.2 ? Did you tried since with core-1.3
and faced those problems?
[1]
https://github.com/tmpvar/jsdom/blob/master/lib/jsdom/level2/core.js#L379
[2] https://github.com/cpojer/mootools-loader
[3]
https://github.com/mootools/mootools-core/blob/master/Source/Element/Element.js#L298
--
Olivier El Mekki.