Opened 15 years ago

Closed 15 years ago

#4887 closed defect (invalid)

ArrayList.contains uses deprecated equality test

Reported by: guest Owned by: Tom Trenka
Priority: high Milestone:
Component: Dojox Version: 0.9
Keywords: arraylist contains Cc:
Blocked By: Blocking:


1.0b definition of ArrayList?.contains uses the == operator which has been deprecated as of JS 1.5 in favor of JSObject.equals.

this.contains=function(/* object */obj){
        //	summary
	//	Check to see if the passed object is a member in the ArrayList
	for(var i=0; i < items.length; i++){
		if(items[i] == obj) {
			return true;	//	bool
	return false;	//	bool

Change History (2)

comment:1 Changed 15 years ago by guest

Looking at Mozilla reference. Invalid.

comment:2 Changed 15 years ago by Tom Trenka

Resolution: invalid
Status: newclosed

Um...ok. So you're saying (no idea who, no email attached) using a standard == operator to compare object references has been deprecated and is wrong? I hate to say this but this is a standard operator, and I think the bug is kind of an unnecessary nitpick--particularly when you take into account JScript.

If anything, it should be the === operator.

The object you are referring to--JSObject--is actually a Java representation of a JavaScript? object. Why we would tap into a Java engine to test something standard like this is beyond me.

Marking this bug as invalid. Appreciate the look-over but not seeing anything here (particularly in terms of an object method) that would warrant changing this.

Note: See TracTickets for help on using tickets.