Bug 1812508 Comment 1 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

There is the following log :
`adding to cache with property: undefined cid: 1502`, which I put inside the `addToMap` function:

```js
	addToMap: function addToMap(obj, instance) {
		var teardown;

		// Setup a fresh mapping if `madeMap` is missing.
		if (!madeMap) {
			teardown = teardownMap;
			madeMap = {};
		}

		// Record if Object has a `_cid` before adding one.
		var hasCid = obj._cid;
		var cid = canCid_1_3_1_canCid(obj);


		// Only update if there already isn't one already.
		if (!madeMap[cid]) {

            if (!cid) {
                console.log('adding to cache with property:', cid, 'cid:', obj._cid)
            }

			madeMap[cid] = {
				obj: obj,
				instance: instance,
				added: !hasCid
			};
		}
		return teardown;
	},
```
It's unclear why `var cid = canCid_1_3_1_canCid(obj);` is undefined , as it's clearly defined, coming from this function:

```js
var cid = function (object, name) {
	var propertyName = object.nodeName ? domExpando : "_cid";

	if (!object[propertyName]) {
		_cid++;
		object[propertyName] = (name || '') + _cid;
	}

	return object[propertyName];
};
```
FWIW, if I put `if(!object[propertyName]) console.log(object[propertyName])` right before return, it returns a proper value and everything works as expected.
There is the following log :
`adding to cache with property: undefined cid: ...`, which I put inside the `addToMap` function:

```js
	addToMap: function addToMap(obj, instance) {
		var teardown;

		// Setup a fresh mapping if `madeMap` is missing.
		if (!madeMap) {
			teardown = teardownMap;
			madeMap = {};
		}

		// Record if Object has a `_cid` before adding one.
		var hasCid = obj._cid;
		var cid = canCid_1_3_1_canCid(obj);


		// Only update if there already isn't one already.
		if (!madeMap[cid]) {

            if (!cid) {
                console.log('adding to cache with property:', cid, 'cid:', obj._cid)
            }

			madeMap[cid] = {
				obj: obj,
				instance: instance,
				added: !hasCid
			};
		}
		return teardown;
	},
```
It's unclear why `var cid = canCid_1_3_1_canCid(obj);` is undefined , as it's clearly defined, coming from this function:

```js
var cid = function (object, name) {
	var propertyName = object.nodeName ? domExpando : "_cid";

	if (!object[propertyName]) {
		_cid++;
		object[propertyName] = (name || '') + _cid;
	}

	return object[propertyName];
};
```
FWIW, if I put `if(!object[propertyName]) console.log(object[propertyName])` right before return, it returns a proper value and everything works as expected.

Back to Bug 1812508 Comment 1