<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="49627" data-post-id="49627">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="fastel" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  fastel
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi! First of all, would like to say that Drab is really wonderful lib. I’v found an issue with using drab with table’s. Drab-ampere span tag inserted not inside, but before table tag, so when action to update(poke) the table contents is fired - it puts the result just as a text strings before the table where it should be.</p>
<p>For example: i’m using such construction in drab template:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">table
%= for user &lt;- @users do %
   tr
     td&lt;%= user %&gt;/td
   /tr
% end %
/table
</code></pre>
<p>So, after action to change list fired it results that old data (inside table tag is still alive), and new data is printed as plain text (without tags) before table tag in drab-ampere span…</p>
<p>Help, plz.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="49627" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/212">Post #211</a>
	                </div>
	            </div>
              <div id="likers-container-49627" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49627"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #211"></div>
  </section>
</div>
    <div class="postbit" id="49643" data-post-id="49643">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi <a class="mention" href="/u/fastel" rel="nofollow">@fastel</a>,<br>
this is a known issue, Drab.Live does not work correctly with tables.</p>
<p><a href="https://github.com/grych/drab/issues/50" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/grych/drab/issues/50</a></p>
<p>It will be fixed in 0.6.0</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="49643" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/213">Post #212</a>
	                </div>
	            </div>
              <div id="likers-container-49643" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49643"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #212"></div>
  </section>
</div>
    <div class="postbit" id="49691" data-post-id="49691">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>For note, the reason it does not work is Drab tags elements differently, and <code>&lt;table&gt;</code>'s in the HTML5 spec are still broken as hell and <em>only</em> accept a very restricted set of elements within them, else it bumps them to before the table.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="49691" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/214">Post #213</a>
	                </div>
	            </div>
              <div id="likers-container-49691" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49691"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #213"></div>
  </section>
</div>
    <div class="postbit" id="49729" data-post-id="49729">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tmbb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tmbb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>On on hand, HTML5 doesn’t need any more chaos. On the other hand, an element you can put anywhere (like the <code>&lt;span&gt;</code> tag) is very useful in situations just like these…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="49729" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/215">Post #214</a>
	                </div>
	            </div>
              <div id="likers-container-49729" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49729"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #214"></div>
  </section>
</div>
    <div class="postbit" id="50898" data-post-id="50898">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Welcome, my fellow alchemists! A couple of news from the Drab’s world.</p>
<p>The next future version, v0.6.0, is focused on <code>Drab.Live</code> (living assigns). Because of some bugs and limits, I decided to completely refactor it and for now, it looks really promiscuous (for now ;)).</p>
<hr>
<p>First at all, Drab will not sourround <code>&lt;span&gt;</code>  over expressions anymore, as it caused troubles in, for example, tables. Instead of this, it searches for the parent tag, injects some unique ID there and saves the <code>innerHTML</code> of this tag, in the cache, as a pattern.</p>
<p>Thus, if you have a template</p>
<pre><code>&lt;p&gt;My name is Bond, &lt;%= @first_name%&gt;, Bond&lt;/p&gt;
</code></pre>
<p>During the compile time, Drab’s engine injects some ID to <code>&lt;p&gt;</code></p>
<pre><code>&lt;p drab-ampere=ovishfvoaidhfv&gt;My name is Bond, &lt;%= @first_name%&gt;, Bond&lt;/p&gt;
</code></pre>
<p>and saves the <em>pattern</em> to the internal DETS cache (it is a kind of the shadow html of the partial)</p>
<pre><code>{"ovishfvoaidhfv", "My name is Bond, {{{{@drab-expr:fivdosifvoidfj}}}}, Bond"}
</code></pre>
<p>Thanks to this, when updating the assign <code>@first_name</code>, Drab re-renders the <code>innerHTML</code> of that <code>&lt;p&gt;</code> tag, injecting  the new value of rendered expression to the pattern.</p>
<hr>
<p>Second at all, Drab is going to be smarter while updating assigns. Consider the following:</p>
<pre><code>&lt;%= function(@assign1) do %&gt;
    Some text, and other assign: &lt;%= assign2 %&gt;
