<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jérémy Lal</title>
    <description>The latest articles on DEV Community by Jérémy Lal (@kapouer).</description>
    <link>https://dev.to/kapouer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F18238%2F01253def-3a3b-4b3f-9f17-82b0962b76df.jpeg</url>
      <title>DEV Community: Jérémy Lal</title>
      <link>https://dev.to/kapouer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kapouer"/>
    <language>en</language>
    <item>
      <title>template engines still ignore the power of the DOM</title>
      <dc:creator>Jérémy Lal</dc:creator>
      <pubDate>Sun, 20 Jan 2019 00:19:24 +0000</pubDate>
      <link>https://dev.to/kapouer/template-engines-still-ignore-the-power-of-the-dom-59nc</link>
      <guid>https://dev.to/kapouer/template-engines-still-ignore-the-power-of-the-dom-59nc</guid>
      <description>

&lt;p&gt;I need you to &lt;strong&gt;leave&lt;/strong&gt; php-thinking today.&lt;br&gt;
Why ?&lt;br&gt;
Because that kind of thinking makes you build "string-based" template engines, and this is bad.&lt;/p&gt;

&lt;p&gt;Obviously it's bad security-wise, string-based engines don't know where they're &lt;br&gt;
merging data in an attribute, a tag name, pure text, or html.&lt;br&gt;
They have a hard time keeping it right because the DOM evolves too fast for them.&lt;/p&gt;

&lt;p&gt;The DOM should come first, then templating after.&lt;br&gt;
Embrace the DOM. Don't try:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/hyperhtml"&gt;hyperhtml&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/marko"&gt;marko&lt;/a&gt;
because they're just fiddling around the DOM.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I've been trying to make something purely DOM based:&lt;br&gt;
&lt;a href="https://github.com/kapouer/matchdom"&gt;https://github.com/kapouer/matchdom&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;however, i recognize the API is odd.&lt;/p&gt;

&lt;p&gt;Please help me improve it if you're motivated !&lt;/p&gt;


</description>
      <category>domtemplateheadless</category>
    </item>
    <item>
      <title>CAA records only have a meaning in a world without *free* SSL providers</title>
      <dc:creator>Jérémy Lal</dc:creator>
      <pubDate>Sat, 19 Jan 2019 23:47:22 +0000</pubDate>
      <link>https://dev.to/kapouer/caa-records-only-have-a-meaning-in-a-world-without-free-ssl-providers-34cb</link>
      <guid>https://dev.to/kapouer/caa-records-only-have-a-meaning-in-a-world-without-free-ssl-providers-34cb</guid>
      <description>

&lt;p&gt;&lt;code&gt;thatsheepdomain.com CAA 0 "evilexpensiveauthority.com"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A good-looking &lt;a href="RFC%206844"&gt;https://tools.ietf.org/html/rfc6844&lt;/a&gt; came out five years ago: DNS CAA.&lt;br&gt;
That looks cool, and even ssllabs has a warning shown when it's not there.&lt;/p&gt;

&lt;p&gt;I thought it was awesome and &lt;a href="https://github.com/AnalogJ/lexicon/issues/282"&gt;lobbied around&lt;/a&gt; to support this !&lt;/p&gt;

&lt;p&gt;Except that today i'm here to warn you about that thing.&lt;/p&gt;

&lt;p&gt;CAA record is meant for organisations to make sure everyone within is using the same SSL certificate authority for the websites under a given root domain name.&lt;/p&gt;

&lt;p&gt;All contractors providing &lt;code&gt;xxx.thatsheepdomain.com&lt;/code&gt; need to get certificates from "evilexpensiveauthority.com".&lt;/p&gt;

&lt;p&gt;This often is enforced as a company policy, to make sure there's only one provider of certificates - and only one way to deal with those scary certificates - after all, failing to update them can break a service.&lt;/p&gt;

&lt;p&gt;That kind of internal company policy has always been around, sometimes for very good reasons, and now it can be enforced by an official standard. There are tractations to make browsers use it. Mozilla accepted it, &lt;a href="https://letsencrypt.org/docs/caa/"&gt;let's encrypt&lt;/a&gt; honors it.&lt;/p&gt;

&lt;p&gt;Looks good ?&lt;/p&gt;

&lt;p&gt;But hell is in the details.&lt;/p&gt;

&lt;p&gt;For some years Let's encrypt + open-source acme protocol + open-source certbot client (or any other acme-compatible client) has been delivering hundreds of millions of free SSL certificates, prompting "Legacy" companies (the ones asking for money, and whose employees wrote the RFC about CAA, just check the link) to push their customers to use CAA records, as a reaction to the unbearable open and free movement.&lt;/p&gt;

&lt;p&gt;I suppose the non-free companies use the "be scared of security issues" tactic.&lt;br&gt;
Please quickly enforce a company policy or face hell.&lt;br&gt;
A company adopting such a policy will make sure there is no disparate SSL authorities contractors.&lt;/p&gt;

&lt;p&gt;Q.E.D.&lt;/p&gt;

