javascript - Creating an `object` tag with `createElement` returns a function instead of an object -


Can someone tell me why I'm getting different types while creating different elements? Type of document Document.createElement ('object') "function" document.createElement ('object') "function" type.createElement ('div') "object" type of document. CreateElement ('span') "object" typeof document.createElement ('embed') "function" type of form.

These are on Firefox:

  $ firefox --version (process: 9436): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' Mozilla failed Firefox 32.0.3  

ES5 device that implements an object [ [Call]] should be reported as a typeof "function" .

A small handful of DOM elements ( object , embeds , many others are not) are callable / Apply [[call]] .

So Firefox is technically correct in reporting them as function s. You can actually argue that Chrome et al is wrong (if the ES5 device is strictly To paste them) to report them as object s, because they are also qualified in those browsers, on the other hand, those browsers are doing what most people would probably 'hope'.

More details are inside.


Comments