<commit_before>
mi2JS.comp.add('base/InputBase', 'Base', '',

// component initializer function that defines constructor and adds methods to the prototype 
function(proto, superProto, comp, superComp){

	var mi2 = mi2JS; // minimizer friendly

	proto.construct = function(el, parent){
		superProto.construct.call(this, el, parent);
		
		if(this.hasAttr('in-filter'))
			this.inFilter = mi2.parseFilter(this.attr('in-filter'));
		
		if(this.hasAttr('out-filter'))
			this.outFilter = mi2.parseFilter(this.attr('out-filter'));		
	};

	proto.setReadOnly = function(readOnly){
		this.attr('readonly', readOnly ? '':null);
	};

	proto.isReadOnly = function(readOnly){
		return this.hasAttr('readonly');
	};

	proto.setValue = function(value){
		this.setRawValue( mi2.filter(value, this.inFilter) );
	};

	proto.getValue = function(){
		return mi2.filter( this.getRawValue(), this.outFilter );
	};

	proto.markValidate = function(data){
		mi2.markValidate(this,data);
	};

	proto.fireIfChanged = function(evt){
		if(this.timer) clearTimeout(this.timer);// avoid event bursts

		this.timer = this.setTimeout(function(){
			var old = this.oldValue;
			var value = this.getValue();
			if(value !== old){
				this.oldValue = value;
				this.fireEvent('change',{oldValue:old, value: value});
			}
		},50);
	};

});<commit_msg>separate change check from fireifChanged<commit_after>
mi2JS.comp.add('base/InputBase', 'Base', '',

// component initializer function that defines constructor and adds methods to the prototype 
function(proto, superProto, comp, superComp){

	var mi2 = mi2JS; // minimizer friendly

	proto.construct = function(el, parent){
		superProto.construct.call(this, el, parent);
		
		if(this.hasAttr('in-filter'))
			this.inFilter = mi2.parseFilter(this.attr('in-filter'));
		
		if(this.hasAttr('out-filter'))
			this.outFilter = mi2.parseFilter(this.attr('out-filter'));		
	};

	proto.setReadOnly = function(readOnly){
		this.attr('readonly', readOnly ? '':null);
	};

	proto.isReadOnly = function(readOnly){
		return this.hasAttr('readonly');
	};

	proto.setValue = function(value){
		this.setRawValue( mi2.filter(value, this.inFilter) );
        this.oldValue = this.getValue();
	};

	proto.getValue = function(){
		return mi2.filter( this.getRawValue(), this.outFilter );
	};

	proto.markValidate = function(data){
		mi2.markValidate(this,data);
	};

	proto.checkChanged = function(old, value){
		return value !== old;
	};
	proto.fireIfChanged = function(evt){
		if(this.timer) clearTimeout(this.timer);// avoid event bursts
		this.timer = this.setTimeout(this.fireIfChangedNow,50);
	};
	proto.fireIfChangedNow = function(evt){
		var old = this.oldValue;
		var value = this.getValue();
		if(this.checkChanged(old, value)){
			this.oldValue = value;
			this.fireEvent('change',{oldValue:old, value: value});
		}
	};

});
{'fraction_non_alphanumeric': 0.16219081272084807, 'fraction_numerical': 0.007067137809187279, 'mean_word_length': 4.529296875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1420362', 'n_tokens_mistral': 1010, 'n_tokens_neox': 931, 'n_words': 177}