Sha256: 4102321598a2702eea2f6142f4385229be5d3bc6f15c6ded9fc6c0fd2b25f591

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

module Browser; module DOM; class Element < Node

class Size
  attr_reader :element

  # @private
  def initialize(element, *inc)
    @element = element
    @native  = element.to_n
    @include = inc
  end

  # @!attribute width
  # @return [Integer] the element width
  def width
    `#@native.offsetWidth`
  end

  def width=(value)
    @element.style[:width] = value
  end

  # @!attribute height
  # @return [Integer] the element height
  def height
    `#@native.offsetHeight`
  end

  def height=(value)
    @element.style[:height] = value
  end
end

end; end; end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
diamonds-0.1.5 lib/diamonds/opal/browser/dom/element/size.rb
opal-browser-0.2.0 opal/browser/dom/element/size.rb