cubicweb.js

cubicweb.js.jqNode(node)

safe version of jQuery(‘#nodeid’) because we use ‘:’ in nodeids which messes with jQuery selection mechanism

cubicweb.js.toISOTimestamp(date)
cubicweb.js.nodeWalkDepthFirst(node, visitor)

depth-first implementation of the nodeWalk function found in MochiKit.Base

cubicweb.js.formContents(elem)

cannot use jQuery.serializeArray() directly because of FCKeditor

cubicweb.js.sliceList(lst, start, stop, step)

returns a subslice of lst using start/stop/step start, stop might be negative

>>> sliceList(['a', 'b', 'c', 'd', 'e', 'f'], 2)
['c', 'd', 'e', 'f']
>>> sliceList(['a', 'b', 'c', 'd', 'e', 'f'], 2, -2)
['c', 'd']
>>> sliceList(['a', 'b', 'c', 'd', 'e', 'f'], -3)
['d', 'e', 'f']

returns the last element of an array-like object or undefined if empty

cubicweb.js.extend(array1, array2)

equivalent of python += statement on lists (array1 += array2)

cubicweb.js.difference(lst1, lst2)

returns a list containing all elements in lst1 that are not in lst2.

cubicweb.js.domid(string)

return a valid DOM id from a string (should also be usable in jQuery search expression...). This is the javascript implementation of cubicweb.uilib.domid().

cubicweb.js.strFuncCall(fname, *args)

return a string suitable to call the fname javascript function with the given arguments (which should be correctly typed).. This is providing javascript implementation equivalent to cubicweb.uilib.js().

DOM factories *******************************************************

Previous topic

Javascript API

Next topic

cubicweb.python.js