Re: RfC: WebApps Testing Process

On 4/6/11, Aryeh Gregor <Simetrical+w3c@gmail.com> wrote:
> On Mon, Apr 4, 2011 at 7:12 PM, Garrett Smith <dhtmlkitchen@gmail.com>
> wrote:
>> I looked but I didn't see it where the spec says there's a global `Node`.
\> http://dev.w3.org/2006/webapi/WebIDL/#dfn-relevant-namespace-object
>
So it's in WebIDL.

> There is no enclosing module given for the Node interface in Web DOM,
> so it's on the global object.
>
>> To avoid the problems of generality, long functions, and typechecking.
>
> What's wrong with generality, long functions, or typechecking?  (Long
> functions aren't an issue at all, since it could always be broken up
> into subfunctions.)
>
Break it up. SRP for methods.

Don't write functions that take any of number, string, object, and
host object. That's just going to hide bugs. Look at any of the old
discussions on jQuery. Then notice how the jQuery team tried to change
the code the best they could to remove typechecking.

>> All of these things open doors for quirks and gotchas,.
>
> Like?
>
>> Host object typechecking in particular is doomed to fail.
>
> In what ways?

I don't have time for this. Ask on comp.lang.javascript.

Try a few checks. Like typeof document.images typeof
document.childNodes.item. Or do a web search for "unknown" type in
IE9.

>
>> We discussed this for
>> years on c.l.js and with many examples from the popular libraries like
>> jQuery, Dojo, and Prototype.js.
>
> And what are the reasons for your conclusions?
>
isFunction, for starters. See jQuery c 2007. Or "when is a function
not a function." or any other threads from 2007 - 2010 regarding the
changes in jQuery.

Long functions are inherently more complex and will tend to have more
bugs. Short functions tend to have less of a problem in this area.
Look up SRP.

>> If the problems with long functions, generalized functions, overloaded
>> typechecking functions are not understood then refactoring the code to
>> not do thost things won't seem very worthwhile.
>
> That about sums it up, yes.  I think you need to clarify what problems
> you have with these things.  Keep in mind that we're *not* aiming to
> make a fully general test harness, we're aiming to make a test harness
> for running tests for browser-targeted standards, which are expected
> to mostly be maintained in W3C test suites.
>
>> Is the HTML WG doing something with the javascript? Seems kind of strange
>> to me.
>
> A huge part of the HTML standard defines JavaScript APIs.  Look at,
> for instance, the IDL for media elements:
>
> http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-elements
>
Thanks -- I'll try and sneak a peek when I have time.
--
Garrett

Received on Thursday, 7 April 2011 02:29:23 UTC