Class: Dommy::Element

Inherits:
Object
  • Object
show all
Includes:
Bridge::Methods, EventTarget, Internal::ParentNode, Node
Defined in:
lib/dommy/element.rb

Direct Known Subclasses

HTMLElement, SVGElement

Constant Summary collapse

HTML_NAMESPACE =
"http://www.w3.org/1999/xhtml"
REFLECTED_TOKEN_LIST_HOSTS =

Element + namespace combinations for which a reflected DOMTokenList IDL attribute is defined; elsewhere the attribute does not exist (→ undefined).

{
  "relList" => {html: %w[a area link], svg: %w[a]},
  "htmlFor" => {html: %w[output]},
  "sandbox" => {html: %w[iframe]},
  "sizes" => {html: %w[link]}
}.freeze
SVG_NAMESPACE =
"http://www.w3.org/2000/svg"
SHADOW_HOST_TAGS =

Elements that may host a Shadow DOM tree per the HTML spec. Custom-element-style names (containing "-") are also allowed.

%w[
article
aside
blockquote
body
div
footer
h1
h2
h3
h4
h5
h6
header
main
nav
p
section
span
    ]
.freeze
ADJACENT_POSITIONS =

el.insertAdjacentElement(position, element) — DOM spec positions: "beforebegin", "afterbegin", "beforeend", "afterend". Returns the inserted element or nil if position has no anchor (root cases).

%w[beforebegin afterbegin beforeend afterend].freeze
ELEMENT_NODE =

Node type / NodeFilter bitmask constants — DOM Level 3 says these are exposed on both the constructor and every instance. Defined at the bottom of the class so subclasses inherit them too.

1
ATTRIBUTE_NODE =
2
TEXT_NODE =
3
CDATA_SECTION_NODE =
4
PROCESSING_INSTRUCTION_NODE =
7
COMMENT_NODE =
8
DOCUMENT_NODE =
9
DOCUMENT_TYPE_NODE =
10
DOCUMENT_FRAGMENT_NODE =
11
DOCUMENT_POSITION_DISCONNECTED =
0x01
DOCUMENT_POSITION_PRECEDING =
0x02
DOCUMENT_POSITION_FOLLOWING =
0x04
DOCUMENT_POSITION_CONTAINS =
0x08
DOCUMENT_POSITION_CONTAINED_BY =
0x10
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC =
0x20
INLINE_TAGS =

Estimate y, width, height (CSS px) without laying out the page: block elements fill the viewport width; inline elements are sized to their text; height is the wrapped line count × a nominal line height. Position is the origin (we don't position elements). Used only when approximate_layout?.

%w[a span b i em strong small code label abbr cite q sub sup time mark u s
tt var samp kbd bdi bdo wbr big font nobr].freeze
APPROX_CHAR_PX =
8
APPROX_LINE_PX =
20

Constants included from Node

Node::XMLNS_NAMESPACE, Node::XML_NAMESPACE

Instance Attribute Summary collapse

Instance Method Summary collapse