Class: Dommy::HTMLOutputElement

Inherits:
HTMLElement show all
Defined in:
lib/dommy/html_elements.rb

Overview

‘<output>` — calculation result element.

Constant Summary

Constants inherited from Element

Element::ATTRIBUTE_NODE, Element::CDATA_SECTION_NODE, Element::COMMENT_NODE, Element::DOCUMENT_FRAGMENT_NODE, Element::DOCUMENT_NODE, Element::DOCUMENT_POSITION_CONTAINED_BY, Element::DOCUMENT_POSITION_CONTAINS, Element::DOCUMENT_POSITION_DISCONNECTED, Element::DOCUMENT_POSITION_FOLLOWING, Element::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, Element::DOCUMENT_POSITION_PRECEDING, Element::DOCUMENT_TYPE_NODE, Element::ELEMENT_NODE, Element::HTML_NAMESPACE, Element::PROCESSING_INSTRUCTION_NODE, Element::REFLECTED_TOKEN_LIST_HOSTS, Element::SHADOW_HOST_TAGS, Element::SVG_NAMESPACE, Element::TEXT_NODE

Constants included from Node

Node::ATTRIBUTE_NODE, Node::CDATA_SECTION_NODE, Node::COMMENT_NODE, Node::DOCUMENT_FRAGMENT_NODE, Node::DOCUMENT_NODE, Node::DOCUMENT_POSITION_CONTAINED_BY, Node::DOCUMENT_POSITION_CONTAINS, Node::DOCUMENT_POSITION_DISCONNECTED, Node::DOCUMENT_POSITION_FOLLOWING, Node::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, Node::DOCUMENT_POSITION_PRECEDING, Node::DOCUMENT_TYPE_NODE, Node::ELEMENT_NODE, Node::HTML_NAMESPACE, Node::PROCESSING_INSTRUCTION_NODE, Node::TEXT_NODE

Instance Attribute Summary

Attributes inherited from Element

#document

Instance Method Summary collapse

Methods inherited from HTMLElement

#case_sensitive_attribute_names?

Methods included from Internal::ReflectedAttributes

included

Methods inherited from Element

#[], #[]=, #__dommy_backend_node__, #__internal_set_namespace__, #__internal_shadow_root__, #__js_call__, #__test_scroll_log__, #access_key_label, #after, #anchor_href, #animate, #aria_content_attr, #aria_element_attr, #aria_element_get, #aria_element_set, #aria_elements_attr, #aria_elements_get, #aria_elements_set, #aria_find_in_root, #aria_get, #aria_set, #at_xpath, #attach_shadow, #attributes, #base_uri, #before, #blur, #child_element_count, #child_nodes, #children, #class_list, #class_name, #class_name=, #clear_aria_element_ref_for, #click, #clone_node, #closest, #contains?, #dataset, #element_prefix, #equal_node?, #first_child, #first_element_child, #focus, #get_animations, #get_attribute, #get_attribute_names, #get_attribute_node, #get_attribute_node_ns, #get_attribute_ns, #get_bounding_client_rect, #get_client_rects, #get_elements_by_class_name, #get_elements_by_tag_name, #get_elements_by_tag_name_ns, #get_html, #get_inner_html, #has_attribute?, #has_attribute_ns?, #has_attributes?, #has_child_nodes?, #hide_popover, #id, #id=, #initialize, #inner_html, #inner_html=, #insert_adjacent_element, #insert_adjacent_html, #insert_adjacent_text, #insert_before, #insertion_parent!, #is_connected?, #last_child, #last_element_child, #live_child_nodes, #local_name, #matches?, #namespace_uri, #next_element_sibling, #next_sibling, #normalize, #on, #outer_html, #outer_html=, #owner_document, #parent_element, #parent_node, #path, #previous_element_sibling, #previous_sibling, #query_selector, #query_selector_all, #reflected_attr_name, #reflected_token_list, #remove, #remove_attribute, #remove_attribute_node, #remove_attribute_ns, #remove_child, #replace_child, #replace_with_nodes, #request_fullscreen, #role, #role=, #root_node, #same_node?, #scoped_query, #set_attribute, #set_attribute_node, #set_attribute_ns, #shadow_root, #show_popover, #slot, #slot=, #style, #tag_name, #text_content, #text_content=, #to_s, #toggle_attribute, #toggle_popover, #with_selector_errors, #xpath

Methods included from Bridge::Methods

included

Methods included from Internal::ParentNode

#append, #append_child, #prepend, #replace_children

Methods included from Node

#compare_document_position, #get_root_node, #is_default_namespace, #is_equal_node, #is_same_node, #lookup_namespace_uri, #lookup_prefix

Methods included from EventTarget

#__internal_deliver_event__, #__internal_event_parent__, #add_event_listener, capture_flag, #deliver_at, #dispatch_event, js_truthy?, #remove_event_listener

Constructor Details

This class inherits a constructor from Dommy::Element

Instance Method Details

#__js_get__(key) ⇒ Object



1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
# File 'lib/dommy/html_elements.rb', line 1329

def __js_get__(key)
  case key
  when "value"
    value
  when "defaultValue"
    default_value
  when "type"
    type
  when "form"
    form
  when "labels"
    labels
  when "validity"
    validity
  when "htmlFor"
    # `output.htmlFor` is a DOMTokenList (unlike `label.htmlFor`, a string).
    reflected_token_list("htmlFor", "for")
  else
    super
  end
end

#__js_set__(key, v) ⇒ Object



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
# File 'lib/dommy/html_elements.rb', line 1351

def __js_set__(key, v)
  case key
  when "value"
    self.value = v
  when "defaultValue"
    self.default_value = v
  when "htmlFor"
    set_reflected_string("for", v)
  else
    super
  end
end

#check_validityObject



1321
1322
1323
# File 'lib/dommy/html_elements.rb', line 1321

def check_validity
  true
end

#default_valueObject



1290
1291
1292
# File 'lib/dommy/html_elements.rb', line 1290

def default_value
  text_content
end

#default_value=(v) ⇒ Object



1294
1295
1296
# File 'lib/dommy/html_elements.rb', line 1294

def default_value=(v)
  self.text_content = v
end

#formObject



1303
1304
1305
# File 'lib/dommy/html_elements.rb', line 1303

def form
  closest("form")
end

#html_for_tokensObject

‘for` attribute is a space-separated list of IDs.



1299
1300
1301
# File 'lib/dommy/html_elements.rb', line 1299

def html_for_tokens
  reflected_string("for").split(/\s+/).reject(&:empty?)
end

#labelsObject



1307
1308
1309
1310
1311
# File 'lib/dommy/html_elements.rb', line 1307

def labels
  return [] if id.empty?

  @document.query_selector_all("label[for='#{id}']")
end

#report_validityObject



1325
1326
1327
# File 'lib/dommy/html_elements.rb', line 1325

def report_validity
  true
end

#typeObject



1313
1314
1315
# File 'lib/dommy/html_elements.rb', line 1313

def type
  "output"
end

#validityObject



1317
1318
1319
# File 'lib/dommy/html_elements.rb', line 1317

def validity
  ValidityState.new
end

#valueObject



1282
1283
1284
# File 'lib/dommy/html_elements.rb', line 1282

def value
  text_content
end

#value=(v) ⇒ Object



1286
1287
1288
# File 'lib/dommy/html_elements.rb', line 1286

def value=(v)
  self.text_content = v
end