W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2006

[whatwg] Intergrating the DOM and JavaScript (JSDOM)

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Fri, 12 May 2006 12:41:49 -0700
Message-ID: <000a01c675fc$1d6192a0$c302000a@internal.toppro.net>

----- Original Message ----- 
From: "Lachlan Hunt" <lachlan.hunt@lachy.id.au>
To: "Dean Edwards" <dean at edwards.name>
Cc: "Andrew Fedoniouk" <news at terrainformatica.com>; "whatwg"
<whatwg at whatwg.org>
Sent: Friday, May 12, 2006 4:06 AM
Subject: Re: [whatwg] Intergrating the DOM and JavaScript (JSDOM)


> Dean Edwards wrote:
>> On 12/05/06, Andrew Fedoniouk <news at terrainformatica.com> wrote:
>>> var checked = root.select("input[type=checkbox]:checked");
>>
>> You appear to be using a different DOM to everyone else.
>
> He's using his proprietary DOM extensions [1] found in his own browser.

Yep, but these are not extensions.

Design goals of the Sciter:

1) To create very thin scripting layer. Thin here means - compact and fast.
    Scripting Element in Sciter *is a* html::element (internal C++ class) - 
without
    any intermediate layers like COM/XPCOM and reference counting problems
    associated with them.

2) If needed standard DOM can be emulated as a set of scriting 
functions/methods,
    for example it might be some stddom.js script file having following:

       var document = root;
      document.getElementByID = function(id) {  return document.select("#%s", 
id);   }

   This adds document object definition having getElementByID method.
   And all other getElementsBy*** can be added as simple wrapper functions
   around that select method.

Again: main motivation is to make DOM/scripting system as much fast
and simple as possible.

OT: Even more - Sciter uses scripting language (tiscript) which is close but
not exactly ECMAScript.

In Sciter
  element.prototype === Element;
In ECMAScript
  element.prototype === Element.prototype; // for reasons unknown to me.

This makes prototype stuff more human readable/understandable.
But this is for discussion in separate topic I beleive.

>  Though from what I gather from that documentation, that actually doesn't
> do the same thing as the functions you originally described because it
> returns an Element, not a boolean.

If you need it to be exactly boolean then use:
var isChecked = root.select("input[type=checkbox]:checked")?  true: false;

Andrew Fedoniouk.
http://terrainformatica.com


>
> [1] http://www.terrainformatica.com/sciter/Element.whtm
>
> -- 
> Lachlan Hunt
> http://lachy.id.au/
>
Received on Friday, 12 May 2006 12:41:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:27 UTC