This strikes me as almost a little bit too much sugar...to streamline this type of binding/filtering, I tend to think it might just be easier to perhaps use the jQuery.ui.keyCode object and move that into core, perhaps? I think the idea is to save people needing to do the keycode lookups, not necessarily complicate the event binding syntax.
On Jan 2, 7:57 pm, Mark Gibson <jollyt...@gmail.com> wrote: > I guess it would be possible to initialize the codes array the first > time it was needed by the combo function, I've never tried profiling > the code so I don't know if it would really give us much advantage. > After a quick glance over the code (it's been a while since i've > looked at it), it may indeed make sense to do that as all that > initialization would then only happen if a key press occurred on an > element bound using the "key:..." namespace. > > I've pushed the idea to a new branch (completely > untested):http://github.com/jollytoad/jquery.keys/blob/ondemand/src/keys.core.js > > 2010/1/2 Jeremy Chone <jeremy.ch...@gmail.com>: > > > > > Thanks Mark, your plugin looks interesting. Do you think it would be > > possible to do kc(...) initialization on demand? > > > On Jan 2, 1:17 am, Mark Gibson <jollyt...@gmail.com> wrote: > >> Hi Jeremy, > >> I created a plugin a while ago, very similar to what you are > >> suggesting, it will only work with jQuery 1.4 though as it uses the > >> special event registration hooks. > > >>http://github.com/jollytoad/jquery.keys/blob/master/src/keys.core.js > > >> - Mark Gibson > > >> 2010/1/1 Jeremy Chone <jeremy.ch...@gmail.com>: > > >> > Hi, > > >> > Any thought has been given on adding filter on event. For example > > >> > a) Called when enter will be pressed. > > >> > $("#myTextInputField").bind("keypress:enter",function(e){...}); > > >> > b) Called when a digit is pressed. > > >> > $("#myTextInputField").bind("keypress:0-9",function(e){...}); > > >> > c) Called when mouseenter with the key shift is pressed > > >> > $("#myTextInputField").bind("mouseenter:shift",function(e){...}); > > >> > d) Called when mouseenter with the keys shift and ctrl are pressed > > >> > $("#myTextInputField").bind("mouseenter:shift&ctrl",function(e){...}); > > >> > I am not sure this would be the right notation, but it will definitely > >> > simplify some code and make it less error prone. > > >> > Jeremy, > > >> > -- > > >> > You received this message because you are subscribed to the Google > >> > Groups "jQuery Development" group. > >> > To post to this group, send email to jquery-...@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > jquery-dev+unsubscr...@googlegroups.com. > >> > For more options, visit this group > >> > athttp://groups.google.com/group/jquery-dev?hl=en. > > > -- > > > You received this message because you are subscribed to the Google Groups > > "jQuery Development" group. > > To post to this group, send email to jquery-...@googlegroups.com. > > To unsubscribe from this group, send email to > > jquery-dev+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/jquery-dev?hl=en. -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.