[OpenAjaxIDE] Simplify onchangePattern

Jon Ferraiolo jferrai at us.ibm.com
Thu Aug 14 13:51:13 PDT 2008



Due to implementation experience with the open source reference
implementation, some of the engineers would like to see changes to
onchangePattern. Right now, we allow the following example:

<property onchangePattern="{{target}}.{{property}}.changed({{value}})" ...>
  ...
</property>

But the developers are saying the {{target}} and {{value}} are problematic
and not worth the effort. The way onchangePattern is formulated now, a
mashup tool has to construct a string and then perform an eval() on it.
That can lead to slow performance and you generally want to avoid eval()
due to security concerns (possibility of code injection). We don't really
need all of the flexibility offered by {{target}} and {{value}}, so the
proposal is to get rid of them.  (OK to keep these {{target}} and {{value}}
for getterPattern and setterPattern.)

The most important requested change is to have the pattern represent a
function name only (i.e., remove the custom scope object and remove the
custom parameter list) and therefore remove {{target}} and {{value}} from
this attribute. For example:

<properties onchangePattern="on{{propertyUCFirst}}Change" ...>
  ...
</properties>

Therefore, the onchange callback function will have use its own instance of
its jsClass (or default wrapper class) as the "this" object, and the
callback function must be on the "this" object. The onchange function must
take a single parameter, which is the new value for the property. For
example, under the hood, the mashup editor would invoke the following
wheneven the 'color' property changes:

this['onColorChange'].call(this, newcolor);

Another possible change to consider: Only allow 'onchangePattern' on
container elements such as <properties> and remove it from <property> or
change its name on the <property> element from 'onchangePattern' to
'onchange' and disallow the use of {{value}}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openajax.org/pipermail/ide/attachments/20080814/859e72cc/attachment.html 


More information about the IDE mailing list