Methods on IE

Mr.IE: "WRITE is a method of a document object."
The little fox: "yea"
Mr.IE: "And type of document.write is object."
The little fox: !?
The little fox: "Type of document.write must be function."
Mr.IE: "No! it's Object!!!"

Finally I couldn't understand what Mr.IE said.


javascript:var something=document.write;alert(typeof something);void(0);

"object" // IE6,IE7
"function" // Firefox

Does anyone knows any reasons?

[652 byte] By [coma] at [2007-12-24]
# 1

Hi Coma,

Can you explain in more detail what differences you are seeing. It's unclear what you mean by the "type of document.write is object" http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/write.asp?frame=true

Thanks
-Dave

DaveMassy at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...
# 2

Thanks for your reply.

Methods should be function on JavaScript/JScript/ECMAScript,
even if the method belongs to host objects, i thought.
But "document.write()", "window.alert()"... are not function
on IE.

- javascript:alert(document.write);

function write() { [native code] } // IE, Firefox

- javascript:alert(document.write instanceof Function);

false // IE
true // Firefox

- javascript:alert(typeof document.write);

object // IE
function // Firefox

These differences may cause some bugs.

How to Crash Internet Explorer
http://www.modernlifeisrubbish.co.uk/how-to-crash-internet-explorer.asp

coma at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...