Class: Element::Properties

Inherits:
Object show all
Defined in:
lib/source/redshift/accessors.rb

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Properties

:nodoc:



428
429
430
# File 'lib/source/redshift/accessors.rb', line 428

def initialize(element) # :nodoc:
  @element = element
end

Instance Method Details

#[](attribute) ⇒ Object

call-seq:

properties[sym] -> object or nil

Returns the value of the HTML property sym for the element represented by properties, or nil if the property is not set. See also Element#get_property.



441
442
443
# File 'lib/source/redshift/accessors.rb', line 441

def [](attribute)
  `c$Element.prototype.m$get_property.call(#{@element},attribute)`
end

#[]=(attribute, value) ⇒ Object

call-seq:

properties[sym] = value -> value

Sets the value of the HTML property sym to value for the element represented by properties. See also Element#set_property.



453
454
455
# File 'lib/source/redshift/accessors.rb', line 453

def []=(attribute,value)
  `c$Element.prototype.m$set_property.call(#{@element},attribute,value)`
end

#delete(attribute) ⇒ Object

call-seq:

properties.delete(sym) -> object or nil

If the element represented by properties has the HTML property sym, unsets the property and returns its value, otherwise returns nil. See also Element#remove_property.



466
467
468
# File 'lib/source/redshift/accessors.rb', line 466

def delete(attribute)
  `c$Element.prototype.m$remove_property.call(#{@element},attribute)`
end

#set?(attribute) ⇒ Boolean

call-seq:

properties.set?(sym) -> true or false

Returns true if the HTML property sym is set for the element represented by properties, false otherwise.

Returns:

  • (Boolean)


478
479
480
# File 'lib/source/redshift/accessors.rb', line 478

def set?(attribute)
  `$T(c$Element.prototype.m$get_property.call(#{@element},attribute))`
end

#update(hash) ⇒ Object

call-seq:

properties.update({key => value, ...}) -> properties

Sets the value of the HTML property key of the element represented by properties to value for each key-value pair, then returns properties. See also Element#set_properties.



491
492
493
494
# File 'lib/source/redshift/accessors.rb', line 491

def update(hash)
  `c$Element.prototype.m$set_properties.call(#{@element},hash)`
  return self
end