<?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: Jesse</title>
    <description>The latest articles on DEV Community by Jesse (@jsm91).</description>
    <link>https://dev.to/jsm91</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%2F33327%2Fa5587ca7-2e09-4ed4-83dc-2616a0c9512a.jpg</url>
      <title>DEV Community: Jesse</title>
      <link>https://dev.to/jsm91</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jsm91"/>
    <language>en</language>
    <item>
      <title>CSS filter generator to convert from black to target hex color</title>
      <dc:creator>Jesse</dc:creator>
      <pubDate>Fri, 01 Nov 2019 04:44:31 +0000</pubDate>
      <link>https://dev.to/jsm91/css-filter-generator-to-convert-from-black-to-target-hex-color-188h</link>
      <guid>https://dev.to/jsm91/css-filter-generator-to-convert-from-black-to-target-hex-color-188h</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/jsm91/embed/ZEEawyZ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>css</category>
      <category>filter</category>
    </item>
    <item>
      <title>Event Propagation in Three Parts!</title>
      <dc:creator>Jesse</dc:creator>
      <pubDate>Thu, 31 Oct 2019 01:07:01 +0000</pubDate>
      <link>https://dev.to/jsm91/event-propagation-in-three-parts-4h9</link>
      <guid>https://dev.to/jsm91/event-propagation-in-three-parts-4h9</guid>
      <description>&lt;h2&gt;
  
  
  Part 1: Event Bubbling:
&lt;/h2&gt;

&lt;p&gt;So when it comes to understanding how the EventListener object works in conjunction with event propagation, there are three basics that need to be considered: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Event Bubbling&lt;/li&gt;
&lt;li&gt;Event Capture &lt;/li&gt;
&lt;li&gt;Once 
… 🤯&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Event propagation can be a little tricky, especially if you haven’t solidified the terminology, or if you’re still struggling with understanding the DOM, or maybe just because event propagation sounds scary and is a little tricky in general.  Either way, we got this! Fears aside, I’m going to break event propagation down very simplistically, just like I learned 💯. &lt;/p&gt;

&lt;p&gt;So,&lt;/p&gt;

&lt;p&gt;1.Let’s say you have this html:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"one"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"two"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"three"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Then you add this javascript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;divs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;logText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;divs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logText&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.And you decide to click the innermost div element (&lt;em&gt;the one that’s most nested&lt;/em&gt;). &lt;/p&gt;




&lt;h5&gt;
  
  
  Query:
&lt;/h5&gt;

&lt;p&gt;What class lists do you think will be logged to the console?&lt;br&gt;
(Inserts Jeopardy music .. and slowly brings up the volume 🎶)&lt;/p&gt;

&lt;h5&gt;
  
  
  Solution:
&lt;/h5&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%2Fmonosnap.com%2Fimage%2F9e07TohHo73dH1MBw6enhzBB8P6jk8" 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%2Fmonosnap.com%2Fimage%2F9e07TohHo73dH1MBw6enhzBB8P6jk8" alt="Alt text" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Wait.. three, two, one? ... Nope, hold up… 🛑 ✋🏼! What sorcery is this?  &lt;/p&gt;
&lt;h2&gt;
  
  
  No sorcery I promise (still waiting on my Hogwarts letter🙏), this is simply an example of event bubbling. 
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Event Bubbling In a Nutshell:
&lt;/h5&gt;

&lt;p&gt;1.The target element is located on the DOM.&lt;br&gt;
2.The DOM has elements that are ‘listening’ for a trigger - something to shout "HEY I DID SOMETHING!".&lt;br&gt;
3.Your trigger is ‘heard’ by an &lt;strong&gt;eventListener&lt;/strong&gt; / &lt;strong&gt;eventHandler&lt;/strong&gt; - ‘WHAT CHU SAY????” &lt;br&gt;
4.Your listener/handler will perform the logic that’s either prescript or coded by you :D! &lt;/p&gt;

&lt;p&gt;… But wait… what if your trigger is never heard… Oh no!&lt;/p&gt;

&lt;h5&gt;
  
  
  Now ask yourself:
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;“If an event fires in the middle of the DOM and no listener is around to handle it, does it actually execute at all?”  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Answer: YUS!
&lt;/h5&gt;

&lt;p&gt;I couldn’t end the above question as eloquently as preferred,  however, the answer is still yes; the trigger still fires and will &lt;strong&gt;propagate&lt;/strong&gt; up - &lt;em&gt;bubble upwards just like an actual bubble&lt;/em&gt; - until it is either handled or reaches the topmost layer of the DOM (&lt;em&gt;your window&lt;/em&gt;)!  &lt;/p&gt;

&lt;p&gt;So, in the above example, you clicked the innermost div element, it was located within the DOM, the click event was fired and the logText() function was executed. However, because of &lt;strong&gt;event bubbling&lt;/strong&gt; the click event continued to propagate upwards until it reaches the upper most parent element. &lt;/p&gt;




