javascript - Creating an `object` tag with `createElement` returns a function instead of an object -
javascript - Creating an `object` tag with `createElement` returns a function instead of an object -
could explain why getting different types when creating different elements?
typeof document.createelement('div') "object" typeof document.createelement('span') "object" typeof document.createelement('embed') "function" typeof document.createelement('object') "function"
these on firefox:
$ firefox --version (process:9436): glib-critical **: g_slice_set_config: assertion 'sys_page_size == 0' failed mozilla firefox 32.0.3
the es5 spec states object implements [[call]]
must reported typeof
"function"
.
a little handful of dom elements (object
, embed
, not many others) are callable / implement [[call]]
. historical reasons, fact remains can phone call them.
so firefox technically right in reporting them function
s. could, in fact, argue chrome et al. wrong (if sticking strictly es5 spec) study them object
s, since callable in browsers too. on other hand, browsers doing people 'expect'.
more details in bugzilla.
javascript dom
Comments
Post a Comment