- Apr 1, 2011In late Feb, Douglas added this warning:
infix_in: "Unexpected 'in'. Compare with undefined, or use the
hasOwnProperty method instead.",
implementation[*], where some kind of DOM objects do not return
'undefined' for undefined properties, but instead throw errors.
(These are typically objects that are backed by C++ implementations
in the relevant Adobe application).
So where I would like to check:
if (image.effectivePpi && image.effectivePpi < threshold)
I cannot. My first reaction is to use
if ('effectivePpi' in image && image.efffectivePpi < threhsold)
but that triggers the infix_in warning.
I am loathe to use
if (image.hasOwnProperty('effectivePpi') &&
image.effectivePpi < threshold)
because I don't know that the effectivePpi property might not be inherited,
and I do not wish to disregard the inheritance chain.
It does not appear that /*jslint forin: true */ is sufficient to
permit this usage.
Is there a better recommendation?
I think I have lost track of why the infix form of in is prohibitted;
I understand why the prefix form should be filtered, but not why the
infix form is barred.
[*] in particular, this is
"The ExtendScript scripting engine
Copyright 1998-2010 Adobe Sytems Incoporated
Build version 64.447932
Build date 2010/11/15-23:35:46
ScriptUI version 5.1.37"
- Next post in topic >>