&lt;h4&gt;
  
  
  Want to see it yourself?
&lt;/h4&gt;

&lt;p&gt;1.Add this line to your javascript: &lt;code&gt;document.body.addEventListener(‘click’, logText);&lt;/code&gt;&lt;br&gt;
2.&lt;strong&gt;Refresh&lt;/strong&gt; your page&lt;br&gt;
3.Click a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element&lt;br&gt;
4.Check out your &lt;strong&gt;browser’s javascript console&lt;/strong&gt;  👀👀👀👀, which should look something like this: &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%2F7uthielg05zc49qehj8o.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%2F7uthielg05zc49qehj8o.png" alt="Visual" width="605" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  P.S: To Open Your Browser’s JS Console:
&lt;/h6&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- **Chrome**: Go to **View &amp;gt; Developer &amp;gt; JavaScript Console**
- **Safari**: Go to **Develop &amp;gt; Show JavaScript Console**
    - NOTE:You must have developer tools enabled via **Safari &amp;gt; Preferences &amp;gt; Advanced &amp;gt; Select the last checkbox at the bottom).**
- **Firefox**: Don’t use it much… not a hater, just like chrome dev tools. Although Firefox’s css grid tool is pretty schweet 😍. But for now, just do a quick google search. 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h5&gt;
  
  
  Quick Visual to Help (&lt;em&gt;hopefully&lt;/em&gt;) Picture the Process:
&lt;/h5&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%2Fmonosnap.com%2Fimage%2FbQj7qZgPSJjViz23VtIkEvCRGNlZ79" 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%2Fmonosnap.com%2Fimage%2FbQj7qZgPSJjViz23VtIkEvCRGNlZ79" alt="Alt text" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Note that the capture phase is mentioned here, which is very, very, verrrrry similar to the bubble phase, but with one major difference:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Yep, you probably guessed it already (look at you go O_O!!, I’m so proud &amp;lt;3).
&lt;/li&gt;
&lt;li&gt;The direction is now REVERSED,  so instead of bottom-to-top event bubbling (propagation), you now have top-to-bottom event capture.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;



&lt;blockquote&gt;
&lt;p&gt;p.s&lt;br&gt;
If your guess wasn’t that the direction is &lt;strong&gt;reversed&lt;/strong&gt;, then no worries! This stuff can get a bit confusing and I probably could have described it a little (or a lot) better.  Stop sweating the small stuff, because you still made me proud for making it this far :)!  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- More on this later :).. However, take some time to digest what you’ve learned so far.  But, before you go, I challenge you Try to think of some examples of both event propagation and event capture. 
- Again, don’t sweat the small stuff,~ if you can’t think of any examples right now, then take some time and come back, perhaps do a little searching, or try imagining something that, although might not be code related, could still fit the schematic/process described above :)!
- **HAVE FUN WITH IT!**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>event</category>
      <category>propagation</category>
      <category>capture</category>
    </item>
    <item>
      <title>TIL a bit of KONAMI</title>
      <dc:creator>Jesse</dc:creator>
      <pubDate>Thu, 07 Dec 2017 06:25:00 +0000</pubDate>
      <link>https://dev.to/jsm91/til-a-bit-of-konami-b1i</link>
      <guid>https://dev.to/jsm91/til-a-bit-of-konami-b1i</guid>
      <description>&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Today I learned that there is a term called 'konami' and what it means in terms of web development. In simplistic terms, remember when you use to type a secret code on your gaming console or keypad (up, down, up, down, left, right, left)? Well, picture the same concept, except while on a webpage! Simplistically, that's kind of what konami is! However, in our case, it's us that get to decide what these little easter eggs can do. &lt;/p&gt;

&lt;p&gt;Want to know a popular website that has a konami code implemented in its source code? Take a guess ..... BUZZFEED! Don't believe me, well give it a try.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://www.buzzfeed.com"&gt;Buzzfeed&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Let the page load and then type the following code on your keyboard:
&lt;code&gt;up, up, down, down, left, right, left, right, b, a, enter&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Be amazed!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Since first learning the concept,  Buzzfeed’s konami has changed. At one point, their konami would run a function that replaced all words on the page with &lt;strong&gt;"Wilkie!"&lt;/strong&gt; (no clue as to who Wilkie is or why Wilkie was given the honor), but today a sparkle/confetti effect was looped in the background. &lt;/p&gt;

&lt;p&gt;Anyways, that's what I learned today and I'm interested to hear what effects you guys can find and/or what functions your konami codes produce. Let me know what you think or if you find some that you would like to share :).&lt;/p&gt;

&lt;h2&gt;
  
  
  And why exactly is this interesting?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;It's something I would not have guessed developers would still implement. &lt;/li&gt;
&lt;li&gt;It's clever and playful, which is always nice.&lt;/li&gt;
&lt;li&gt;The code was a little bit more challenging than you'd initially think.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://jessemayo.me/30days/konami/index.html"&gt;My Example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
