In terms of language, what do I need to return when I take an element from the DOM as such:
var obj = document.getElementById('foo');
It has properties, so I thought that maybe it could be an object literal. Using type checks, I determined that this is not an object literal, nor is it an array literal.
I know what it is used for and how to use it, just not what it is, technically speaking the language.
I checked this through this test, which I call the test for abstract object .
obj === Object(obj);
which it returns false.
I know that I can identify node elements as such
obj.nodeType === 1
but still it doesnβt tell me what it is, in terms of language (ES5). What is an element expressed in terms of language?
Explanation
I mean a language based on grammar, JavaScript, the Good Part, chapter 2, This grammar only knows how to deal with language components, arrays, objects, etc.
source share