Add the given CSS class name to this element. If this element already contains the given class name, then this method does nothing. Returns this.
Add a psuedo-class CSS definietion to this element. A new
class name is auto-generated and used to prefix name
, name
must start with the :
character. Returns the generated
class name.
style.addPseudoClass(":hover", "background: #eee")
The CSS classes for this element.
Clear all style declarations.
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)
Get the effetive style property value, which is the most
specific style or CSS rule in effect on this node. Returns null
if no rule in effect for given property.
This method is restricted to stylesheets that have originated from the same domain as the document. Any rules that may be applied from an external sheet will not be included.
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.
Return true if this element has the given CSS class name, or false if it does not.
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.
Remove the given CSS class name to this element. If this element does not have the given class name, this method does nothing. Returns this.
Set the given propery value. If val
is null this property
is removed.
style["color"] = "#f00"
Set properties via CSS text.
style.setCss("color: #f00; font-weight: bold;")
Toggle the presence of the given CSS class name based on the
cond
argument:
null
: remove class if present, or add if missingtrue
: always add class (see addClass)false
: always remove class(see removeClass)Optional
cond: booleanGet 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.
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: JsObj
Style models CSS style properties for an Elem.