Shortcuts



s@rdalya has a bunch of predefined shortcuts to make coding with s@rdalya faster and easier than ever.

To use a shortcut, simply preceed the shortcut method with an underscore(_) and a dot(.) like in _.myshortcutmethod().

As a convention, all of our shortcut methods are in lowercase, not camelCase, to save some typing time.

You can also define your own shortcuts by editing

/** shortcuts ... **/

section in s@rdalya's source. Or you may send it as a feature request to us.


shorthand notation resolves to
AJAX related
_.ajax(); new XHRequest();
_.xhr(); _.ajax();
DOM related
_.o(elm); new CBObject(elm).getObject();
_.id(elm); new CBObject(elm).getID();
_.gcn(str); DOMManager.getElementsByClassName(str);
_.gid(str); document.getElementById(str);
_.gtn(str); document.getElementsByTagName(str);
_.sweep(elm); DOMManager.sweep(elm);
_.elm(x); document.createElement(x);
_.load(d); DOMManager.quickLoad(d);
DOM Query
_.child(o,p); DOMManager.isChild(o,p);
Event Management
_.evto(e); new EventObject(e);
_.oevt(e);


if e is an EventObject e.getObject();
if e is an event reference new EventObject(e).getObject();

_.stop(e)


if e is an EventObject e.cancelDefaultAction();
if e is an event reference new EventObject(e).cancelDefaultAction();

_.src(e);


if e is an EventObject e.getSource();
if e is an event reference return new EventObject(e).getSource();

_.chain(a,b,c,d); EventHandler.addEventListener(a,b,c,d);
_.unchain(a,b,c,d); EventHandler.removeEventListener(a,b,c,d);
DOM CSS
_.getclass(elm); StyleManager.getClass(elm);
_.setclass(elm,strc); StyleManager.setClass(elm,strc);
_.getstyle(obj,str); StyleManager.getStyle(obj,str);
_.setstyle(obj,str,val); StyleManager.setStyle(obj,str,val);
_.addclass(obj,arClass); StyleManager.addClass(obj,arClass);
_.remclass(obj,arClass); StyleManager.removeClass(obj,arClass);
_.hasclass(obj,strClass); StyleManager.hasClassName(obj,strClass);
Custom DOM Objects
_.l(x); new LayerObject(x);
_.dl(e,c1,c2,b); new DraggableLayer(e,c1,c2,b);
_.tip(e,i1,i2,l,t); new ToolTip(e,i1,i2,l,t);
_.ib(e,s1,s2,i); return new ImageButton(e,s1,s2,i);
_.ir(e,s1,s2); new ImageRollover(e,s1,s2);
_.wo(); WindowObject;
Validators
_.ajaxdom(); Validator.isDOMEnabled()&&Validator.isAjaxEnabled();
_.integer(o); Validator.isInteger(o);
_.numeric(o); Validator.isNumeric(o);
_.positive(o); Validator.isPositive(o);
_.whitespace(o); Validator.isWhiteSpace(o);
_.string(o); Validator.isString(o);
_.defined(o); Validator.isDefined(o);
_.formelm(o); FormManager.isFormElement(o);
_.email(o); Validator.isEmail(o);
_.url(o); Validator.isValidURL(o);
Format Text
_.safehtml(v); TextFormatter.safeHTML(v);
_.safews(v); TextFormatter.safeWhiteSpace(v);
_.qry(s); TextFormatter.splitQueryString(s);
All I want is cookies
_.scook(t,v,i); CookieManager.set(t,v,i);
_.gcook(s); CookieManager.get(s);
Form Related
_.preparefields(); FormManager.prepareFormField();
_.field(e,s1,s2,s3); new FormField(e,s1,s2,s3);
Dimensional
_.dim(x,y); new Dimension(x,y);
_.cns(x,y,z,t); new Constraint(x,y,z,t);
_.coord(); CursorTracker.getCursorPosition();
Dummy
_.nill() Constant.NULL;
DOM Node Creation
_.GLUE(varargin) See the DOMCreate example for details.
_.e(varargin) See the DOMCreate example for details.

See Also

None given.


Usage Examples


Page Information

  • 2 years ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts