Closed Bug 828613 Opened 13 years ago Closed 13 years ago

typeof returns "function" for <object> element

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: df1986, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.91 Safari/537.11 Steps to reproduce: var node = document.createElement("object"); alert(typeof(node)); Actual results: A box containing the word "function" Expected results: A box containing the word "object"
OS: Linux → All
Hardware: x86_64 → All
Severity: normal → minor
I confirm on Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130114 Firefox/21.0
Assignee: nobody → general
Status: UNCONFIRMED → NEW
Component: Untriaged → JavaScript Engine
Ever confirmed: true
Product: Firefox → Core
Version: unspecified → Trunk
This is correct: HTML defines a legacycaller on HTMLObjectElement: <http://www.whatwg.org/html/#the-object-element> WebIDL defines that a a platform object that implements an interface with at least one legacy caller must implement [[Call]]: http://dev.w3.org/2006/webapi/WebIDL/#call ECMAScript defines that typeof returns "function" for "Object (native or host and does implement [[Call]])": http://ecma-international.org/ecma-262/5.1/#sec-11.4.3 (Paul, anything to do with HTML elements and DOM objects is most likely better suited for one of the DOM components than JS.)
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 13 years ago
Component: JavaScript Engine → DOM: Core & HTML
Resolution: --- → INVALID
(In reply to :Ms2ger from comment #2) > This is correct: Chrome shows "object". But I guess it's because of a different js engine ?
In Chrome, the [[Call]] appears and disappears dynamically or something, which is not allowed per spec. Please do file a bug on them, though!
(In reply to Boris Zbarsky (:bz) from comment #4) > Please do file a bug on them, though! Why shouldn't be this bug simply reopened?
Every other browser i've tested with returns "object". While a strict reading of the standards does lead to the conclusion of "function", it requires a few leaps of logic which I don't believe were intended consequences of the standard.
(In reply to Paul Silaghi [QA] from comment #5) > (In reply to Boris Zbarsky (:bz) from comment #4) > > Please do file a bug on them, though! > Why shouldn't be this bug simply reopened? Because the bug should be filed on Google Chrome; this is not Google Chrome's bug tracker. (In reply to DF from comment #6) > Every other browser i've tested with returns "object". While a strict > reading of the standards does lead to the conclusion of "function", it > requires a few leaps of logic which I don't believe were intended > consequences of the standard. I can assure you these consequences were intended.
I just noticed this. Which bug made this change? The migration to WebIDL? It can be a site compatibility issue...
On Google Chrome 26, the current Stable channel, typeof HTMLElement === 'function'
(In reply to Kohei Yoshino from comment #8) > I just noticed this. Which bug made this change? The migration to WebIDL? It > can be a site compatibility issue... It's been that way back to at least Firefox 2. (In reply to Kohei Yoshino from comment #9) > On Google Chrome 26, the current Stable channel, typeof HTMLElement === > 'function' Note that this bug is about typeof document.createElement("object").
Then it won't be any problem. Thanks for the answer!
You need to log in before you can comment on or make changes to this bug.