Re: [cssom] Proposal for obtaining robust style information via Javascript - getStyle()

On 2/9/13, Cameron McCormack <cam@mcc.id.au> wrote:
> On 9/02/13 2:23 PM, Garrett Smith wrote:
>> I missed that thread. Why is it bad to have functions that have
>> additional properties?
>
> Actually it was "objects that are typeof 'object' but which are
> callable" are a bad thing, since it is not possible to implement objects
> like this without magic.  But this computedStyle proposal wouldn't need
> to have typeof being 'object', so it wouldn't be as bad.  I would still
> contend though that it is an uncommon API style and could be confusing.
>
Since ES 5, callable host objects must result "function" with typeof.

It is uncommon API design as far as w3c stuff goes, but I guess that's
because IDL or other programming languages like Java don't allow
methods with extra properties. Anyway, it might not matter right now,
but the idea doesn't seem confusing to me.

More important - I like the ideas from Mike and L Baron.
-- 
Garrett
Twitter: @xkit
personx.tumblr.com

Received on Tuesday, 12 February 2013 23:00:02 UTC