githubashto / enhancejs

Automatically exported from code.google.com/p/enhancejs
Other
0 stars 0 forks source link

type-converting host objects #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In several EnhanceJS tests, "host objects are tested with !! which 
boolean-type-converts expression (and can easily blow up in IE, where 
host objects with "unknown" type throw error on [[Get]])" (reported by Kangax)

We need a safer test for existence in these cases.

Original issue reported on code.google.com by scottj...@gmail.com on 2 Apr 2010 at 3:22

GoogleCodeExporter commented 9 years ago
Not sure this one is worth avoiding. No errors seem to occur in IEx as a result 
of using this approach.

Original comment by scottj...@gmail.com on 19 May 2010 at 2:58

GoogleCodeExporter commented 9 years ago
Re-elevating this issue because Kangax's recent article on IE scripting may 
have a workaround worth trying.

http://msdn.microsoft.com/en-us/scriptjunkie/ff728624.aspx

function isHostMethod (object, methodName) {
  var t = typeof object[methodName];
  return ((t === 'function' || t === 'object') && !!object[methodName]) || t === 'unknown';
};

...we'd need it to check for host properties as well as methods though... like 
offsetWidth, offsetHeight, innerHTML, etc,etc.

Original comment by scottj...@gmail.com on 10 Jun 2010 at 2:58