Strange results of typeof operator on DOM node element (angular 1)

57 views Asked by At

I have a question regarding typeof DOM node.

Is that ok that Safari 5.1.7 on Windows return "function"?

typeof document.getElementsByTagName('head') === "function",

but on chrome

typeof document.getElementsByTagName('head') === "object"

This causes Angular 1 to break down on getting "jqLite" element:

jqLite(document.getElementsByTagName('head')) === Object[0]

as there are check in angular.js 1.6.1:

function JQLite(element) {
  //...
  if (argIsString) {
    jqLiteAddNodes(this, jqLiteParseHTML(element));
  } else if (isFunction(element)) {
    //it returns true
    jqLiteReady(element);
  } else {
    jqLiteAddNodes(this, element);
  }

So basically my question is it suppose that isFunction called with dom element parameter return true? Is it Safari bug or not?

0

There are 0 answers