I was looking at some code on the web and couldn't figure out what the purpose of the relatedObject property of a DOM object was:
this.hotspot = document.createElement('div');
this.hotspot.relatedObject = this;
Anyone have an idea?
I was looking at some code on the web and couldn't figure out what the purpose of the relatedObject property of a DOM object was:
this.hotspot = document.createElement('div');
this.hotspot.relatedObject = this;
Anyone have an idea?
This isn't a standard property. It's probably just a method of binding a JS object to a particular HTML element, for example to be able to retrieve the object easily in an event handler later on.
I do not believe this is a standard property, but rather a property that is being created by virtue of assigning it to hotspot, probably to track the reference of the object that created it.