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 functions. could, in fact, argue chrome et al. wrong (if sticking strictly es5 spec) study them objects, since callable in browsers too. on other hand, browsers doing people 'expect'.

more details in bugzilla.

javascript dom

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -