Dear Dale,

>>Does HTMLUnit emulate IE by default?

Yes

>> This detection code does not seem to think so.

Actually, document.compatMode is supported in HtmlUnit 2.4-snapshot, you can 
get it from http://build.canoo.com/htmlunit/artifacts

>> How does one specify the Browser to emulate in webtest?

http://www.nabble.com/changing-browser-compatibility-td6415973.html#a6424767


Hope that helps,
Ahmed

________________________________
From: Dale Ogilvie <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, November 4, 2008 11:16:44 PM
Subject: RE: [Webtest] Javascript exception with document.addEventListener

The problem first showed up in some javascript that tries to detect IE.
HTMLUnit is being detected as NOT IE and the addEventListener code is
being run, producing the error.

Does HTMLUnit emulate IE by default? This detection code does not seem
to think so. How does one specify the Browser to emulate in webtest?

It looks like this:

function browserTypeChecker() {
  this.IE = false; //functions that just need to know if the browser is
I.E.
    this.IE6 = false; //functions for IE6 alone
    this.IE7 = false; //functions for IE7 alone
    
  if (document.compatMode && document.all && !window.opera) {
    this.IE = true;
    if(document.documentElement && typeof
document.documentElement.style.maxHeight!='undefined'){
            this.IE7 = true;
            return;
        }
        this.IE6 = true;
        return;
  }
}
var detectIE = new browserTypeChecker();

// ----------------------
// Detect document events
// ----------------------

        if (detectIE.IE){
              document.onmousedown = handleMousedown;
                document.onmouseup = handleMouseup;
        }else{
              document.addEventListener("mousedown",
handleMousedown, true);
                document.addEventListener("mouseup",
handleMouseup, true);
        }


________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ahmed Ashour
Sent: Tuesday, 4 November 2008 10:47 p.m.
To: [email protected]
Subject: Re: [Webtest] Javascript exception with
document.addEventListener


>>Is this a bug in htmlunit?

No.

addEventListener() is supported only if Firefox, not IE.

You have to use FF simulation instead.

Ahmed
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest



      

Reply via email to