Sha256: 63ddac96e5b1772b97971aed1576c504995dadc4173bc4a6c60acae57a4cd1ea

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 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

  # @!attribute client_width
  # @return [Integer] the content-box width of an element
  def client_width
    `#@native.clientWidth`
  end

  # @!attribute client_height
  # @return [Integer] the content-box height of an element
  def client_height
    `#@native.clientHeight`
  end
end

end; end; end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
atome-opal-browser-0.3.9.5 opal/browser/dom/element/size.rb
opal-browser-0.3.3 opal/browser/dom/element/size.rb
opal-browser-0.3.2 opal/browser/dom/element/size.rb
opal-browser-0.3.1 opal/browser/dom/element/size.rb
opal-browser-0.3.0 opal/browser/dom/element/size.rb