General Interface is an open source project hosted by the Dojo Foundation

GI Contributor Blog Blog from Sep 26, 2009

  2009/09/26
Coming in 3.9 - A useful JavaScript Test Utility shortcut
Last Changed by Jesse Costello-Good, Sep 26, 2009 17:35
Labels: gi, 3_9, builder, scriptlet

I've added something to GI 3.9 Builder that will make you happy if you use the JavaScript Test Utility (a.k.a. "the scriptlet pad") very much. Now every GI DOM object can be referenced by its name without writing jsx3.GO(), myApp.getJSXByName() or jsx3.ide.getSelected()[0].

Before you had to type:

jsx3.GO("block1").getWidth();

Now you can just type:

block1.getWidth();

Any object visible in the Component Hierarchy in the active component editor is exposed in this manner. If the current editor is not a component editor then no objects are exposed.

Two caveats:

  • Only objects whose names are valid JavaScript variable names are exposed. The name must match [\$a-zA-Z_][\$\w]*.
  • The behavior of name collisions is not defined. If you have two or more objects in the same component with the same name, the corresponding variable may reference either one.

Here is the JIRA ticket: http://www.generalinterface.org/bugs/browse/GI-705

Enjoy!

Posted at 26 Sep @ 5:30 PM by Jesse Costello-Good | 3 Comments