<commit_before><!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Tests</title>
 
  <link rel="stylesheet" href="qunit-1.18.0.css">
  <script src="qunit-1.18.0.js"></script>  
  <script src="../js/polyfills.js"></script>
  <script src="../js/simpleQuery.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>-->
  <style>
		.cssTest {
			font-size: 30px;
		}
  </style>
 
  <script>
	sQ = simpleQuery;
	QUnit.test("sQ: selectors", function( assert ) {
		var done = assert.async();
		var selectors = [
			'#test div',
			'#test [data-city="katowice"]',
			'div div'
		];
		$(function() {
			selectors.forEach(function(selector) {
				var jqres = JSON.stringify($(selector).toArray());
				var sqres = JSON.stringify(sQ(selector).toArray());
				assert.equal(sqres, jqres, 'Selector: ' + selector);
			});
			done()
		});		
	});	
	
	QUnit.test("sQ: find", function( assert ) {
		var done = assert.async();
		var selectors = [
			['#test div', 'div', '(fails if unique is not used)'],
			['#test [data-city="katowice"]', 'div', '']			
		];
		$(function() {
			selectors.forEach(function(selector) {
				var jqres = JSON.stringify($(selector[0]).find(selector[1]).toArray());
				var sqres = JSON.stringify(sQ(selector[0]).find(selector[1]).toArray());
				assert.equal(sqres, jqres, 'Selector: ' + selector[0] + " -> " + selector[1] + '   ' + selector[2]);
			});
			done()
		});		
	});	
	
	QUnit.test("sQ: length, append, addClass, html, detached node", function( assert ) {
		var done = assert.async();		
		var test = function(lib) {
			var el = lib('<div></div>');
			el.append(lib('<span>blabla</span>').addClass('someClass'));
			el.append(lib('<span>notbla</span>').addClass('otherClass'));
			el.find('.otherClass').addClass('superClass');
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);
			assert.equal(sqel.html(), jqel.html(), 'innerHTMLs are equal (cross check with jQuery)');						
			assert.equal(sqel.find('.otherClass').length, 1, 'selector ".otherClass" on detached node, returns 1 element ');			
			assert.equal(sqel.find('.otherClass').html(), jqel.find('.otherClass').html(), 'selector on detached nodes: innerHTMLs are equal (cross check with jQuery)');			
			assert.equal(sqel.find('.otherClass').toArray()[0], sqel.find('.superClass').toArray()[0], 'Every element with class otherClass should have class superClass. Elements comparision.');			
			assert.equal(sqel.find('.superClass').html(), jqel.find('.superClass').html(), 'Every element with class otherClass should have class superClass (cross check with jQuery)');			
			assert.notEqual(sqel.toArray(), jqel.toArray(), 'Nodes are different');			
			done()
		});		
	});		
	QUnit.test("sQ: first, last, eq", function( assert ) {
		var done = assert.async();		
		var test = function(lib) {
			var el = lib('#test div, #test2 div');			
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);			
			assert.equal(sqel.first().html(), jqel.first().html(), '.first(): innerHTMLs are equal (cross check with jQuery)');
			assert.equal(sqel.first().toArray()[0], jqel.first().toArray()[0], '.first(): nodes are equal (cross check with jQuery)');
			assert.equal(sqel.eq(4).html(), 'zyx', '.eq(4): innerHTML equals "zyx"');
			assert.equal(sqel.eq(4).html(), jqel.eq(4).html(), '.eq(4): innerHTMLs are equal (cross check with jQuery)');
			assert.equal(sqel.eq(4).toArray()[0], jqel.eq(4).toArray()[0], '.eq(4): nodes are equal (cross check with jQuery)');
			assert.equal(sqel.last().html(), jqel.last().html(), '.last(): innerHTMLs are equal (cross check with jQuery)');
			assert.equal(sqel.last().toArray()[0], jqel.last().toArray()[0], '.last(): nodes are equal (cross check with jQuery)');			
			done()
		});		
	});		
	
	QUnit.test("sQ: length, append, addClass, html, detached node", function( assert ) {
		var done = assert.async();		
		var test = function(lib) {
			var el = lib('<div></div>');
			el.append(lib('<span>blabla</span>').addClass('someClass'));
			el.append(lib('<span>notbla</span>').addClass('otherClass'));
			el.find('.otherClass').addClass('superClass');
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);
			assert.equal(sqel.html(), jqel.html(), 'innerHTMLs are equal (cross check with jQuery)');						
			assert.equal(sqel.find('.otherClass').length, 1, 'selector ".otherClass" on detached node, returns 1 element ');			
			assert.equal(sqel.find('.otherClass').html(), jqel.find('.otherClass').html(), 'selector on detached nodes: innerHTMLs are equal (cross check with jQuery)');			
			assert.equal(sqel.find('.otherClass').toArray()[0], sqel.find('.superClass').toArray()[0], 'Every element with class otherClass should have class superClass. Elements comparision.');			
			assert.equal(sqel.find('.superClass').html(), jqel.find('.superClass').html(), 'Every element with class otherClass should have class superClass (cross check with jQuery)');			
			assert.notEqual(sqel.toArray(), jqel.toArray(), 'Nodes are different');			
			done()
		});		
	});		
	QUnit.test("sQ: css", function( assert ) {		
		var test = function(lib) {
			var el = lib('<div>fn.css test</div>').addClass('cssTest');			
			el
				.css({color: 'yellowgreen', border: '2px solid yellowgreen'})
				.append( lib('<span> dont fail</span>').css('color', 'navy') );			
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);			
			sQ('body')
				.append( sQ('<h2>fn.css test</h2>') )
				.append( sQ('<h3>jQuery res</h3>') )
				.append( jqel )
				.append( sQ('<h3>simpleQuery res</h3>') )
				.append( sqel );
				
			assert.equal(
				sqel.css('width'), 
				jqel.css('width'), 
				'css("width") are equal (cross check with jQuery) = ' + jqel.css('width') +
				' - simpleQuery doesnt check defaults and values defined in stylesheets'
			);
			assert.equal(sqel.css('color'), jqel.css('color'), 'css("color") are equal (cross check with jQuery) = ' + jqel.css('color'));			
			assert.equal(
				sqel.find('span').css('color'), 
				jqel.find('span').css('color'), 
				'find("span").css("color") are equal (cross check with jQuery)'
			);			
			assert.equal(
				sqel.css('border'), 
				jqel.css('border'), 
				'css("border") are equal (cross check with jQuery) - '
			);						
			assert.equal(
				sqel.find('span').css('border'), 
				jqel.find('span').css('border'), 
				'find("span").css("border") are equal (cross check with jQuery) - ' +
				'simpleQuery doesnt check defaults and values defined in stylesheets'
			);						
			assert.equal(
				sqel.css({'background': 'transparent'}).html(), 
				jqel.css({'background': 'transparent'}).html(), 
				'elements returned from css are identical (cross check with jQuery using .html())'
			);	
			
			sqel.css('fontSize', '40px');
			jqel.css('fontSize', '40px');
			assert.equal(
				sqel.css('fontSize'), 
				jqel.css('fontSize'), 
				'css("fontSize") are equal (cross check with jQuery) = ' + jqel.css('fontSize')
			);
			sqel.css('fontSize', '');
			jqel.css('fontSize',  '');
			assert.equal(
				sqel.css('fontSize'), 
				jqel.css('fontSize'), 
				'css("fontSize") arent equal after removal of property(cross check with jQuery) = ' + jqel.css('fontSize') +
				' ----  simpleQuery doesnt check values defined in stylesheets'
			);			
		});		
	});		<commit_msg>Update index.htm<commit_after><!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Tests</title>
 
  <link rel="stylesheet" href="qunit-1.18.0.css">
  <script src="qunit-1.18.0.js"></script>  
  <script src="../js/polyfills.js"></script>
  <script src="../js/simpleQuery.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>-->
  <style>
		.cssTest {
			font-size: 30px;
		}
  </style>
 
  <script>
	sQ = simpleQuery;
	QUnit.test("sQ: selectors", function( assert ) {
		var done = assert.async();
		var selectors = [
			'#test div',
			'#test [data-city="katowice"]',
			'div div'
		];
		$(function() {
			selectors.forEach(function(selector) {
				var jqres = JSON.stringify($(selector).toArray());
				var sqres = JSON.stringify(sQ(selector).toArray());
				assert.equal(sqres, jqres, 'Selector: ' + selector);
			});
			done()
		});		
	});	
	
	QUnit.test("sQ: find", function( assert ) {
		var done = assert.async();
		var selectors = [
			['#test div', 'div', '(fails if unique is not used)'],
			['#test [data-city="katowice"]', 'div', '']			
		];
		$(function() {
			selectors.forEach(function(selector) {
				var jqres = JSON.stringify($(selector[0]).find(selector[1]).toArray());
				var sqres = JSON.stringify(sQ(selector[0]).find(selector[1]).toArray());
				assert.equal(sqres, jqres, 'Selector: ' + selector[0] + " -> " + selector[1] + '   ' + selector[2]);
			});
			done()
		});		
	});	
	
	QUnit.test("sQ: length, append, addClass, html, detached node", function( assert ) {
		var done = assert.async();		
		var test = function(lib) {
			var el = lib('<div></div>');
			el.append(lib('<span>blabla</span>').addClass('someClass'));
			el.append(lib('<span>notbla</span>').addClass('otherClass'));
			el.find('.otherClass').addClass('superClass');
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);
			assert.equal(sqel.html(), jqel.html(), 'innerHTMLs are equal (cross check with jQuery)');						
			assert.equal(sqel.find('.otherClass').length, 1, 'selector ".otherClass" on detached node, returns 1 element ');			
			assert.equal(sqel.find('.otherClass').html(), jqel.find('.otherClass').html(), 'selector on detached nodes: innerHTMLs are equal (cross check with jQuery)');			
			assert.equal(sqel.find('.otherClass').toArray()[0], sqel.find('.superClass').toArray()[0], 'Every element with class otherClass should have class superClass. Elements comparision.');			
			assert.equal(sqel.find('.superClass').html(), jqel.find('.superClass').html(), 'Every element with class otherClass should have class superClass (cross check with jQuery)');			
			assert.notEqual(sqel.toArray(), jqel.toArray(), 'Nodes are different');			
			done()
		});		
	});		
	QUnit.test("sQ: first, last, eq", function( assert ) {
		var done = assert.async();		
		var test = function(lib) {
			var el = lib('#test div, #test2 div');			
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);			
			assert.equal(sqel.first().html(), jqel.first().html(), '.first(): innerHTMLs are equal (cross check with jQuery)');
			assert.equal(sqel.first().toArray()[0], jqel.first().toArray()[0], '.first(): nodes are equal (cross check with jQuery)');
			assert.equal(sqel.eq(4).html(), 'zyx', '.eq(4): innerHTML equals "zyx"');
			assert.equal(sqel.eq(4).html(), jqel.eq(4).html(), '.eq(4): innerHTMLs are equal (cross check with jQuery)');
			assert.equal(sqel.eq(4).toArray()[0], jqel.eq(4).toArray()[0], '.eq(4): nodes are equal (cross check with jQuery)');
			assert.equal(sqel.last().html(), jqel.last().html(), '.last(): innerHTMLs are equal (cross check with jQuery)');
			assert.equal(sqel.last().toArray()[0], jqel.last().toArray()[0], '.last(): nodes are equal (cross check with jQuery)');			
			done()
		});		
	});		
	
	QUnit.test("sQ: length, append, addClass, html, detached node", function( assert ) {
		var done = assert.async();		
		var test = function(lib) {
			var el = lib('<div></div>');
			el.append(lib('<span>blabla</span>').addClass('someClass'));
			el.append(lib('<span>notbla</span>').addClass('otherClass'));
			el.find('.otherClass').addClass('superClass');
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);
			assert.equal(sqel.html(), jqel.html(), 'innerHTMLs are equal (cross check with jQuery)');						
			assert.equal(sqel.find('.otherClass').length, 1, 'selector ".otherClass" on detached node, returns 1 element ');			
			assert.equal(sqel.find('.otherClass').html(), jqel.find('.otherClass').html(), 'selector on detached nodes: innerHTMLs are equal (cross check with jQuery)');			
			assert.equal(sqel.find('.otherClass').toArray()[0], sqel.find('.superClass').toArray()[0], 'Every element with class otherClass should have class superClass. Elements comparision.');			
			assert.equal(sqel.find('.superClass').html(), jqel.find('.superClass').html(), 'Every element with class otherClass should have class superClass (cross check with jQuery)');			
			assert.notEqual(sqel.toArray(), jqel.toArray(), 'Nodes are different');			
			done()
		});		
	});		
	QUnit.test("sQ: css", function( assert ) {		
		var test = function(lib) {
			var el = lib('<div>fn.css test</div>').addClass('cssTest');			
			el
				.css({color: 'yellowgreen', border: '2px solid yellowgreen'})
				.append( lib('<span> dont fail</span>').css('color', 'navy') );			
			return el;
		}
		$(function() {			
			var sqel = test(sQ);
			var jqel = test($);			
			sQ('body')
				.append( sQ('<h2>fn.css test</h2>') )
				.append( sQ('<h3>jQuery res</h3>') )
				.append( jqel )
				.append( sQ('<h3>simpleQuery res</h3>') )
				.append( sqel );
				
			assert.equal(
				sqel.css('width'), 
				jqel.css('width'), 
				'css("width") are equal (cross check with jQuery) = ' + jqel.css('width') +
				' - simpleQuery doesnt check defaults and values defined in stylesheets'
			);
			assert.equal(sqel.css('color'), jqel.css('color'), 'css("color") are equal (cross check with jQuery) = ' + jqel.css('color'));			
			assert.equal(
				sqel.find('span').css('color'), 
				jqel.find('span').css('color'), 
				'find("span").css("color") aren\'t equal (simpleQuery doesn\'t return color value in rgba)'
			);			
			assert.equal(
				sqel.css('border'), 
				jqel.css('border'), 
				'css("border") aren\'t equal (simpleQuery doesn\'t return color value in rgba)'
			);						
			assert.equal(
				sqel.find('span').css('border'), 
				jqel.find('span').css('border'), 
				'find("span").css("border") are equal (cross check with jQuery) - ' +
				'simpleQuery doesnt check defaults and values defined in stylesheets'
			);						
			assert.equal(
				sqel.css({'background': 'transparent'}).html(), 
				jqel.css({'background': 'transparent'}).html(), 
				'elements returned from css are identical (cross check with jQuery using .html())'
			);	
			
			sqel.css('fontSize', '40px');
			jqel.css('fontSize', '40px');
			assert.equal(
				sqel.css('fontSize'), 
				jqel.css('fontSize'), 
				'css("fontSize") are equal (cross check with jQuery) = ' + jqel.css('fontSize')
			);
			sqel.css('fontSize', '');
			jqel.css('fontSize',  '');
			assert.equal(
				sqel.css('fontSize'), 
				jqel.css('fontSize'), 
				'css("fontSize") arent equal after removal of property(cross check with jQuery) = ' + jqel.css('fontSize') +
				' ----  simpleQuery doesnt check values defined in stylesheets'
			);			
		});		
	});		
{'fraction_non_alphanumeric': 0.20457873020098497, 'fraction_numerical': 0.007719952083056036, 'mean_word_length': 3.690074906367041, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 91, 'https://': 4, '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': '4353260', 'n_tokens_mistral': 5973, 'n_tokens_neox': 5090, 'n_words': 1103}