Start an animation on this element using the given key frames.
frames := KeyFrames([
KeyFrame("0%", ["transform": "scale(1)"]),
KeyFrame("50%", ["transform": "scale(1.1)"]),
KeyFrame("100%", ["transform": "scale(1)"]),
])
animate(frames, null, 5sec)
animate(frames, ["animation-iteration-count":"infinite"], 1sec)
Stop the current animation on this element, or do nothing if no animation in progress.
Get the given HTML attribute value for this element. Returns
null
if attribute not defined.
Get name:value
map of all attributes.
Remove focus from this elem.
Traverses this element and its parents (heading toward the
document root) until it finds a node that matches the
specified CSS selector. Returns null
if none found.
Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:
this < that => <0
this == that => 0
this > that => >0
This method may also be accessed via the <
<=
<=>
>=
and >
shortcut operators. If not overridden the default
implementation compares the toStr
representations. Also see docLang.
Examples:
3.compare(8) => -1
8.compare(3) => 1
8.compare(8) => 0
3 <=> 8 => -1 // shortcut for 3.compare(8)
Return true
if given element is a descendant of this node,
or false
if not.
The enabled attribute for this element, or null if one not applicable. This is typically only valid for form elements.
The enabled attribute for this element, or null if one not applicable. This is typically only valid for form elements.
Compare this object to the specified for equality. This
method may be accessed via the == and != shortcut operators.
If not overridden the default implementation compares for
reference equality using the === operator. If this method
is overridden, then hash() must also be overridden such that
any two objects which return true for equals() must return
the same value for hash(). This method must accept null
and
return false.
Get the first child node of this element, or null if this element has no children.
Request keyboard focus on this elem.
Return true
if children is non-zero, false
otherwise.
Return true if this elem has focus.
Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.
The HTML markup contained in this element.
The HTML markup contained in this element.
The id for this element. Returns null
if id is not defined.
The id for this element. Returns null
if id is not defined.
Get the last child node of this element, or null if this element has no children.
Model for this table.
Get the next sibling to this element, or null if this is the last element under its parent.
The namespace URI of this element.
Callback when row is double-clicked.
Attach an event handler for the given event on this element. Returns callback function instance.
Callback when selection has changed.
Callback when table is sorted by a column
Callback when a event occurs inside a table cell.
Position of element relative to the whole document.
Get the parent Elem of this element, or null if this element has no parent.
Position of element relative to its parent in pixels.
Get the previous sibling to this element, or null if this is the first element under its parent.
Get the given DOM property value for this element. Returns null
if property does not exist.
Returns the first element that is a descendant of this element on which it is invoked that matches the specified group of selectors.
Rebuild table layout.
Refresh table cell content.
Remove all children from this element. Returns this.
Remove the given HTML attribute from this element.
Remove the given event handler from this element. If this handler was not registered, this method does nothing.
Paint a <canvas>
element. The given callback is invoked
with a graphics context to perform the rendering operation.
Before calling this code, you should set the canvas
width/height attributes to match the element size (typically
as a ratio of the Win.devicePixelRatio).
Scroll parent container so this Elem is visible to user. If alignToTop
is true
(the default value), the top of Elem is aligned to
top of the visible area. If false
, the bottom of Elem is
aligned to bottom of the visible area.
Optional
alignToTop: booleanTop left scroll position of element.
Scrollable size of element.
Scroll to the given row and column in table. Pass null
to
maintain the current scroll position for that axis.
Selection for table
Set the given HTML attribute value for this element. If val
is null
the attribute is removed (see removeAttr).
Optionally a namespace can be specified with ns
.
Optional
ns: UriIs the table header visible.
Is the table header visible.
Size of element in pixels.
Sort a table by the given column index. If col is null, then the table is ordered by its natural order of the table model. Sort order is determined by TableModel.sortCompare. Sorting does not modify the indexing of TableModel, it only changes how the model is viewed. Also see sortCol and sortDir. Table automatically refreshed.
Optional
dir: DirThe column index by which the table is currently sorted, or null if the table is not currently sorted by a column. See sort.
Get the Style instance for this element.
Get the tag name for this element.
Text content contained in this element.
Text content contained in this element.
Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:
Return a string representation of this object.
Transition a set of CSS properties.
transition(["opacity": "0.5"], null, 1sec) { echo("done!") }
transition(["opacity": "0.5"], ["transition-delay": 500ms], 1sec) { echo("done!") }
The trap
operator will behave slightly differently based on
the namespace of the element.
For HTML elements, trap
works as a convenience for prop
and setProp:
div := Elem("div")
div->tabIndex = 0 // equivalent to div.setProp("tabIndex", 0)
For SVG elements (where ns is http://www.w3.org/2000/svg
),
trap
routes to attr and setAttr:
svg := Svg.line(0, 0, 10, 10)
svg->x1 = 5 // equivalent to svg.setAttr("x1", "5")
svg->y1 = 5 // equivalent to svg.setAttr("y1", "5")
svg->x2 == "10" // equivalent to svg.attr("x2")
This method called whenever an it-block is applied to an
object. The default implementation calls the function with this
,
and then returns this
.
Static
echoWrite x.toStr
to standard output followed by newline. If x
is null then print "null". If no argument is provided then
print an empty line.
Optional
x: JsObjStatic
fromStatic
fromCreate an Elem instance from a native
JavaScript DOM object. The type
may be specified to create a
subclass instance of Elem. Note if the native instance has
already been mapped to Fantom, the existing instance is
returned and type
will have no effect.
Optional
type: TypeStatic
make
Table displays a grid of rows and columns.
See also: docDomkit