rem: test("attr(String, Object)", function() { expect(16); var div = $("div"); div.attr("foo", "bar"); var pass = true; for ( var i = 0; i < div.size(); i++ ) { if ( div.get(i).getAttribute('foo') != "bar" ) pass = false; } ok( pass, "Set Attribute" );  ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );  $("#name").attr('name', 'something'); ok( $("#name").attr('name') == 'something', 'Set name attribute' ); $("#check2").attr('checked', true); ok( document.getElementById('check2').checked == true, 'Set checked attribute' ); $("#check2").attr('checked', false); ok( document.getElementById('check2').checked == false, 'Set checked attribute' ); $("#text1").attr('readonly', true); ok( document.getElementById('text1').readOnly == true, 'Set readonly attribute' ); $("#text1").attr('readonly', false); ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' ); $("#name").attr('maxlength', '5'); ok( document.getElementById('name').maxLength == '5', 'Set maxlength attribute' ); $("#name").attr('maxLength', '10'); ok( document.getElementById('name').maxLength == '10', 'Set maxlength attribute' );   $("#name").attr('someAttr', '0'); equals( $("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' ); $("#name").attr('someAttr', 0); equals( $("#name").attr('someAttr'), 0, 'Set attribute to the number 0' ); $("#name").attr('someAttr', 1); equals( $("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );  reset();  var type = $("#check2").attr('type'); var thrown = false; try { $("#check2").attr('type','hidden'); } catch(e) { thrown = true; } ok( thrown, "Exception thrown when trying to change type property" ); equals( type, $("#check2").attr('type'), "Verify that you can't change the type of an input element" );  var check = document.createElement("input"); var thrown = true; try { $(check).attr('type','checkbox'); } catch(e) { thrown = false; } ok( thrown, "Exception thrown when trying to change type property" ); equals( "checkbox", $(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" ); }); 
add: $("div").attr({foo: 'baz', zoo: 'ping'}).each(function(){ if ( this.getAttribute('foo') != "baz" && this.getAttribute('zoo') != "ping" ) pass = false; }); 
context: test("attr(String, Object)", function() {	expect(16);	var div = $("div");	div.attr("foo", "bar");	var pass = true;	for ( var i = 0; i < div.size(); i++ ) {	  if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;	}	ok( pass, "Set Attribute" );	ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );			$("#name").attr('name', 'something');	ok( $("#name").attr('name') == 'something', 'Set name attribute' );	$("#check2").attr('checked', true);	ok( document.getElementById('check2').checked == true, 'Set checked attribute' );	$("#check2").attr('checked', false);	ok( document.getElementById('check2').checked == false, 'Set checked attribute' );	$("#text1").attr('readonly', true);	ok( document.getElementById('text1').readOnly == true, 'Set readonly attribute' );	$("#text1").attr('readonly', false);	ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );	$("#name").attr('maxlength', '5');	ok( document.getElementById('name').maxLength == '5', 'Set maxlength attribute' );	$("#name").attr('maxLength', '10');	ok( document.getElementById('name').maxLength == '10', 'Set maxlength attribute' );	// for #1070	$("#name").attr('someAttr', '0');	equals( $("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' );	$("#name").attr('someAttr', 0);	equals( $("#name").attr('someAttr'), 0, 'Set attribute to the number 0' );	$("#name").attr('someAttr', 1);	equals( $("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );	reset();	var type = $("#check2").attr('type');	var thrown = false;	try {		$("#check2").attr('type','hidden');	} catch(e) {		thrown = true;	}	ok( thrown, "Exception thrown when trying to change type property" );	equals( type, $("#check2").attr('type'), "Verify that you can't change the type of an input element" );	var check = document.createElement("input");	var thrown = true;	try {		$(check).attr('type','checkbox');	} catch(e) {		thrown = false;	}	ok( thrown, "Exception thrown when trying to change type property" );	equals( "checkbox", $(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );});
meta: 1375	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/1375/76e3a901530609d3c4a695ccb8a48251445c6861/core.js/buggy/test/unit/core.js