&lt;p&gt;CAA records only have a meaning in a world without &lt;em&gt;free&lt;/em&gt; SSL providers.&lt;/p&gt;


</description>
      <category>dnssslmafia</category>
    </item>
    <item>
      <title>use conditional breakpoints to call console.log</title>
      <dc:creator>Jérémy Lal</dc:creator>
      <pubDate>Wed, 07 Nov 2018 11:19:58 +0000</pubDate>
      <link>https://dev.to/kapouer/use-conditional-breakpoints-to-call-consolelog-503g</link>
      <guid>https://dev.to/kapouer/use-conditional-breakpoints-to-call-consolelog-503g</guid>
      <description>&lt;p&gt;This is something so simple i wonder why i did not think of it before:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzphwworz9btyki5ub83v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzphwworz9btyki5ub83v.png" alt="Just like that" width="643" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>debugger</category>
      <category>browser</category>
    </item>
    <item>
      <title>Unite Server-Side rendering and Single-Page applications</title>
      <dc:creator>Jérémy Lal</dc:creator>
      <pubDate>Sun, 29 Jul 2018 13:22:56 +0000</pubDate>
      <link>https://dev.to/kapouer/unite-server-side-rendering-and-single-page-applications-5hb</link>
      <guid>https://dev.to/kapouer/unite-server-side-rendering-and-single-page-applications-5hb</guid>
      <description>&lt;p&gt;This sums up my findings when writing &lt;a href="https://github.com/kapouer/window-page"&gt;https://github.com/kapouer/window-page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A web page is defined by its url &lt;code&gt;pathname&lt;/code&gt; and &lt;code&gt;query&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  phases
&lt;/h1&gt;

&lt;h2&gt;
  
  
  · route
&lt;/h2&gt;

&lt;p&gt;Bootstrap initial document that loads scripts and stylesheets.&lt;/p&gt;

&lt;h2&gt;
  
  
  · build
&lt;/h2&gt;

&lt;p&gt;Scripts and stylesheets loaded during route are available.&lt;/p&gt;

&lt;p&gt;Build document depending on &lt;code&gt;pathname&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  · patch
&lt;/h2&gt;

&lt;p&gt;Document has been built.&lt;/p&gt;

&lt;p&gt;Modify document depending on &lt;code&gt;query&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  · setup
&lt;/h2&gt;

&lt;p&gt;Initialize User Interface (animations and stuff).&lt;/p&gt;

&lt;p&gt;Register event listeners on document's body.&lt;/p&gt;

&lt;h2&gt;
  
  
  · close
&lt;/h2&gt;

&lt;p&gt;Cleanup User Interface.&lt;/p&gt;

&lt;p&gt;Unregister event listeners on document's body.&lt;/p&gt;

&lt;h1&gt;
  
  
  prerendering
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;document.visibilityState == "prerendering"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Two equivalent scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;server-side prerendering (jsdom...)&lt;/li&gt;
&lt;li&gt;browser prerendering (safari...)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The functions bound to these phases must be run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;route&lt;/li&gt;
&lt;li&gt;build&lt;/li&gt;
&lt;li&gt;patch&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and document is serialized as HTML.&lt;/p&gt;

&lt;h1&gt;
  
  
  rendering
&lt;/h1&gt;

&lt;p&gt;All other cases.&lt;/p&gt;

&lt;p&gt;Prerendered HTML is loaded along with scripts and styles, then the functions bound to these phases must be run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;setup&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  navigation
&lt;/h1&gt;

&lt;p&gt;Can happen through History API, or by following links, submitting forms, etc...&lt;br&gt;
All of which must be properly intercepted.&lt;/p&gt;

&lt;p&gt;If only current &lt;code&gt;query&lt;/code&gt; changes, only the functions bound to this phase must be run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;patch&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Otherwise it is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;close&lt;/li&gt;
&lt;li&gt;route&lt;/li&gt;
&lt;li&gt;build&lt;/li&gt;
&lt;li&gt;patch&lt;/li&gt;
&lt;li&gt;setup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or, if &lt;code&gt;route&lt;/code&gt; replaces current document by fetching a prerendered document:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;close&lt;/li&gt;
&lt;li&gt;route&lt;/li&gt;
&lt;li&gt;setup&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  credentials
&lt;/h1&gt;

&lt;p&gt;route, build, patch phases will typically fetch data through HTTP: credentials can be passed along to these requests if needed.&lt;/p&gt;

&lt;h1&gt;
  
  
  custom elements reacting to patch phase (query changes)
&lt;/h1&gt;

&lt;p&gt;In this framework it must be done manually, either by calling directly an element's update method, or firing an event on current document, or delegating to a singleton manager.&lt;/p&gt;

&lt;h1&gt;
  
  
  additional comments
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;at the time of writing the module, asynchronous events were not a thing yet, so i had to implement my own promise chains and double them with synchronous events to be able to listen for changes even before the router library was not yet loaded (which can be needed when doing complicated stuff with iframes).&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>ssr</category>
      <category>spa</category>
    </item>
  </channel>
</rss>
