Represents DOM element. Element has sub-objects: attributes and styles.
The Element class is derived from the Node class.
element.view
may not be equal to global view
variable if the element was moved from one view to another.this.@["selected"] = true
// orthis.@#selected = true
this.attributes["selected"] = true
Main purpose of this interface is to provide function call mechanism that is using separate namespace.
Note: property value(v)
can be overriden in a behavior class in script. To access native value in such case use Element.state.value property.
Executes body of the loop for each child elements of the element.
Example, for p element in html: <p>Hello <em>wonderfull</em> world</p>
loop will be executed one time and child variable will get Element("em").
Constructs new Element object with tag equal to tagname (string or symbol). Use it as:
var el = new Element("option"); // or var el = new Element(#option);
Element will be created in disconnected state. To connect it to the DOM use insert method of the parent element.
Static constructor of DOM elements. tuple here is an tuple literal with microformat defined below.
Example, following fragment is an equivalent of creating element with the markup <p>before <button>Hi!</button> after</p>
:
var para = Element.create( [p: "before ", [button:"Hi!"], " after"] );
Clears a content of the element, removing all its children.
Returns string - html representation of the element. Text returned is outer html - includes head and tail tags and contents equal to text returned by html attribute.
Returns new copy of the element. Method performs a deep copy of the element. New element is disconnected from the DOM state. Use insert() method to include it in the DOM.
Returns first element satisfying CSS selector (CSSselector, string). CSSSelector may contain format specifiers like %d, %s which will be substituted by values of argument1 ... argumentN in final CSS selector string. Function uses the same rules as does Stream.printf function.
Example, if document contains <input type="text"/>
element then following statement
var inp = self.select("input[type='text']");
will set inp by reference to such element.
Returns first element satisfying CSS selector.
Note: this is a "stringizer" method so CSS selector can be written without "" quotes.
Example, if document contains <input type="text"/>
elements then following statement
var inp = self.$( input[type='text'] );
will set inp
by reference to such element.
And the following fragment:
var n = 3; var li3 = self.$( ul > li:nth-child({n}) );
will find third list item in ul list element.
Calls func (function reference) for each element satisfying (matching) CSSselector. Function func shall accept one parameter where select will provide reference to matched element. Function may return true to stop enumeration.
Example, following fragment will print out names of all input elements in the document:
function printel(el) { stdout.println( el.attributes["name"] ); }
document.select(printel, "input");
Returns array of elements satisfying CSS selector (CSSselector, string). CSSSelector may contain format specifiers like %d, %s which will be substituted by values of argument1 ... argumentN in final CSS selector string. Function uses the same rules as does Stream.printf function.
Returns array of elements satisfying CSS selector (CSSselector, string).
Note: this is a stringizer method - the CSSselector provided literally.
Returns first element in child/parent chain satisfying CSS selector (CSSselector, string). CSSSelector may contain format specifiers like %d, %s which will be substituted by values of argument1 ... argumentN in final CSS selector string. Function uses the same rules as does Stream.printf function.
ATTN: Function also inspects this element.
Returns first element in child/parent chain satisfying CSS selector.
Note 1: this is a stringizer method - the CSSselector provided literally.
Note 2: Function also inspects this element.
Returns first owner element in child/parent chain satisfying CSS selector.
Note 1: this is a stringizer method - the CSSselector provided literally.
Note 2: Function also inspects this element.
Note 3: Most of the time element's owner is is its parent except of popup menus when the owner is the element requested the popup.
Calls func (function reference) for each element satisfying (matching) CSSselector. Function func shall accept one parameter where select will provide reference to matched element. Function may return true to stop enumeration.
Example, following fragment will print out ids of all parent divs of some element:
function printel(el) { stdout.println( el.attributes["id"] ); } some.selectParent(printel, "div");
Note: Function also inspects this element.
Returns array of references of elements in child/parent chain satisfying CSS selector.
Note 1: this is a stringizer method - the CSSselector provided literally.
Note 2: Function also inspects this element.
Checks if this DOM element satisfies given CSSselector.
Checks if this DOM element satisfies given CSSselector.
Note: this is a stringizer method - the CSSselector provided literally.
Returns true if this element has parent in its ancestor chain. If useUITree is provided and it is true then the function uses UI relationship rather than strict DOM parent/children relation. For example popup element can be declared outside of its host element but this function returns true for the popup if it was created for this element.
If includingThis is defined and is true then this function returns true for the element itself too : el.belongsTo(el,false,true) -> true. By default includingThis is false.
Returns reference to the child of the given element at x,y coordinates relative to the origin of the element. If there is no such element method returns element itself.
Remeasures given element (if deep == true) and invalidates its visual area after modifications. Use deep=true value if element will get new dimensions due to some operations on it. Omit deep parameter (or set it to false) if only decoration attributes (not changing dimensions, like color) were changed.
That is "transactioned update". The stateUpdateFunction is called with this variable set to the element object and is expected to contain code that modifies state of the element, its content or states of its subelements.
"transactioned update" mechanism is used when the element is expected to have "content" transitions defined in CSS as transition:blend(), scroll-***(), slide-***(), etc.
The Element.update(stateUpdateFunction)
does these steps:
stateUpdateFunction
() function that is expected to make all needed changes for the new state of the element;If there is no CSS transition defined for the element then stateUpdateFunction
() is called and view is updated to the new state of the element immediately.
Invalidates area occupied by the element on the screen. If x , y, width, height (coordinates of area inside element) are provided then it invalidates only that portion. This method is useful if you are using Graphics for rendering on element surface area.
Starts animation on the element. nextStep is a function that executes animation step (changes dimension, opacity, etc.). This function is called with this set to the element itself and should return:
0
stop animation;If whenEnded function is provided it will be called on the end of the animation.
The duration is total duration of the animation in milliseconds. If it is provided then signature of the nextStep function is expected to be:
function nextStep(progress: float) {}
where progress is a float number from 0.0 to 1.0 - progress of the animation. The nextStep function will always receive progress == 1.0 as the very last step.
Otherwise step callback function is expected to have no parameters:
function nextStep() {}
Returns coordinates of the edges of the element. Parameters:
var (x1,y1,x2,y2) = this.box(#rect, #inner, #view)
;
var (x,y,w,h) = this.box(#rectw, #inner, #view)
;
var (w,h) = this.box(#dimension, #inner)
;
var (x,y) = this.box(#position, #inner, #view)
;the function will return cumulative widths of correspondent parts, examples:
var (mx1,my1,mx2,my2) = this.box(#rect, #margin, #inner)
;
Each mx* value here will get sum of margin, border and padding in the left, top, right and bottom directions. In other words this call will return distances of margin box from inner(content) box of the element. And this call var (mx1,my1,mx2,my2) = this.box(#rect, #margin, #border)
; will just return computed values of margin-left, margin-top, margin-right and margin-bottom CSS attributes.
For more information see the CSS box model specification: http://www.w3.org/TR/CSS2/box.html
returns min-intrinsic width of the element. min-intrinsic width is minimal width needed to show element without horizontal scrollbar.
returns max-intrinsic width of the element. max-intrinsic width is minimal width needed to show element without wrapping, e.g. for the <p> element this will be width of its text replaced in single line.
returns min-intrinsic height of the element for the given forWidth. min-intrinsic heigh is minimal height needed to show element without vertical scrollbar.
returns the length value converted to the number of device pixels. Conversion is made in context of current element style so el.toPixels( em(1.4) )
will return number of pixel correspond to 1.4em that is dependent on current font size of the element.
length is a string or symbol then this string is treated as a CSS length literal so it is possible to get values like: el.toPixels(#xx-small)
or el.toPixels(#system-scrollbar-width)
,
Second symbol parameter is used with the conversion from percentage lengths:var h50p = el.toPixels( pr(50.0), #height );
- will calculate the same value as the following CSS declaration: height:50%
.
Returns various scrolling related positions of the element. Parameters:
part - one of symbolic constants:
Sets scroll position of the element to x,y position. The element should have overflow: hidden-scroll, scroll or auto to be able to scroll its content. If unrestricted is set to true then scroll poistion is allowed to be out of content boundaries.
Scrolls the element to the view - ensures that element is visible. If toTop is true then forces element to be on top of its scrollable container. This method does deep scroll - it tries to make the element visible through all its scrollable containers. If smooth is false then no attempt to animate the scrolling will be made.
NOTE: in order that method to work the element should establish a box - to be of display: block | inline-block | table-cell | etc. In contrary <tr>
(table row) for example is not a box element. In order to scroll to particular row in table you should choose first cell in that row.
maps xLocal/yLocal point of the element to xView/yView (window) coordinates with respect of CSS tranformations.
maps xView/yViewl point of the view into xLocal/yLocal (element) coordinates with respect of CSS tranformations.
element is a child DOM element (instance of this Element class) to be inserted at the index position. If index is greater than current number of children in this element then new element will be appended as a last element. Index is optional parameter, if omitted then element will be appended to collection. If element is already a child of some other parent then it will be disconnected from it automatically.
If first parameter is string (html text) then attempt will be made to insert it at given position.
If first parameter is a tuple then it is considered as a template for creation of new DOM element. Microformat of that tuple is defined below.
If first parameter is an array it shall contain DOM Node references (elements and/or text nodes).
Equivalent of insert ( ... , Integer.MAX )
;
Equivalent of insert ( ... , 0 )
;
Replaces content of the element by elements, that is short form of el.clear(); el.append(element1); el.append(element2); ...
This method can be used for setting cells in <tr>s. It handles properly cells with col/rowspans.
For all other elements elementN can be either DOM element, string, tuple ( template of the element that uses microformat ) or array of Elements/Nodes.
Does merge ( a.k.a. patch, reconciliation ) of the DOM tree of this element with other tree that can be either other DOM element or virtual DOM element described by the tuple in the form: [tag:{attributes}, [children]]
Optional callback function, if provided, will receive the following calls:
callback(#change-text, textNode:Node, newText: string)
- on change of text of DOM text node;callback(#remove-node, node:Node)
- on DOM node removal (either text node or element);callback(#insert-node, parent:Element, atIndex:integer, newNode: Node)
- on new DOM node insertion;callback(#reposition-node, parent:Element, toIndex:integer, node: Node)
- on DOM node move;callback(#replace-node, oldNode:Node, newNode: Node)
- on DOM node replacement;callback(#update-atts, element:Element, atts: Object)
- on update of DOM element attributes;#only-children parameter instructs the function to do only children reconciliation of two elements not touching attributes of the element itself.
Stringizer method, replaces content of the element by the inline html. As this is a stringizer method then html can be provided as it is, example:
var el = ... , num = ...; el.$content(This is item number { num });
Method returns the element itself.
Stringizer method, adds content defined by the inline html to the end of the list of children of the element.
Method returns first added element.
Stringizer method, insert content defined by the inline html at the start of children list of the element.
Method returns first added element.
Stringizer method, adds content defined by the inline html to the parent of the element immediately after this one.
Method returns first added element.
Stringizer method, insert content defined by the inline html to the parent of the element immediately before this one.
Method returns last added element (that will be new this.prior element).
Stringizer method, removes this element from the DOM and content defined by the html in its place.
Method returns first added element.
Method creates an array and populates it by list of child DOM nodes. Text and comment nodes are represented by instance of Node object and elements by the Element.
Removes this element from its parent's children collection so after call of this method this.parent become null. If update is true then calls update() for the parent element. Returns element that was just detached (this). This method does not destroy state and behaviors attached to the element until GC will not collect the element (if there are no references to it)
Removes this element from its parent's children collection so after call of this method this.parent become null. If update is true then calls update() for the parent element. Returns element that was just detached (this). All runtime states and behaviors are destroyed by the method. Native behaviors will receive BEHAVIOR_DETACHED event.
Loads content of the document referred by url as a content of this element. For elements having behavior:frame assigned it loads html, styles and executes scripts refered by the url or contained in the stream. Upon completion of loading behavior:frame posts DOCUMENT_COMPLETE event. For any other elements it loads only content of body portion of the document, no style loading or script execution happens in this case. If the url points on external resource like "http://..." then the method is asynchronous. Otherwise it tries to load the resource synchronously.
If headers object ( name/value map) is present and url is http/https then HTTP GET request is sent with those headers.
Loads content of the document from in-memory stream as a content of this element. For elements having behavior:frame assigned it loads html, styles and executes scripts referred by the URL or contained in the stream. For any other elements it loads only content of body portion of the document, no style loading or script execution happens in this case.
Loads the html document from string as a content of this element. For elements having behavior:frame assigned it loads html, styles and executes scripts refered by the the html content. For any other elements it loads only content of body portion of the document, no style loading or script execution happens in this case.
This function parses given HTML (or SVG) string or stream and returns either:
"<html>..."
or "<svg>..."
or "<i>Some</i><b>text</b>"
If the html string starts from file://
sequence then it is treated as an URL of file to parse.
Note that parsed DOM elements/nodes that the function returns are not connected to the host document.
Loads image from the url. If callback is ommited then the engine will try to load image sycnhronously otherwise (if callback is a function) engine will issue asynchronous request and will call this function upon arrival.
If useCache is not false then the method will try to use image cache to get the image and on successful download the image will go to the cache too. By default useCache is false.
Signature of the callback function is function callback(image, status) where image is an object of class Image or null in case of error, status is http status (200,404,etc).
Binds the img with the URL. As a result the image can be used in CSS for example as a background. URL can be any arbitrary unique string here, like "in-memory:dyn-image1".
Returns image that was previously bound with the URL or null if there is no such image.
Sends synchronous or asynchronous http data GET/POST request to the server/page (url), a.k.a. JSON-RPC calls.
Content-Type: application/x-www-form-urlencoded;charset=utf-8
;Content-Type: multipart/form-data; boundary= ...
;Content-Type: multipart/form-data; boundary= ...
;Content-Type: application/json;charset=utf-8
;Content-Type: application/json;charset=utf-8
;function dataArrivedCallback( data: any, status: integer );
where data is either one of:
and status code is an integer - HTTP status code (e.g. 200 - OK, 404 - resource was not found on the server) or if code is greater than 12000 it is a WinInet error code, see: http://support.microsoft.com/kb/193625.
Example of server data response (type: text/javascript) :
({ id : 1234, message : "Hello from XYS server!" }
)
- in this case server returns object having two properties: id and message. Rationale behind of ({ and }) was explained here.
Returns state of the element. stateFlags here is a set of bits - "ORed" constants STATE_***. stateFlags is provided then function returns int - flags of the element ANDed with the provided stateFlags variable. If no stateFlags is given then the function returns full set of flags element has at the moment.
Function will set flags to the element update document on the screen accordingly (resolve styles and refresh).
Function will clear flags of the element and update document on the screen.
Function will show element el as a popup window placed relatively to this element. Placement is a combination of two values from two groups:
Point on this element ( a.k.a. popup anchor point )
1
- this element's bottom-left point2
- this element's bottom-center point3
- this element's bottom-right point4
- this element's center-left point5
- this element's middle-center point6
- this element's middle-right point7
- this element's top-left point8
- this element's top-center point9
- this element's top-right pointPoint on popup to be placed at the anchor point:
1 << 16
- popup bottom-left is at anchor point2 << 16
- popup bottom-center is at anchor point3 << 16
- popup bottom-right is at anchor point4 << 16
- popup center-left is at anchor point5 << 16
- popup middle-center is at anchor point6 << 16
- popup middle-right is at anchor point7 << 16
- popup top-left is at anchor point8 << 16
- popup top-center is at anchor point9 << 16
- popup top-right is at anchor pointAlternatively you can use "popup auto flip" positioning modes:
placement parameter is optional. The popup position can also be defined in CSS by popup-position property.
Function will show element el as a popup window placed at x, y (view relative coordinates). Placement defines what point of the el shall be places at x,y. By default it is 7 (top/left corner).
( see keyboard numpad to get an idea of numbering).
Function will close popup if element el or any of its parent is a popup window.
If milliseconds is greater than zero the method will create timer for the DOM element with milliseconds delay.
After milliseconds delay engine will call callback function with this variable set to the dom element. Return true from the callback() function if you need to continue timer ticks and false otherwise.
Call of timer() with milliseconds = 0 parameter will stop the timer.
If the element already contains running timer with function of the same oringin as the callback then that timer gets removed before adding new timer. Passing true as avoidSameOriginCheck parameter will suppress same origin matching.
Swaps DOM positions of two elements - owner of the method and the other. Returns element whose method is called.
traverse (send) bubbling event to the parent/child chain of this element. Events generated by this method can be handled by onControlEvent() methods of elements in the chain.
traverse (send) bubbling event to the parent/child chain of this element. Events generated by this method can be handled by onControlEvent() methods of elements in the chain.
The postEvent places event into the internal queue of posted events for future traversal by sendEvent(name,data) and returns immediately.
The postEvent places event into the internal queue of posted events for future traversal by sendEvent and returns immediately.
The sendKeyEvent simulates the key event. eventDef may have following fields:
{ type: Event.KEY_DOWN or Event.KEY_UP or Event.KEY_CHAR; // type if key event keyCode: int; // Key or char code, e.g. 'O' altKey: true or false; // optional, 'ALT' key pressed flag shiftKey: true or false; // optional, 'SHIFT' key pressed flag ctrlKey: true or false; // optional, 'CTRL' key pressed flag shortcutKey: true or false; // optional, 'CTRL/win' or 'COMMAND/mac' key pressed flag commandKey: true or false; // optional, 'WIN/win' or 'COMMAND/mac' key pressed flag }
Function returns true if the event was consumed during sinking/bubbling dispatching of the event using this element as a target.
The sendMouseEvent simulates the mouse event. eventDef may have following fields:
{ type: Event.KEY_DOWN or Event.KEY_UP or Event.KEY_CHAR, // type if key event altKey: true or false, // optional, 'ALT' key pressed flag shiftKey: true or false, // optional, 'SHIFT' key pressed flag ctrlKey: true or false, // optional, 'CTRL' key pressed flag shortcutKey: true or false; // optional, 'CTRL/win' or 'COMMAND/mac' key pressed flag commandKey: true or false; // optional, 'win/win' or 'COMMAND/mac' key pressed flag mainButton: true or false, // optional, left mouse button pressed flag propButton: true or false, // optional, right mouse button pressed flag x: int, // x mouse coordinate, view relative y: int, // y mouse coordinate, view relative }
Function returns true if the event was consumed during sinking/bubbling dispatching of the event using this element as a target.
This method allows to delay execution of callback function. While calling the callback function engine will set this environment variable to the element this post call was invoked with.
Optional parameter only_if_not_there if defined and is true allows to post delayed event only once. Multiple post with the same callback function will yield to a single entry in posted events queue.
Method builds absolute url from the relativeUrl by using document url as a base. If there is no relativeUrl then the method just returns url of the document this DOM element belongs to.
Sorts children of the element by using comparator function. comparator function has to have following signature:
function cmp(el1: Element, el2: Element) : int
that returns negative int value if el1 is less than el2, 0 if they are equal and positive value if el1 is greater than el2.
fromIndex and numOfElements are used for defining range of elements to sort.
This methods transforms the element into the "sprite" - element that moves independently from the rest of the DOM:
Declares element as having position:popup and moves it to the position (x,y). If the element happens to be outside of the view then engine creates special popup window for it. Third parameter describes role of x and y values. w and h parameters, if provided, change dimensions of the element.
mode parameter
relto tells what kind of coordinates x,y are: #view, #root, #screen or #self relative. Default - #view.
referencePoint is a number from 1 to 9 - defines what x,y are cordinates of. 7 is top/left corner, 5 is center of the element, see numpad on keyboard. NOTE: if provided the referencePoint defines position of element's border box. In all other cases x/y defines position of top/left corner of cotent box.
Samples are in sdk/samples/ideas/moveable-windows/ and sdk/samples/ideas/rect-tracker/ folders.
Call of the move()
without parameters restores default positioning of the element.
See also: Element.style.dimension()
method.
Assigns the handler function to the particular event that may occur on this particular DOM object.
handler function should have following signature function(evt) {...}, where evt is an Event object that describes the event in details.
eventGroup here is one of the following constants:
Event.MOUSE
- group of mouse events (like Event.MOUSE_DOWN, Event.MOUSE_UP, etc. );Event.KEY
- group of keyboard events (like Event.KEY_DOWN, Event.KEY_UP, etc. );Event.BEHAVIOR_EVENT
- group of generated, synthetic events (a.k.a. control events like Event.BUTTON_CLICK, Event.HYPERLINK_CLICK, Event.BUTTON_STATE_CHANGED, etc. );Event.FOCUS
- group of scroll events;Event.SCROLL
- group of scroll events;Event.SIZE
- size changed event;eventType here is one of constants defined below for particular group of event. eventType parameter is optional - if it is not provided then the handler function will receive all events of the eventGroup.
subscribe() method allows to attach multiple and independent event handling functions to single element.
Note that subscribe() is not a substitution of onMouse(evt), onKey(evt), etc. event handlers defined below. These two ways of handling events work side-by-side. onXXXX() methods are used for defining event handlers in classes (Behaviors) so to handle events for classes of elements. And subscribe()/unsubscribe() are used for attaching event handlers to particular elements.
Method returns the element it was called for. This allows to chain subscribe() calls.
Assigns the handler function to the particular event that may occur on this DOM object or on one of its children. The event here is a string that can accept symbolic event names.
Event names may have namespaces in their names. For example: "click.mywidget"
defines click handler assigned by some mywidget component. Namespaces are especially useful when you need to unsubscribe multiple handlers at once. For example this el.unsubscribe(".mywidget")
will remove all handlers with mywidget namespace.
The selector is an optional parameter - CSS selector of child element. When provided allows containers to subscribe to events coming from particular children.
The handler can be any function(evt:Event) {...}
- callback that gets invoked when the event occurs. this variable is set to the evt.target
- element that originated the event.
To subscribe on event in EVENT_SINKING phase prepend the event name by ~
symbol. For example this handler container.subscribe("~keydown", function() {...});
will receive the keydown event before its children.
Note: this method mimics jQuery's .on()
method and has the same semantics.
Alias of subscribe(event: string [, selector: string] , handler: function) above.
unsubscribe() method detaches event handler[s] from the element.
The method detaches matching event handlers from the element that were set previously by subscribe("name",...) method.
Example:
el.unsubscribe("click")
;
will remove all event handlers with "click" name. Even those that have also namespace defined like "click.mywidget".
Note: this method mimics jQuery's .off()
method.
The method returns common parent element of this and other DOM elements.
The function returns list (array) of elements that were replaced in given row.
The function returns list (array) of elements that were replaced in given column.
The function returns position and height of the row.
The function returns position and width of the column.
The transact method executes so called editing transaction - group of operations that can undone/redone as a whole. The action function should have this signature:
function action(transaction) { ... }
Where the transaction is an instance of the Transaction interface - primitives used to modify state of the DOM. Any modification made through these function will be undone/redone properly when user will issue Undo/Redo commands in the editor.
The execCommand method executes undoable editing command. The command string identifies command to execute.
Editing commands common to all editable elements ( <input|text>, <textarea>, <plaintext>, <htmlarea> ):
"edit:cut"
- cut selection - copy selection to the clipboard and remove it;"edit:copy"
- copy selection to the clipboard;"edit:paste"
- paste content of the clipboard;"edit:selectall"
- select whole content of the element;"edit:undo"
- undo last editing operation;"edit:redo"
- redo last operation that was undone;"edit:delete-next"
- if there is a selection - delete selected content, otherwise delete next character;"edit:delete-prev"
- if there is a selection - delete selected content, otherwise delete previous character;"edit:delete-word-next"
- if there is a selection - delete selected content, otherwise delete next word;"edit:delete-word-prev"
- if there is a selection - delete selected content, otherwise delete previous word;"edit:insert-break"
- essentially this is "ENTER" (VK_RETURN) command, actual DOM modification depends on context;"edit:insert-text"
- inserts text at current caret position, attributes shall contain string to insert;Editing commands supported only by behavior:richtext
elements ( <htmlarea> ):
"edit:insert-soft-break"
- "SHIFT+ENTER" command, inserts <br>
separator but actual DOM modification depends on context;"format:apply-span:{tag-list}"
- wrap selection into span element, if the selection contains one of tags they will be removed.{tag-list}
is a pipe (|
) separated list of tag names. Example:execCommand("format:apply-span:b|strong")
- will wrap selection into <b>...</b>
while removing any other <b>
and <strong>
elements from the selection.execCommand("format:apply-span:font",{color:"#F00"})
- will wrap selection into <font color="#F00">...</font>
element."format:toggle-span:{tag-list}"
- if selection contains one of the tags - removes them, otherwise it does "format:apply-span:..."
action."format:toggle-list:{list-tag}"
- converts paragraphs in selection into a list. If selection is already a list of that type then items of the list will be converted to simple paragraphs;{list-tag}
can be either ul
, ol
or dl
."format:toggle-pre"
- converts selection to or from <pre>
block."format:indent"
- wraps selected paragraphs into <blockquote>
or sub-list."format:unindent"
- unwraps selected paragraphs from <blockquote>
or moves sub-list to one level up."format:morph-block:{to-tag}"
- changes tags of selected block elements. This way current <blockquote>
can be changed to <div>
for example.The queryCommand method reports state and allowance of particular command. The method accepts the same parameters as the execCommand(). Return value is an integer - combination of the following flags:
0x01
- command is "on" state or "selected". For example, queryCommand("format:apply-span:b|strong")
will return 0x01 value if selected text contains either <b>
or <strong>
elements.0x02
- command is "disabled" or is not available in current context.Inserts the node in the DOM tree before this element.
Inserts the node in the DOM tree after this element.
Inserts the node after last node of this element so the node becomes last child node of the element.
Inserts the node before first node of this element so the node becomes first child node of the element.
Synthetic (logical) events:
See Gesture (touch screen) event codes in Event object definition.
Commands, actions to be executed by text editing elements like <textarea>, <input|text>, <htmlarea>, <plaintext>, etc. See: Element.execCommand().
<frame>
and <htmlarea>
specific callback methods. When defined the method will be called before execution of the request. The handler can call rq.fulfill()
to provide data for the request;<frame>
and <htmlarea>
specific callback methods. The method will be called after completion (with success or failure) of the request. tuple.tag
property is used as a tag of newly created DOM element. The tuple shall obey following rules:[div: // mandatory, tuple tag - tag name of the DOM element. E.g. div, p, option, select, etc. // object literal - attributes of the element { attr1name : "attr1value", // optional, attribute #1 of created dom element. attrNname : "attrNvalue" // optional, attribute #N of created dom element. } // content, either text or vector of templates "some text", // optional string, text node of the DOM element [ tuple1, "text", ... tupleN ] // optional array of templates - definitions // of text and child elements of the element. }
Example, following script:
sb.append ( [div: { class:"dyn" }, [ [p: "Text1" ], [p: "Text2 before ", [button:"Hi!"], " after"] ] ]);
Is an equivalent of the following:
sb.$append(<div.dyn> <p>Text1</p> <p>Text2 before <button>Hi!</button> after</p> </div>);