Permalink
Browse files

Fixes #2170.

Using DimitarChristoff's fix. See #2170 and #2172.

PASSED: IE6-9.
  • Loading branch information...
1 parent d05c9fb commit 5fa84899dc9dc134179cda9dd524963f5bb72f89 @ibolmo ibolmo committed Jan 17, 2012
Showing with 20 additions and 1 deletion.
  1. +1 −1 Source/Element/Element.Event.js
  2. +19 −0 Specs/1.4client/Element/Element.Event.js
@@ -175,7 +175,7 @@ if (!window.addEventListener){
return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change'
},
condition: function(event){
- return !!(this.type != 'radio' || this.checked);
+ return event.type == 'change' || !!this.checked && event.type == 'propertychange' && event.event.propertyName == 'checked';
}
}
}
@@ -82,4 +82,23 @@ describe('Element.Event', function(){
});
+describe('Element.Event.change', function(){
+
+ it('should not fire "change" for any property', function(){
+ var callback = jasmine.createSpy('Element.Event.change');
+
+ var input = new Element('input', {
+ 'type': 'radio',
+ 'class': 'someClass',
+ 'checked': 'checked'
+ }).addEvent('change', callback).inject(document.body);
+
+ input.removeClass('someClass');
+ expect(callback).not.toHaveBeenCalled();
+
+ input.destroy();
+ });
+
+});
+
})();

0 comments on commit 5fa8489

Please sign in to comment.