       # Disable opening a link in a new window with middle click
       middlebutton = false
 
-      kill_href = (ev = window.event) ->
+      kill_href = (ev) ->
         a.href = 'javascript:void(0)'
         return
 
-      restore_href = (ev = window.event) ->
+      restore_href = (ev) ->
         a.href = href
         return
 
       Event.observe a, name, restore_href for name in ['mouseout', 'mouseover', 'focus', 'blur']
 
-      Event.observe a, 'mousedown', (ev = window.event) ->
+      Event.observe a, 'mousedown', (ev) ->
         if Event.isMiddleClick(ev)
           middlebutton = true
         return
 
-      Event.observe a, 'blur', (ev = window.event) ->
+      Event.observe a, 'blur', (ev) ->
         middlebutton = false
         return
 
-      Event.observe a, 'mouseup', (ev = window.event) ->
+      Event.observe a, 'mouseup', (ev) ->
         return unless Event.isMiddleClick(ev) && middlebutton
         kill_href()
         Event.stop(ev)

          false
      else
        uri = "data:text/html;charset=utf-8,#{encodeURIComponent(body)}"
        Event.observe a, 'click', (ev = window.event) ->
          @href = uri
          true


          """.replace(/>\s+/g, '>')

      if Prototype.Browser.IE
        Event.observe a, 'click', (ev) ->
          switch target = @target || '_self'
            when '_self', window.name
              win = window
