Class HTML5::Phase
In: lib/html5/html5parser/phase.rb
Parent: Object

Base class for helper objects that implement each phase of processing.

Handler methods should be in the following order (they can be omitted):

  * EOF
  * Comment
  * Doctype
  * SpaceCharacters
  * Characters
  * StartTag
    - startTag* methods
  * EndTag
    - endTag* methods

Methods

Public Class methods

Declare what end tags this Phase handles. Behaves like handle_start.

Declare what start tags this Phase handles. Can be called more than once.

Example usage:

  handle_start 'html'
  # html start tags will be handled by a method named 'startTagHtml'

  handle_start %( base link meta )
  # base, link and meta start tags will be handled by a method named 'startTagBaseLinkMeta'

  handle_start %( li dt dd ) => 'ListItem'
  # li, dt, and dd start tags will be handled by a method named 'startTagListItem'

The following example call:

  tag_handlers('startTag', 'html', %w( base link meta ), %w( li dt dd ) => 'ListItem')

…would return a hash equal to this:

  { 'html' => 'startTagHtml',
    'base' => 'startTagBaseLinkMeta',
    'link' => 'startTagBaseLinkMeta',
    'meta' => 'startTagBaseLinkMeta',
    'li'   => 'startTagListItem',
    'dt'   => 'startTagListItem',
    'dd'   => 'startTagListItem'  }

Public Instance methods

[Validate]