Created
August 15, 2011 21:52
-
-
Save ibolmo/1147965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*<ltIE9>*/ | |
if (!window.addEventListener){ | |
var update = function(event){ | |
event.target.store('$change:last', event.type); | |
}; | |
Element.NativeEvents.propertychange = 2; | |
Element.Events.$change = { | |
base: 'change' | |
}; | |
Element.Events.change = { | |
base: 'click', | |
condition: function(event){ | |
var target = event.target; | |
return (event.type == 'change' || target.type == 'checkbox' || (target.type == 'radio' && target.retrieve('$change:last', '') == 'propertychange')); | |
}, | |
onAdd: function(fn){ | |
this.addEvents(this.retrieve('$change:events', { | |
keyup: update, | |
mouseup: update, | |
propertychange: update, | |
$change: function(event){ | |
var type = event.target.type; | |
if (type != 'radio' && type != 'checkbox') fn.call(this, event); | |
} | |
})); | |
}, | |
onRemove: function(){ | |
this.removeEvents(this.retrieve('$change:events')).eliminate('$change:events'); | |
} | |
}; | |
} | |
/*</ltIE9>*/ |
Christoph, bro, the regex sections are evaluated once per click (or even less in the _change case). Unless I can click 10,000 times a second, your comment is basically pedantic BS that will cause us to make the code more verbose.
That is not the point. Regex is not meant for simple equality checks.
Meet cpojer, diviner of regex's meaning in life
…On Aug 18, 2011 11:38 PM, "cpojer" < ***@***.***> wrote:
That is not the point. Regex is not meant for simple equality checks.
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1147965
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I won't accept unless all the regex is gone from this.