Event.type problem with jQuery

13 views
Skip to first unread message

Jens

unread,
Jan 22, 2008, 10:41:22 AM1/22/08
to crosscheck
Hello.
I try to use Crosscheck for testing a web application that uses
jQuery, but can't seem to get it to work in the event handling case.

What I try to do is this :

>>
crosscheck.addTest({
testClickEmailType : function(){
crosscheck.Host.click($("#email-invite-button").get(0));
}
});
<<

And in my javascipt file I attach a handler like this :

>>
$("#email-invite-button").click(this._setEmailTypeClick)
<<

This seems to work, but jQuery tries to do :

>>
event = jQuery.event.fix( event || window.event || {} );

// Namespaced event handlers
var parts = event.type.split(".");
event.type = parts[0];
<<

Which breaks because it can't find event.type ... (Which exists in
mozilla).
I've been looking through your code and it seems like there should be
a event.type property, but for some reason crosscheck can't seem to
access that.

Could you help me please.
Best regards - Jens Neubeck.

Jens

unread,
Jan 29, 2008, 7:49:54 PM1/29/08
to crosscheck
After some more research it seems that it is the jQuery.extend that
causes the behaviour. As far as I can read it grabs all the properties
of an event and sets them to the new object. The problem is that the
properites shown in a 'for (var e in event)' is quite different
between crosscheck and a real browser.

== REAL ==
type
target
currentTarget
eventPhase
bubbles
cancelable
timeStamp
stopPropagation
preventDefault
initEvent
view
detail
initUIEvent
screenX
screenY
clientX
clientY
ctrlKey
shiftKey
altKey
metaKey
button
relatedTarget
initMouseEvent
CAPTURING_PHASE
AT_TARGET
BUBBLING_PHASE
getPreventDefault
layerX
layerY
pageX
pageY
which
rangeParent
rangeOffset
cancelBubble
isChar
SCROLL_PAGE_UP
SCROLL_PAGE_DOWN
originalTarget
explicitOriginalTarget
preventBubble
preventCapture
isTrusted
MOUSEDOWN
MOUSEUP
MOUSEOVER
MOUSEOUT
MOUSEMOVE
MOUSEDRAG
CLICK
DBLCLICK
KEYDOWN
KEYUP
KEYPRESS
DRAGDROP
FOCUS
BLUR
SELECT
CHANGE
RESET
SUBMIT
SCROLL
LOAD
UNLOAD
XFER_DONE
ABORT
ERROR
LOCATE
MOVE
RESIZE
FORWARD
HELP
BACK
TEXT
ALT_MASK
CONTROL_MASK
SHIFT_MASK
META_MASK

