public static DomMouseEventArgs Create(nsIDOMMouseEvent ev)
 {
     if (ev is nsIDOMMouseScrollEvent)
     {
         return(DomMouseScrollEventArgs.Create((nsIDOMMouseScrollEvent)ev));
     }
     if (ev is nsIDOMDragEvent)
     {
         return(DomDragEventArgs.Create((nsIDOMDragEvent)ev));
     }
     return(new DomMouseEventArgs(ev));
 }
        public static DomEventArgs Create(nsIDOMEvent ev)
        {
            var type = nsString.Get(ev.GetTypeAttribute).ToLowerInvariant();

            // search by name and create child class wrappers
            switch (type)
            {
            case "keydown":
            case "keyup":
            case "keypress":
                return(DomKeyEventArgs.Create((nsIDOMKeyEvent)ev));

            case "mousedown":
            case "mouseup":
            case "mousemove":
            case "mouseover":
            case "mouseout":
            case "contextmenu":
                return(DomMouseEventArgs.Create((nsIDOMMouseEvent)ev));

            case "dommousescroll":
                return(DomMouseScrollEventArgs.Create((nsIDOMMouseScrollEvent)ev));

            case "dragstart":
            case "dragenter":
            case "dragover":
            case "dragleave":
            case "drag":
            case "drop":
            case "dragend":
                return(DomDragEventArgs.Create((nsIDOMDragEvent)ev));

            case "hashchange":
                return(DomHashChangeEventArgs.Create(( nsIDOMHashChangeEvent )ev));
            }
            // search by type
            if (ev is nsIDOMUIEvent)
            {
                return(DomUIEventArgs.Create((nsIDOMUIEvent)ev));
            }
            if (ev is nsIDOMMessageEvent)
            {
                return(DomMessageEventArgs.Create((nsIDOMMessageEvent)ev));
            }
            if (ev is nsIDOMSVGEvent)
            {
                return(DomSvgEvent.Create(( nsIDOMSVGEvent )ev));
            }
            return(new DomEventArgs(ev));
        }