Methods
B
D
I
O
R
S
T
Constants
Desc = Struct.new("HTMLElementDescription", :name, :startTag, :endTag, :saveEndTag, :empty, :depr, :dtd, :isinline, :desc, :subelts, :defaultsubelt, :attrs_opt, :attrs_depr, :attrs_req)
 

Methods are defined protected by method_defined? because at this point the C-library or Java library is already loaded, and we don't want to clobber any methods that have been defined there.

DefaultDescriptions = Hash.new()
 

This is filled in down below.

FONTSTYLE = ["tt", "i", "b", "u", "s", "strike", "big", "small"]
 

Attributes defined and categorized

PHRASE = ['em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym']
 
SPECIAL = ['a', 'img', 'applet', 'embed', 'object', 'font','basefont', 'br', 'script', 'map', 'q', 'sub', 'sup', 'span', 'bdo', 'iframe']
 
PCDATA = []
 
HEADING = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
 
LIST = ['ul', 'ol', 'dir', 'menu']
 
FORMCTRL = ['input', 'select', 'textarea', 'label', 'button']
 
BLOCK = [HEADING, LIST, 'pre', 'p', 'dl', 'div', 'center', 'noscript', 'noframes', 'blockquote', 'form', 'isindex', 'hr', 'table', 'fieldset', 'address']
 
INLINE = [PCDATA, FONTSTYLE, PHRASE, SPECIAL, FORMCTRL]
 
FLOW = [BLOCK, INLINE]
 
MODIFIER = []
 
EMPTY = []
 
HTML_FLOW = FLOW
 
HTML_INLINE = INLINE
 
HTML_PCDATA = PCDATA
 
HTML_CDATA = HTML_PCDATA
 
COREATTRS = ['id', 'class', 'style', 'title']
 
I18N = ['lang', 'dir']
 
EVENTS = ['onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup']
 
ATTRS = [COREATTRS, I18N,EVENTS]
 
CELLHALIGN = ['align', 'char', 'charoff']
 
CELLVALIGN = ['valign']
 
HTML_ATTRS = ATTRS
 
CORE_I18N_ATTRS = [COREATTRS, I18N]
 
CORE_ATTRS = COREATTRS
 
I18N_ATTRS = I18N
 
A_ATTRS = [ATTRS, 'charset', 'type', 'name', 'href', 'hreflang', 'rel', 'rev', 'accesskey', 'shape', 'coords', 'tabindex', 'onfocus', 'onblur']
 
TARGET_ATTR = ['target']
 
ROWS_COLS_ATTR = ['rows', 'cols']
 
ALT_ATTR = ['alt']
 
SRC_ALT_ATTRS = ['src', 'alt']
 
HREF_ATTRS = ['href']
 
CLEAR_ATTRS = ['clear']
 
INLINE_P = [INLINE, 'p']
 
FLOW_PARAM = [FLOW, 'param']
 
APPLET_ATTRS = [COREATTRS , 'codebase', 'archive', 'alt', 'name', 'height', 'width', 'align', 'hspace', 'vspace']
 
AREA_ATTRS = ['shape', 'coords', 'href', 'nohref', 'tabindex', 'accesskey', 'onfocus', 'onblur']
 
BASEFONT_ATTRS = ['id', 'size', 'color', 'face']
 
QUOTE_ATTRS = [ATTRS, 'cite']
 
BODY_CONTENTS = [FLOW, 'ins', 'del']
 
BODY_ATTRS = [ATTRS, 'onload', 'onunload']
 
BODY_DEPR = ['background', 'bgcolor', 'text', 'link', 'vlink', 'alink']
 
BUTTON_ATTRS = [ATTRS, 'name', 'value', 'type', 'disabled', 'tabindex', 'accesskey', 'onfocus', 'onblur']
 
COL_ATTRS = [ATTRS, 'span', 'width', CELLHALIGN, CELLVALIGN]
 
COL_ELT = ['col']
 
EDIT_ATTRS = [ATTRS, 'datetime', 'cite']
 
