RyanG
RyanG

Reputation: 7213

How does YUI tell web inspector / dev tools the type of an object?

So I recently noticed that when I console.log a YUI node and inspect its _node attribute, that object has fields like "childNodes: NodeList" where NodeList is just a JS object. How does YUI provide meta-information so that web inspector knows that this object is actually a NodeList?

It may be extremely useful for debugging to be able to provide meta type information for object blobs.

Thanks

Upvotes: 0

Views: 38

Answers (1)

Eric V
Eric V

Reputation: 2236

There is no meta-data. NodeList is the name of the class, and debuggers can see what class every object belongs to. In your example, somewhere a NodeList was created by calling

new NodeList();

and the engine remembers that type information.

Upvotes: 1

Related Questions