Skip to content

Commit

Permalink
Merge pull request #2203 from ibolmo/fix-2170-ie-Element-Event-change…
Browse files Browse the repository at this point in the history
…-propertychange

Fix 2170 ie element event change propertychange
  • Loading branch information
ibolmo committed Jan 18, 2012
2 parents d05c9fb + af074d3 commit bc70096
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Element/Element.Event.js
Expand Up @@ -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 this.type != 'radio' || (event.event.propertyName == 'checked' && this.checked);
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions Specs/1.4client/Element/Element.Event.js
Expand Up @@ -82,4 +82,32 @@ 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();

var text = new Element('input', {
'type': 'text',
'class': 'otherClass',
'value': 'text value'
}).addEvent('change', callback).inject(document.body);

text.removeClass('otherClass');
expect(callback).not.toHaveBeenCalled();

[input, text].invoke('destroy');
});

});

})();

0 comments on commit bc70096

Please sign in to comment.