Sha256: 6fa9d56e5ebf5280d57d1d5de47ac9fa4999ded1dd40f316200a51f13bf5c6be
Contents?: true
Size: 1.75 KB
Versions: 15
Compression:
Stored size: 1.75 KB
Contents
# backtick_javascript: true module Preact::HtmlElements # https://html.spec.whatwg.org/multipage/indices.html#elements-3 SUPPORTED_HTML_ELEMENTS = %w[ a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark math menu meta meter nav noscript object ol optgroup option output p picture pre progress q rp rt ruby s samp script section select slot small source span strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track u ul var video wbr ] if RUBY_ENGINE == 'opal' %x{ const $op = Opal.Preact; } SUPPORTED_HTML_ELEMENTS.each do |element| define_method(element.underscore.JS.toUpperCase()) do |props = nil, &block| %x{ if (typeof block === 'function') $op.$_render_element.$$p = block; $op.$_render_element(element, props, block) } end end else SUPPORTED_HTML_ELEMENTS.each do |element| define_method(element.to_s.underscore.upcase.to_sym) do |props = nil, &block| ::Preact._render_element(element, props, &block) end end end # Get Preact Element from render buffer def GPE(arg, &block) if block_given? el = block.call return el if el end ::Preact.render_buffer.last.pop end # Render Preact Element to render buffer def RPE(el) ::Preact.render_buffer.last << el nil end end
Version data entries
15 entries across 15 versions & 1 rubygems