Class: Phlex::HTML Abstract

Inherits:
SGML
  • Object
show all
Extended by:
Elements
Includes:
StandardElements, VoidElements
Defined in:
lib/phlex/html.rb

Overview

This class is abstract.

Subclass and define SGML#template to create an HTML component class.

Defined Under Namespace

Modules: StandardElements, VoidElements

Constant Summary collapse

EVENT_ATTRIBUTES =

A list of HTML attributes that have the potential to execute unsafe JavaScript.

%w[onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay oncanplaythrough onchange onclick oncontextmenu oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpaste onpause onplay onplaying onpopstate onprogress onratechange onreset onresize onscroll onsearch onseeked onseeking onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onunload onvolumechange onwaiting onwheel].to_h { [_1, true] }.freeze
UNBUFFERED_MUTEX =
Mutex.new

Instance Method Summary collapse

Methods included from Elements

register_element

Methods included from VoidElements

#area, #br, #col, #embed, #hr, #img, #input, #link, #meta, #param, #source, #track

Methods included from StandardElements

#a, #abbr, #address, #article, #aside, #audio, #b, #base, #bdi, #bdo, #blockquote, #body, #button, #canvas, #caption, #cite, #code, #colgroup, #data, #datalist, #dd, #del, #details, #dfn, #dialog, #div, #dl, #dt, #em, #fieldset, #figcaption, #figure, #footer, #form, #h1, #h2, #h3, #h4, #h5, #h6, #head, #header, #hgroup, #html, #i, #iframe, #ins, #kbd, #label, #legend, #li, #main, #map, #mark, #menu, #meter, #nav, #noscript, #object, #ol, #optgroup, #option, #output, #p, #picture, #portal, #pre, #progress, #q, #rp, #rt, #ruby, #s, #samp, #script, #search, #section, #select, #slot, #small, #span, #strong, #style, #sub, #summary, #sup, #table, #tbody, #td, #template_tag, #textarea, #tfoot, #th, #thead, #time, #title, #tr, #u, #ul, #var, #video, #wbr

Methods inherited from SGML

#after_template, #around_template, #await, #before_template, call, #call, #capture, #comment, #context, #format_object, #initialize, method_added, new, #plain, #render, #render?, #template, #unsafe_raw, #view_template, #whitespace, #yield_content, #yield_content_with_args, #yield_content_with_no_args

Methods included from Helpers

#classes, #mix, #tokens

Constructor Details

This class inherits a constructor from Phlex::SGML

Instance Method Details

#content_typeObject



59
60
61
# File 'lib/phlex/html.rb', line 59

def content_type
	"text/html"
end

#doctypeObject

Output an HTML doctype.



31
32
33
34
35
36
37
# File 'lib/phlex/html.rb', line 31

def doctype
	context = @_context
	return if context.fragments && !context.in_target_fragment

	context.buffer << "<!DOCTYPE html>"
	nil
end

#filenameObject



55
56
57
# File 'lib/phlex/html.rb', line 55

def filename
	nil
end

#svgnil

Outputs an <svg> tag



42
43
44
45
46
47
48
# File 'lib/phlex/html.rb', line 42

def svg(...)
	super do
		render Phlex::SVG.new do |svg|
			yield(svg)
		end
	end
end