0

I'm looking for a way to get all functions currently attached to a javascript object (a dom element). I'm familiar with using for (var m in obj) and getting the non-enumerable ones with Object.getOwnPropertyNames().

However on any video page on youtube.com document.getElementById('movie_player') has the function getVideoBytesTotal, which isn't listed by any method I have tried.

The object in question here is a flash embed. Can the function come from it?

I'm lost. Is there some kind of wrapper around some dom objects, which dynamically adds functions?

Even having a list through other means that entering javascript through the console would be great.

Best regards

Community
  • 1
  • 1
BenoitParis
  • 3,166
  • 4
  • 29
  • 56

1 Answers1

0

It seems that getVideoBytesTotal is API fn https://developers.google.com/youtube/iframe_api_reference#getVideoBytesTotal and it can be added to object in any time. It means it can be defined after your query to get all functions of this object...

dherbolt
  • 246
  • 1
  • 6
  • Thanks. How would one hide a function during an enumeration of properties, then add them back? – BenoitParis Jan 23 '13 at 10:51
  • Hi, I don't know how Google's Youtube API works but if you call your function to get methods/properties of given object at time t0 and Google adds methods after some action at time t1 (t1 > t0), you can not get these methods in enumeration. – dherbolt Jan 23 '13 at 19:27
  • I'm sorry, but you are sure that function getVideoBytesTotal is attached to DOM elenent? i have looked briefly to Google's Youtube API and I think that it is member of YT.Player class. Can you send me sample code what you are trying to do?. – dherbolt Jan 23 '13 at 19:53