Sha256: 81ad498e5d25b4b5410969836e25b32c70ea3450e4c8837b7dec580cc1e2fd93

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

# backtick_javascript: true

module Browser; module DOM; class Element < Node

class Iframe < Element
  def_selector "iframe"

  # @!attribute src
  # @return [String] the URL of the page to embed
  alias_native :src
  alias_native :src=

  # @!attribute [r] content_window
  # @return [Window] window of content of this iframe
  def content_window
    Browser::Window.new(`#@native.contentWindow`)
  end

  # @!attribute [r] content_document
  # @return [Document] document of content of this iframe 
  def content_document
    DOM(`#@native.contentDocument || #@native.contentWindow.document`)
  end

  # Send a message to the iframe content's window.
  #
  # @param message [String] the message
  # @param options [Hash] optional `to: target`
  def send(message, options={})
    content_window.send(message, options)
  end
end

# Object is not an iframe, but acts the same.
class Object < Iframe
  def_selector "object"
end

end; end; end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-browser-0.3.5 opal/browser/dom/element/iframe.rb
opal-browser-0.3.4 opal/browser/dom/element/iframe.rb