&lt;% end %&gt;
</code></pre>
<p>In 0.5, updating <code>@assign2</code> re-renders the whole expression. This is because <code>@assign2</code> <em>is one of the  arguments of function/1</em>, which is called as <code>function(@assign, do: {:safe, ...@assign2...})</code>.</p>
<p>That issue was found when having the living assign inside the <code>form_for</code> function. Updating the assign inside the form caused of re-render the whole stuff, including user’s input.</p>
<hr>
<p>Third at all, the new code is smaller and faster (more floki, less regexp!). I’ve learned a lot while doing this.</p>
<hr>
<h3><a name="p-50898-api-change-proposal-html-safe-updates-1" class="anchor" href="#p-50898-api-change-proposal-html-safe-updates-1" aria-label="Heading link" rel="nofollow"></a>API change proposal: HTML safe updates</h3>
<p>Now all the updates in drab are <code>raw</code>. Doing</p>
<pre><code>poke socket, text: "&lt;b&gt;bolded&lt;/b&gt;"
</code></pre>
<p>or</p>
<pre><code>insert_html(socket, "div", :beforebegin, "&lt;b&gt;bolded&lt;/b&gt;")
</code></pre>
<p>updates the DOM without escaping the html. Of course there is an easy way to avoid this:</p>
<pre><code>import Phoenix.HTML
insert_html(socket, "div", :beforebegin, ~E/"&lt;b&gt;MORE&lt;/b&gt;"/)
</code></pre>
<p>but in my opinion <strong>it is not consistent with Phoenix</strong>, which uses safe htmls by default, enforcing developer to mark them as <code>raw</code> in case.</p>
<h4><a name="p-50898-shall-i-change-drab-to-render-safe-by-default-2" class="anchor" href="#p-50898-shall-i-change-drab-to-render-safe-by-default-2" aria-label="Heading link" rel="nofollow"></a>Shall I change Drab to render SAFE by default?</h4>
<p>This must be changed in <strong>all</strong> <code>innerHTTML</code> updating functions. This will require to update all the existing applications.</p>
<p>But since Drab is the only beta 0.5 version, such change could be done without a big pain (sorry!).</p>
<p>Drab’s philosophy is to be as much compatible with Phoenix as it is possible. This is why I am quite convinced to make an effort to do it.</p>
<p>Please comment it out.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50898" data-batch-url="/posts/batch_likers">
                        7
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/216">Post #215</a>
	                </div>
	            </div>
              <div id="likers-container-50898" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50898"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #215"></div>
  </section>
</div>
    <div class="postbit" id="50925" data-post-id="50925">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m definitely for assuming that input is not safe by default.  Especially with functions like <code>poke/2</code> it will be common to interpolate in user or database strings.  We can always wrap our own strings with <code>~E/.../</code> or whatever to send html instead of text.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50925" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/217">Post #216</a>
	                </div>
	            </div>
              <div id="likers-container-50925" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50925"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #216"></div>
  </section>
</div>
    <div class="postbit" id="50929" data-post-id="50929">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tmbb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tmbb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I understand this isn’t a VDOM yet. I used to think that VDOMs were mysterious beasts, with lots of quircks and hard-to-do optimizations. However, while doing some research to write a possible Drab competitor (not even out of the drawing board lol) I came upon this JS library: <a href="https://github.com/snabbdom/snabbdom" class="inline-onebox" rel="noopener nofollow ugc">GitHub - snabbdom/snabbdom: A virtual DOM library with focus on simplicity, modularity, powerful features and performance. · GitHub</a>. It claims to implement a VDOM in javascript in 200 lines of code, plus some utilities. I haven’t looked at the source yet, but you might be interested, if you’re ever going to have a VDOM on the server.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50929" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/218">Post #217</a>
	                </div>
	            </div>
              <div id="likers-container-50929" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50929"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #217"></div>
  </section>
