removeData doesn't properly remove the id on Chrome #1858

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@chikathreesix
Contributor

chikathreesix commented Feb 11, 2015

After updated to 4.11.4, I saw the error below many times.

Uncaught TypeError: Cannot read property 'handlers' of undefined

This is because getData returns null in vjs.on and prior to that, 'removeData' failed to delete the id with delete el[vjs.expando].

  try {
    delete el[vjs.expando];
  } catch(e) {
    if (el.removeAttribute) {
      el.removeAttribute(vjs.expando);
    } else {
      // IE doesn't appear to support removeAttribute on the document element
      el[vjs.expando] = null;
    }
  }

So far this happens only on Chrome(40.0.2214.111) and only when el is object element.
I tested delete syntax itself with object element on Chrome, but it actually failed to delete the property even though it returns true.

So I guess it should be Chrome's bug but I would suggest to make a change to getData to make sure it doesn't return null all the time.

Set empty object to the cache anytime when it is null. Sometimes brow…
…ser fails to delete the id with 'delete el[vjs.expando]'
@heff

This comment has been minimized.

Show comment
Hide comment
@heff

heff Feb 11, 2015

Member

Good find, thanks! Interesting bug.

Member

heff commented Feb 11, 2015

Good find, thanks! Interesting bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment