<commit_before>steal("can/view/parser","can-simple-dom", "can/util",function(canParser, simpleDOM, can){
	
	
	var oldBuildFrag = can.buildFragment;
	
	
	can.buildFragment = function(text, context){
		if(context.childNodes) {
			
			var parser = new simpleDOM.HTMLParser(function(string){
				
				var tokens = [];
				var currentTag,
					currentAttr;
				canParser(string, {
			    	start: function( tagName, unary ){
			    		current = { type: "StartTag", attributes: {}, tagName: tagName };
			    	},
					end: function( tagName, unary ){
						tokens.push(current);
						current = undefined;
					},
					close:     function( tagName ){
						tokens.push({type: "EndTag", tagName: tagName});
					},
					attrStart: function( attrName ){
						currentTag.attributes[attrName] = "";
						currentAttr = attrName;
					},
					attrEnd:   function( attrName ){},
					attrValue: function( value ){
						currentTag.attributes[currentAttr] += value;
					},
					chars:     function( value ){
						tokens.push({type:"Chars", chars: value});
					},
					comment:   function( value ){
						tokens.push({type:"Comment", chars: value});
					},
					special:   function( value ){},
					done:      function( ){}
			   });
			   
			   return tokens;
			}, context.ownerDocument || context, simpleDOM.voidMap);
			
			return parser.parse(text);
			
		} else {
			return oldBuildFrag.apply(this, arguments);
		}
	};
	
});
<commit_msg>makes vdom check the type of element better<commit_after>steal("can/view/parser","can-simple-dom", "can/util",function(canParser, simpleDOM, can){
	
	
	var oldBuildFrag = can.buildFragment;
	
	
	can.buildFragment = function(text, context){
		if(context && ((context.ownerDocument || context )!= can.global.document)) {
			
			var parser = new simpleDOM.HTMLParser(function(string){
				
				var tokens = [];
				var currentTag,
					currentAttr;
				canParser(string, {
			    	start: function( tagName, unary ){
			    		current = { type: "StartTag", attributes: {}, tagName: tagName };
			    	},
					end: function( tagName, unary ){
						tokens.push(current);
						current = undefined;
					},
					close:     function( tagName ){
						tokens.push({type: "EndTag", tagName: tagName});
					},
					attrStart: function( attrName ){
						currentTag.attributes[attrName] = "";
						currentAttr = attrName;
					},
					attrEnd:   function( attrName ){},
					attrValue: function( value ){
						currentTag.attributes[currentAttr] += value;
					},
					chars:     function( value ){
						tokens.push({type:"Chars", chars: value});
					},
					comment:   function( value ){
						tokens.push({type:"Comment", chars: value});
					},
					special:   function( value ){},
					done:      function( ){}
			   });
			   
			   return tokens;
			}, context.ownerDocument || context, simpleDOM.voidMap);
			
			return parser.parse(text);
			
		} else {
			return oldBuildFrag.apply(this, arguments);
		}
	};
	
});

{'fraction_non_alphanumeric': 0.14586160108548168, 'fraction_numerical': 0.0, 'mean_word_length': 2.6317733990147785, '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': '65279', 'n_tokens_mistral': 1202, 'n_tokens_neox': 870, 'n_words': 184}