COMPACT_ATTRS = [ATTRS, 'compact']
 
DL_CONTENTS = ['dt', 'dd']
 
COMPACT_ATTR = ['compact']
 
LABEL_ATTR = ['label']
 
FIELDSET_CONTENTS = [FLOW, 'legend' ]
 
FONT_ATTRS = [COREATTRS, I18N, 'size', 'color', 'face' ]
 
FORM_CONTENTS = [HEADING, LIST, INLINE, 'pre', 'p', 'div', 'center', 'noscript', 'noframes', 'blockquote', 'isindex', 'hr', 'table', 'fieldset', 'address']
 
FORM_ATTRS = [ATTRS, 'method', 'enctype', 'accept', 'name', 'onsubmit', 'onreset', 'accept-charset']
 
FRAME_ATTRS = [COREATTRS, 'longdesc', 'name', 'src', 'frameborder', 'marginwidth', 'marginheight', 'noresize', 'scrolling' ]
 
FRAMESET_ATTRS = [COREATTRS, 'rows', 'cols', 'onload', 'onunload']
 
FRAMESET_CONTENTS = ['frameset', 'frame', 'noframes']
 
HEAD_ATTRS = [I18N, 'profile']
 
HEAD_CONTENTS = ['title', 'isindex', 'base', 'script', 'style', 'meta', 'link', 'object']
 
HR_DEPR = ['align', 'noshade', 'size', 'width']
 
VERSION_ATTR = ['version']
 
HTML_CONTENT = ['head', 'body', 'frameset']
 
IFRAME_ATTRS = [COREATTRS, 'longdesc', 'name', 'src', 'frameborder', 'marginwidth', 'marginheight', 'scrolling', 'align', 'height', 'width']
 
IMG_ATTRS = [ATTRS, 'longdesc', 'name', 'height', 'width', 'usemap', 'ismap']
 
EMBED_ATTRS = [COREATTRS, 'align', 'alt', 'border', 'code', 'codebase', 'frameborder', 'height', 'hidden', 'hspace', 'name', 'palette', 'pluginspace', 'pluginurl', 'src', 'type', 'units', 'vspace', 'width']
 
INPUT_ATTRS = [ATTRS, 'type', 'name', 'value', 'checked', 'disabled', 'readonly', 'size', 'maxlength', 'src', 'alt', 'usemap', 'ismap', 'tabindex', 'accesskey', 'onfocus', 'onblur', 'onselect', 'onchange', 'accept']
 
PROMPT_ATTRS = [COREATTRS, I18N, 'prompt']
 
LABEL_ATTRS = [ATTRS, 'for', 'accesskey', 'onfocus', 'onblur']
 
LEGEND_ATTRS = [ATTRS, 'accesskey']
 
ALIGN_ATTR = ['align']
 
LINK_ATTRS = [ATTRS, 'charset', 'href', 'hreflang', 'type', 'rel', 'rev', 'media']
 
MAP_CONTENTS = [BLOCK, 'area']
 
NAME_ATTR = ['name']
 
ACTION_ATTR = ['action']
 
BLOCKLI_ELT = [BLOCK, 'li']
 
META_ATTRS = [I18N, 'http-equiv', 'name', 'scheme']
 
CONTENT_ATTR = ['content']
 
TYPE_ATTR = ['type']
 
NOFRAMES_CONTENT = ['body', FLOW, MODIFIER]
 
OBJECT_CONTENTS = [FLOW, 'param']
 
OBJECT_ATTRS = [ATTRS, 'declare', 'classid', 'codebase', 'data', 'type', 'codetype', 'archive', 'standby', 'height', 'width', 'usemap', 'name', 'tabindex']
 
OBJECT_DEPR = ['align', 'border', 'hspace', 'vspace']
 
OL_ATTRS = ['type', 'compact', 'start']
 
OPTION_ELT = ['option']
 
OPTGROUP_ATTRS = [ATTRS, 'disabled']
 
OPTION_ATTRS = [ATTRS, 'disabled', 'label', 'selected', 'value']
 
