Bug Tracker

Opened 13 years ago

Closed 11 years ago

#1256 closed bug (fixed)

Error involving e.which/e.keycode

Reported by: bgoldman Owned by: brandon
Priority: minor Milestone: 1.1.3
Component: event Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:

Description

Here's a paste from FireBug:

setting a property that has only a getter fix(keypress charCode=118, keyCode=0)jquery.js (line 2976) handle(keypress charCode=118, keyCode=0)jquery.js (line 2923) handle()jquery.js (line 2812) [Break on this error] event.which = event.keyCode;

Change History (6)

comment:1 Changed 13 years ago by brandon

Resolution: fixed
Status: newclosed

This is fixed in Rev [2009]

comment:2 Changed 13 years ago by brandon

Component: ajaxevent

comment:3 Changed 11 years ago by beerman

Resolution: fixed
Status: closedreopened
$(document).ready(
  function() {
    $(window).keypress(function (e) {
      if ( (e.which == null && e.type == "keypress") && event.keyCode != null ) e.which = e.keyCode;
        if( (e.keyCode == 0xA || e.keyCode == 0xD) && e.ctrlKey) {
          if (window.getSelection) {
            var selectedText = window.getSelection();
          }
          else if (document.getSelection) {
            var selectedText = document.getSelection();
          }
          else if (document.selection) {
            var selectedText = document.selection.createRange().text;
          }
          $.ajax({
          type: "POST",
          url: "errorsc",
          data: {text:[selectedText], pageurl:[window.location.href]},
          success: function(msg) {
            alert(msg);
          }
        });
      }
    });
  });

FireBug says: setting a property that has only a getter

comment:4 in reply to:  3 Changed 11 years ago by beerman

change

data: {text:[selectedText], pageurl:[window.location.href]},

to

data: {text:""+selectedText+"", pageurl:[window.location.href]},

and enjoy

comment:5 Changed 11 years ago by dmethvin

Owner: set to brandon
Status: reopenednew

comment:6 Changed 11 years ago by brandon

Resolution: fixed
Status: newclosed

I'm not able to reproduce this. Feel free to attach a test case that illustrates the bug.

Note: See TracTickets for help on using tickets.