Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#8937 closed defect (fixed)

[patch][ccla]isFunction() unit test failing on opera

Reported by: bill Owned by: anonymous
Priority: high Milestone: 1.3
Component: Core Version: 1.3.0b3
Keywords: Cc: James Burke, dylanks
Blocked By: Blocking:

Description

      _AssertFailure: [Object:

 name: doh._AssertFailure
]: assertFalse('true') failed
  [Object:

 name: doh._AssertFailure
]
      ERROR IN:
 		 function isFunction(t){
			t.assertTrue(dojo.isFunction(new Function()));
			t.assertTrue(dojo.isFunction(isFunction));
			if(dojo.isBrowser){ // test the Safari workaround for NodeList
				t.assertFalse(dojo.isFunction(dojo.doc.getElementsByName("html")));
			}
		}
  FAILED test: isFunction 0 ms

Attachments (1)

8937.patch (490 bytes) - added by Adam Peller 11 years ago.
Workaround to strange Opera bug

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by bill

Priority: normalhigh

Changed 11 years ago by Adam Peller

Attachment: 8937.patch added

Workaround to strange Opera bug

comment:2 Changed 11 years ago by Adam Peller

Cc: James Burke dylanks added

It's failing on the test case for isFunction(nodelist). Strangely, typeof it is "object" when the arg is a nodelist, and comparing it to "function" is false when done outside a function, but inside a function, comparing typeof it to "function" is true! Comparing typeof it to "object" is also true. How can that be, you wonder? Me too.

Assigning the typeof expression to a variable before doing the assignment comes up with the right result.

Bill, James, is it worth polluting base with the extra bytes to cover this? Seems about as low risk a patch as you can get.

Dylan, do you know how to contact Opera?

var x=document.getElementsByName("html");
alert(typeof x); // object
alert((typeof x) == "object"); // true
alert((typeof x) == "function"); // false, works here!

var foo = function(){
  var y=document.getElementsByName("html");
  alert(typeof y); // object
  alert((typeof y) == "object"); // true
  alert((typeof y) == "function"); // true, should be false
};

comment:3 Changed 11 years ago by Adam Peller

Summary: isFunction() unit test failing on opera[patch][ccla]isFunction() unit test failing on opera

comment:4 Changed 11 years ago by James Burke

Adam, I'm fine with it going in base for now, but we should remove it as soon as Opera has a fix. I imagine it is something they would want to fix sooner rather than later.

comment:5 Changed 11 years ago by James Burke

Resolution: fixed
Status: newclosed

I applied peller's patch in [17077], but we should report the issue to Opera. If Dylan does not have a direct contact, maybe we can use this to report the bug:

https://bugs.opera.com/wizard/

comment:6 Changed 11 years ago by Adam Peller

Filed a report at the wizard site above, for now. Reference is DSK-249581 at bugs.opera.com

Note: See TracTickets for help on using tickets.