Class: Fortitude::Doctypes::Html5

Inherits:
Base
  • Object
show all
Defined in:
lib/fortitude/doctypes/html5.rb

Constant Summary collapse

GLOBAL_ATTRIBUTES =

HTML5 spec, section 3.2.5

%w{accesskey class contenteditable dir draggable dropzone hidden id lang spellcheck style} +
%w{tabindex title translate}
ARIA_ATTRIBUTES =

HTML5 spec, section 3.2.7

%w{role}
EVENT_HANDLER_GLOBAL_ATTRIBUTES =

HTML5 spec, section 3.2.5

%w{onabort onblur oncancel oncanplay oncanplaythrough onchange onclick} +
%w{onclose oncuechange ondblclick ondrag ondragend ondragenter ondragexit ondragleave ondragover ondragstart} +
%w{ondrop ondurationchange onemptied onended onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup} +
%w{onload onloadeddata onloadedmetadata onloadstart onmousedown onmouseenter onmouseleave onmousemove} +
%w{onmouseout onmouseover onmouseup onmousewheel onpause onplay onplaying onprogress onratechange onreset} +
%w{onresize onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate ontoggle} +
%w{onvolumechange onwaiting}
ALL_ELEMENTS_ATTRIBUTES =
GLOBAL_ATTRIBUTES | ARIA_ATTRIBUTES | EVENT_HANDLER_GLOBAL_ATTRIBUTES
METADATA_CONTENT =

HTML5 spec, section 3.2.4.1.1

%w{base link meta noscript script style template title}
FLOW_CONTENT =

HTML5 spec, section 3.2.4.1.2

%w{a abbr address area article aside audio b bdi bdo blockquote br button canvas cite code data} +
%w{datalist del details dfn dialog div dl em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 header hr i} +
%w{iframe img input ins kbd keygen label main map mark math meter nav noscript object ol output p pre} +
%w{progress q ruby s samp script section select small span strong style sub sup svg table template textarea} +
%w{time u ul var video wbr _text}
SECTIONING_CONTENT =

HTML5 spec, section 3.2.4.1.3

%w{article aside nav section}
HEADING_CONTENT =

HTML5 spec, section 3.2.4.1.4

%w{h1 h2 h3 h4 h5 h6}
PHRASING_CONTENT =

HTML5 spec, section 3.2.4.1.5

%w{a abbr area audio b bdi bdo br button canvas cite code data datalist del dfn em embed i} +
%w{iframe img input ins kbd keygen label map mark math meter noscript object output progress q ruby s samp} +
%w{script select small span strong sub sup svg template textarea time u var video wbr _text}
EMBEDDED_CONTENT =

HTML5 spec, section 3.2.4.1.6

%w{audio canvas embed iframe img math object svg video}
INTERACTIVE_CONTENT =

HTML5 spec, section 3.2.4.1.7

%w{a audio button details embed iframe img input keygen label object select textarea video}
PALPABLE_CONTENT =

HTML5 spec, section 3.2.4.1.8

%w{a abbr address article aside audio b bdi bdo blockquote button canvas cite code data} +
%w{details dfn div dl em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 header i iframe img input} +
%w{ins kbd keygen label main map mark math meter nav object ol output p pre progress q ruby s samp section} +
%w{select small span strong sub sup svg table textarea time u ul var video _text}
SCRIPT_SUPPORTING_ELEMENTS =

HTML5 spec, section 3.2.4.1.9

%w{script template}

Instance Attribute Summary

Attributes inherited from Base

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#declare!, delegate_tag_stores, #tags, #to_s

Methods included from Tags::TagStore

#delegate_tag_stores, #modify_tag, #tag, #tag_names, #tags, #tags_added!, #tags_changed!

Constructor Details

#initializeHtml5

Returns a new instance of Html5.



7
8
9
# File 'lib/fortitude/doctypes/html5.rb', line 7

def initialize
  super(:html5, "html")
end

Class Method Details

.html5_tag(name, options = { }) ⇒ Object



46
47
48
49
50
51
# File 'lib/fortitude/doctypes/html5.rb', line 46

def html5_tag(name, options = { })
  options[:valid_attributes] = (options[:valid_attributes] || [ ]).map { |x| x.to_s.strip.downcase }
  options[:valid_attributes] |= ALL_ELEMENTS_ATTRIBUTES

  tag(name, options)
end

Instance Method Details

#allows_bare_attributes?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/fortitude/doctypes/html5.rb', line 19

def allows_bare_attributes?
  true
end

#close_void_tags_must_beObject



23
24
25
# File 'lib/fortitude/doctypes/html5.rb', line 23

def close_void_tags_must_be
  nil
end

#default_javascript_tag_attributesObject



11
12
13
# File 'lib/fortitude/doctypes/html5.rb', line 11

def default_javascript_tag_attributes
  { }
end

#needs_cdata_in_javascript_tag?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/fortitude/doctypes/html5.rb', line 15

def needs_cdata_in_javascript_tag?
  false
end