Class: DOM::Text

Inherits:
NODE show all
Defined in:
opal/fron/dom/text.rb

Overview

Text

Instance Attribute Summary

Attributes included from Events

#listeners

Instance Method Summary collapse

Methods inherited from NODE

#<<, #<=>, #==, #>>, #children, #dup, #dup!, #empty, #empty?, from_node, get_element, #index, #insert_before, #normalize!, #parent, #parent_node, #remove, #remove!, #text, #text=

Methods included from Events

#add_listener, #delegate, #off, #old_trigger, #on, #on!, #remove_listeners, #trigger

Constructor Details

#initialize(data) ⇒ Text

Initializes the text node with the given data

Parameters:

  • data (String)

    The value of the node



7
8
9
# File 'opal/fron/dom/text.rb', line 7

def initialize(data)
  @el = `typeof #{data} === 'string'` ? `document.createTextNode(#{data})` : data
end