PARAM_ATTRS = ['id', 'value', 'valuetype', 'type']
 
WIDTH_ATTR = ['width']
 
PRE_CONTENT = [PHRASE, 'tt', 'i', 'b', 'u', 's', 'strike', 'a', 'br', 'script', 'map', 'q', 'span', 'bdo', 'iframe']
 
SCRIPT_ATTRS = ['charset', 'src', 'defer', 'event', 'for']
 
LANGUAGE_ATTR = ['language']
 
SELECT_CONTENT = ['optgroup', 'option']
 
SELECT_ATTRS = [ATTRS, 'name', 'size', 'multiple', 'disabled', 'tabindex', 'onfocus', 'onblur', 'onchange']
 
STYLE_ATTRS = [I18N, 'media', 'title']
 
TABLE_ATTRS = [ATTRS, 'summary', 'width', 'border', 'frame', 'rules', 'cellspacing', 'cellpadding', 'datapagesize']
 
TABLE_DEPR = ['align', 'bgcolor']
 
TABLE_CONTENTS = ['caption', 'col', 'colgroup', 'thead', 'tfoot', 'tbody', 'tr']
 
TR_ELT = ['tr']
 
TALIGN_ATTRS = [ATTRS, CELLHALIGN, CELLVALIGN]
 
TH_TD_DEPR = ['nowrap', 'bgcolor', 'width', 'height']
 
TH_TD_ATTR = [ATTRS, 'abbr', 'axis', 'headers', 'scope', 'rowspan', 'colspan', CELLHALIGN, CELLVALIGN]
 
TEXTAREA_ATTRS = [ATTRS, 'name', 'disabled', 'readonly', 'tabindex', 'accesskey', 'onfocus', 'onblur', 'onselect', 'onchange']
 
TR_CONTENTS = ['th', 'td']
 
BGCOLOR_ATTR = ['bgcolor']
 
LI_ELT = ['li']
 
UL_DEPR = ['type', 'compact']
 
DIR_ATTR = ['dir']
 
Instance Public methods
block?()

Is this element a block element?

# File lib/nokogiri/html/element_description.rb, line 6
def block?
  !inline?
end
default_sub_element()
# File lib/nokogiri/html/element_description_defaults.rb, line 61
def default_sub_element
  d = default_desc
  d ? d.defaultsubelt : nil
end
deprecated?()
# File lib/nokogiri/html/element_description_defaults.rb, line 47
def deprecated?
  d = default_desc
  d ? d.depr : nil
end
deprecated_attributes()
# File lib/nokogiri/html/element_description_defaults.rb, line 75
def deprecated_attributes
  d = default_desc
  d ? d.attrs_depr : []
end
description()
# File lib/nokogiri/html/element_description_defaults.rb, line 54
def description
  d = default_desc
  d ? d.desc : nil
end
implied_end_tag?()
# File lib/nokogiri/html/element_description_defaults.rb, line 33
def implied_end_tag?
  d = default_desc
  d ? d.endTag : nil
end
implied_start_tag?()
# File lib/nokogiri/html/element_description_defaults.rb, line 26
def implied_start_tag?
  d = default_desc
  d ? d.startTag : nil
end
inspect()

Inspection information

# File lib/nokogiri/html/element_description.rb, line 18
def inspect
  "#<#{self.class.name}: #{name} #{description}>"
end
optional_attributes()
# File lib/nokogiri/html/element_description_defaults.rb, line 68
def optional_attributes
  d = default_desc
  d ? d.attrs_opt : []
end
required_attributes()
# File lib/nokogiri/html/element_description_defaults.rb, line 82
def required_attributes
  d = default_desc
  d ? d.attrs_req : []
end
save_end_tag?()
# File lib/nokogiri/html/element_description_defaults.rb, line 40
def save_end_tag?
  d = default_desc
  d ? d.saveEndTag : nil
end
to_s()

Convert this description to a string

# File lib/nokogiri/html/element_description.rb, line 12
def to_s
  "#{name}: #{description}"
end