Hi Rob, .ready() won't work in Rhino since there is no page to wait if it's ready. Everything else should work just fine.
~Sean On 9/12/07, Rob Desbois <[EMAIL PROTECTED]> wrote: > > Ok I've enlightened myself a little: I tried it with jQuery 1.2 and > discovered that the line number changed - it's not a line number in httpUnit > as I thought (understandably I think!) but in jQuery. > > In jQuery 1.2 it's line 1613 (but is reported as 1612), which is the else > statement in this part of jQuery.event["add"]: > > // And bind the global event handler to the element > > if (element.addEventListener ) > > element.addEventListener(type, handle, false); > > else > > element.attachEvent("on" + type, handle); > > > > So neither addEventListener nor attachEvent are defined (I change the else > to an else if to check attachEvent - it's undefined). > Seeing as there's been a fair bit of mention of jQuery in Rhino on the > list, I find it hard to believe jQuery won't work with it - so has anyone > who's used Rhino with jQuery seen this, and can anyone help? > > thanks, > --rob > > On 9/12/07, Rob Desbois <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > I'm creating a Web app which uses jQuery, and am unit testing it with > > HttpUnit which uses Rhino (the Mozilla JavaScript implementation). > > > > I'm having trouble with $(document).ready(...) causing the tests to > > crash with this message: > > > > > alert("hi"); > > > });' failed: TypeError: undefined is not a function. (httpunit; line > > > 1456)) > > > > > > The whole statement is this: > > > > > $(document).ready(function() { > > > alert("hi"); > > > }); > > > > > > > Other basic checks are ok, e.g. $("#foo").focus() works perfectly. > > Even if I only try to use .ready() after checking that is is defined, I > > still get the same result: > > > > > if (typeof $(document).ready === 'function') > > > > > > > I know this is likely to be a Rhino/HttpUnit problem but as I know > > several people on this list are familiar with Rhino I wanted to know if > > anyone's seen this or has any ideas? > > I'm on: > > jQuery 1.1.4 > > HttpUnit 1.6.2 > > > > TIA, > > --rob > > > > -- > > Rob Desbois > > <[EMAIL PROTECTED]> > > > > -- > Rob Desbois