Child Selection
Here is where conventions on selecting children will live.
Element.select (selector)
This is text about Element.select
Element.selectAll (selector)
This is text about Element.selectAll Medium Article Link
No need for Node.js, Webpack, Babel, or Gulp.
snuggsiツ works in production or in a plain 'ol HTML file!
Simply place the following script within your webpage:
<script src=https://unpkg.com/snuggsi></script>
Et Voila (that's it!) ツ
See
ECMAScript Module Imports
for <script type=module>
support!
define
Element
Element `your-tag-name`
declaration immediately followed with a (class extends HTMLElement {})
definition.
The custom element will be considered an UnknownHTMLElement
until an Element
definition is specified. This means your custom element can be styled like any other HTML element.
However, your element will not have functionality until after definition.
initialize
Construction
constructor ()
routine. Typically you will not need to define a
constructor ()
on your class
. snuggsiツ
takes care of all super ()
calls for you on instantiation.
initialize ()
function which is a hook that will be used automatically.
class extends HTMLElement
definition for Event Handlers.
These are typically methods prefixed with on (example: onclick (event)
).
snuggsiツ will automagically™
delegate the event handler to your custom element container. As a
convenience the this
keyword will Always be bound to the custom element.
<link>
Importing
<link rel=import>
step is critical for custom elements which contain a definition within an external file.
(See
HTML Imports
for more detail).
This is not your typical "import javascript library" you have been used to for years.
Imports are relative to the partial HTML document that contains the contents to hydrate each
instance of your custom element on upgrade.
<slot>
Replacement
slot=slotname
attribute within your custom element. Your "Named Slot Elements"
will replace the default import slots If the slot attribute coincides with
a <slot name=slotname>
defined within the imported custom element. In other words …
An element with a slot attribute is assigned to the slot created by the
<slot> element whose name attribute's value matches that slot attribute's value.
onclick (event)
).
onconnect ()
hook is fired.
this.render ()
.
event.prevent ()
from within handler functions. Be sure to declare event
in your method signature.
(example: onclick (event) { event.prevent () }
{token}
Binding
{token}
is discovered.
Tokens are a declarative placeholder for "Computed Property" values declared in your class definition.
{foo}
is replaced with "some value"
If a get foo () { return 'some value' }
is a property of your class definition.
<template>
Iteration
<template name=…>
and "bind" the collection value of a property with the same name on your class.
<template>
HTML.
snuggsiツ will "Tree Walk"™
your custom element and children looking for
valid W3C GlobalEventHandlers
by name once "connected" to the HTML document.
<foo-bar onclick=hello>
will "automagically"™ register
the hello (event) { }
handler defined on the custom element class
definition.
<button onclick=onfoo>
,
an imperative registration onclick (event) {}
,
or an explicit registration this.on ('click', this.onfoo)
,
the Rendering pipeline will force a
"reflow" and "repaint"
unless the event
is explicitly prevented.
To prevent Rendering simply prevent the default event action by calling
event.prevent ()
within the custom element handler.
Here is where conventions on selecting children will live.
Element.select (selector)
This is text about Element.select
Element.selectAll (selector)
This is text about Element.selectAll Medium Article Link
PRPL is a pattern for structuring and serving Progressive Web Apps (PWAs), with an emphasis on the performance of app delivery and launch. It stands for:
Beyond targeting the fundamental goals and standards of P.W.A.s, P.R.P.L. strives to optimize for:
P.R.P.L. is inspired by a suite of modern web platform features, but it’s possible to apply the pattern without hitting every letter in the acronym or using every feature. Medium Article Link
Should never reach outside of your component to talk to siblings. There should be a "parent container" component that "sandboxes" in related components.
This is some content about interfaces
Documentation about interfaces:element
Documentation about interfaces:element:select
Documentation about interfaces:element:select
Element
Element.select
Element.selectAll