</div>
    <div class="postbit" id="50978" data-post-id="50978">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vic" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vic/120/11426_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vic
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Asdf Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I was experimenting with a tiny VDOM <a href="https://github.com/vic/bard/blob/master/lib/bard/render_dsl.ex" rel="noopener nofollow ugc">dsl</a> on my recent <a href="https://github.com/vic/bard/blob/master/example/BardBackend/lib/universal_components.ex" rel="noopener nofollow ugc">bard experiment</a>. It is not intended to be a Darb competitor per se, but just another approach at commanding a front-end application from Elixir. In my case my primary interest was to create react-native applications with it (which can’t rely on Darb live magic).</p>
<p>I havent had much free time to continue my experiment, but so far this is what I’ve come up regarding bard’s design:</p>
<ol>
<li>Bard is a tiny library which let’s you define Elixir <em>components</em> (render functions that take a props map and return a vdom ast) and pushes them as needed via a websocket to the client.</li>
<li>The <a href="https://github.com/vic/bard/blob/master/priv/bard.js" rel="noopener nofollow ugc">Bard.js</a> client is very tiny, it basically just creates react components from what the server sends. It currently relies on <a href="https://github.com/staltz/xstream" rel="noopener nofollow ugc">xstream</a> as Bard’s <em>pokable</em> bits are just streams of values and <a href="https://github.com/acdlite/recompose" rel="noopener nofollow ugc">recompose</a> for turning such streams into renderable components.</li>
<li>A <a href="https://github.com/vic/bard/blob/master/example/BardWeb/app/index.js" rel="noopener nofollow ugc">Bard application</a> can define “namespaced” components so for example, you can define a <em>universal</em> “Button” implemented in Elixir, but that is actually rendered with eg native-base’s Button or react-semantic’s Button. So in theory you would be able to reuse your elixir components on both platforms.</li>
</ol>
<p>I’ll try to update or create an split thread when a bard POC is available for you to play. Also I guess I’ll do a bit of refactor on the code I currently have.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50978" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/219">Post #218</a>
	                </div>
	            </div>
              <div id="likers-container-50978" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50978"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #218"></div>
  </section>
</div>
    <div class="postbit" id="51004" data-post-id="51004">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/vic" rel="nofollow">@vic</a>, this is a nice one.<br>
I have it on my mind that I need to make components like this in Drab. Somehow, some day <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>In Drab, for now, there is no need to create any vdom.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="51004" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/220">Post #219</a>
	                </div>
	            </div>
              <div id="likers-container-51004" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51004"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #219"></div>
  </section>
</div>
    <div class="postbit" id="51007" data-post-id="51007">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="217" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>We can always wrap our own strings with ~E/…/ or whatever to send html instead of text.</p>
</blockquote>
</aside>
<p>Agreed, we can, using <code>sigil_E</code> is not a big deal. But using <code>raw</code> is not a big deal as well <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>Drab <strong>targets not only experienced users</strong>. Imagine you just learned phoenix, made your application with <code>&lt;input&gt;</code>, and whatever user typed into it, is shown properly escaped. Great! You don’t have to deal with escaping, making your application safer.<br>
Then you are trying Drab. Create an <code>&lt;input&gt;</code> and <code>poke</code> (or <code>insert_html</code>) its value. What do you expect? For me, <strong>more natural for beginners would be escaping it by default</strong>, just like Phoenix does.</p>
<p>If you need to manually escape every string you push to the browser, you may just simply forgot to do it. <strong>I made such mistake in the Drab’s demo page!</strong> - remember, you’ve found it, thanks a lot again <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>Safe-by-default should be implemented only on the functions, which deal with node’s <code>innerHTML</code>, like <code>Element.insert_html</code>, <code>Query.insert(:html)</code> and <code>poke</code> (but only when updating the html, not attribute or property). Low level functions, like <code>exec_js</code> should stay unescaped, obviously.</p>
<p>Looks like this answer convinced myself to safe-by-default idea <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="51007" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/221">Post #220</a>
	                </div>
	            </div>
              <div id="likers-container-51007" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51007"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #220"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/3277/load_more?page=23">Load more posts (268 remaining)</a>
</div></template></turbo-stream>