== Crosscheck ==
DOM_VK_ESCAPE
DOM_VK_META
ERROR
preventDefault
DOM_VK_COMMA
DOM_VK_SEMICOLON
ABORT
DOM_VK_TAB
DOM_VK_SCROLL_LOCK
DOM_VK_MULTIPLY
DOM_VK_CAPS_LOCK
DOM_VK_LEFT
preventCapture
DOM_VK_NUMPAD0
DOM_VK_NUMPAD1
DOM_VK_NUMPAD2
DOM_VK_NUMPAD3
DOM_VK_NUMPAD4
DOM_VK_NUMPAD5
DOM_VK_NUMPAD6
DOM_VK_NUMPAD7
DOM_VK_NUMPAD8
DOM_VK_NUMPAD9
DOM_VK_RIGHT
LOAD
initPopupBlockedEvent
CLICK
DOM_VK_OPEN_BRACKET
DOM_VK_CANCEL
DRAGDROP
RESET
DOM_VK_EQUALS
TEXT
LOCATE
DOM_VK_BACK_QUOTE
UNLOAD
DOM_VK_QUOTE
SCROLL
DOM_VK_PAUSE
DOM_VK_DOWN
DOM_VK_INSERT
DOM_VK_CLOSE_BRACKET
META_MASK
DOM_VK_ALT
SELECT
DOM_VK_RETURN
DOM_VK_PRINTSCREEN
SHIFT_MASK
BACK
DOM_VK_BACK_SPACE
stopPropagation
preventBubble
initUIEvent
FORWARD
DOM_VK_DIVIDE
DOM_VK_SPACE
XFER_DONE
BLUR
DOM_VK_HELP
MOUSEOUT
DOM_VK_SUBTRACT
AT_TARGET
DOM_VK_END
DOM_VK_SHIFT
MOUSEUP
CHANGE
DOM_VK_F4
DOM_VK_F5
DOM_VK_F6
DOM_VK_F7
DOM_VK_F8
DOM_VK_F9
DOM_VK_CONTROL
DOM_VK_F3
DOM_VK_F2
DOM_VK_F1
MOUSEDRAG
MOUSEOVER
DOM_VK_BACK_SLASH
DOM_VK_0
DOM_VK_1
DOM_VK_2
DOM_VK_3
DOM_VK_4
DOM_VK_5
KEYUP
DOM_VK_7
DOM_VK_8
DOM_VK_9
DOM_VK_6
DOM_VK_SLASH
ALT_MASK
SUBMIT
DOM_VK_HOME
DOM_VK_F10
DOM_VK_F11
DOM_VK_F12
DOM_VK_SEPARATOR
DBLCLICK
DOM_VK_H
DOM_VK_I
getPreventDefault
DOM_VK_K
initEvent
DOM_VK_M
DOM_VK_N
DOM_VK_O
DOM_VK_P
DOM_VK_Q
MOVE
initKeyEvent
DOM_VK_ADD
KEYDOWN
DOM_VK_V
DOM_VK_W
DOM_VK_X
DOM_VK_Y
DOM_VK_Z
DOM_VK_U
DOM_VK_T
DOM_VK_S
DOM_VK_CLEAR
DOM_VK_R
DOM_VK_L
DOM_VK_J
DOM_VK_G
DOM_VK_F
DOM_VK_E
DOM_VK_D
DOM_VK_C
DOM_VK_DECIMAL
DOM_VK_B
DOM_VK_DELETE
DOM_VK_A
DOM_VK_PAGE_DOWN
DOM_VK_F13
DOM_VK_F14
DOM_VK_F15
BUBBLING_PHASE
DOM_VK_F16
DOM_VK_F17
DOM_VK_F18
initMouseEvent
DOM_VK_F19
DOM_VK_F20
DOM_VK_F21
DOM_VK_F22
DOM_VK_F23
DOM_VK_F24
DOM_VK_NUM_LOCK
MOUSEMOVE
DOM_VK_ENTER
DOM_VK_UP
CONTROL_MASK
FOCUS
DOM_VK_PAGE_UP
MOUSEDOWN
toString
HELP
KEYPRESS
CAPTURING_PHASE
SCROLL_PAGE_DOWN
DOM_VK_CONTEXT_MENU
SCROLL_PAGE_UP
DOM_VK_PERIOD
RESIZE

Though I have to add that the real browser I used isn't Firefox 1.5 as
crosscheck is supposed to model. It is firefox 2.0 .

/J

jdwad...@gmail.com

unread,
Jan 29, 2008, 8:14:50 PM1/29/08
to crosscheck
Yes, the current version of Crosscheck definitely does not match the
DOM exactly. I've done some work to try to generate an accurate
interface, but it's incomplete and I haven't had much time to work on
it lately.

It's odd that type is not in the list, though, because it's definitely
on the object. But there's a lot of hackery in the Java/JavaScript
interface that could cause problems. I'll try to look into this if I
get some free time.

- Jason

Jens

unread,
Jan 30, 2008, 4:53:09 AM1/30/08
to crosscheck
No, of course. You guys have done a great job of modeling it already.
Respect.

It seems like all the attributes defined by the "get_"-ers & "set_"-
ers won't show up in the list when you do the 'for (attributes in
object)'. I tried to look through your files to see how the
enumeration is defined, and all of the java-2-javascript seems to be
defined in the JSWrapper.java, but unfortunally my java ain't that
great.

best regards.
-Jens

On 30 Jan, 02:14, "wadswo...@thefrontside.net" <jdwadswo...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages