<?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: Sean McPherson</title>
    <description>The latest articles on DEV Community by Sean McPherson (@seanmcp).</description>
    <link>https://dev.to/seanmcp</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%2F106748%2Fd625b61b-e492-4740-9285-af215dcf66f8.jpg</url>
      <title>DEV Community: Sean McPherson</title>
      <link>https://dev.to/seanmcp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/seanmcp"/>
    <language>en</language>
    <item>
      <title>What's a better way to start a conference talk than "Uh... okay, so I guess it's time to get started?"</title>
      <dc:creator>Sean McPherson</dc:creator>
      <pubDate>Sat, 12 Oct 2019 01:47:16 +0000</pubDate>
      <link>https://dev.to/seanmcp/what-s-a-better-way-to-start-a-conference-talk-than-uh-okay-so-i-guess-it-s-time-to-get-started-1044</link>
      <guid>https://dev.to/seanmcp/what-s-a-better-way-to-start-a-conference-talk-than-uh-okay-so-i-guess-it-s-time-to-get-started-1044</guid>
      <description>&lt;p&gt;I'm giving my first conference talk at &lt;a href="http://connect.tech/"&gt;CONNECT.TECH 2019&lt;/a&gt; in Atlanta, GA next week, and I am excited!&lt;/p&gt;

&lt;p&gt;Over the past few months, I've spent a lot of time studying the subject, fine tuning my slides, and working through the talk itself. But there is one thing that is hanging me up: the kick-off.&lt;/p&gt;

&lt;p&gt;I have seen a bunch of talks at different conferences, and it seems like the default "start" is a diffusing question or statement like: "Alright, so I guess I'll begin."&lt;/p&gt;

&lt;p&gt;There has got to be a better way!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are some of the great talk kick-offs that you've heard? What do you like and what do you dislike? How would you start your tech talk?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Access head, body without document queries</title>
      <dc:creator>Sean McPherson</dc:creator>
      <pubDate>Fri, 10 May 2019 11:07:05 +0000</pubDate>
      <link>https://dev.to/seanmcp/access-head-body-without-document-queries-1bfl</link>
      <guid>https://dev.to/seanmcp/access-head-body-without-document-queries-1bfl</guid>
      <description>&lt;p&gt;When I needed to add an element to the &lt;code&gt;head&lt;/code&gt; or &lt;code&gt;body&lt;/code&gt; of a document, I used to reach for &lt;code&gt;document.querySelector()&lt;/code&gt;, the Swiss-Army knife of &lt;code&gt;document&lt;/code&gt; methods:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;headNode&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;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;head&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bodyNode&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;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;body&lt;/span&gt;&lt;span class="dl"&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="s2"&gt;`I'm the head:`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;headNode&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="s2"&gt;`I'm the body:`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;bodyNode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works and is a familiar pattern for finding DOM elements.&lt;/p&gt;

&lt;p&gt;Today I learned about &lt;code&gt;document.head&lt;/code&gt; and &lt;code&gt;document.body&lt;/code&gt;, which provide query-free references to the &lt;code&gt;head&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt; elements of the document, respectively!&lt;/p&gt;

&lt;p&gt;Which these handy references, we can replace the previous code block with:&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="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="s2"&gt;`I'm the head:`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&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="s2"&gt;`I'm the body:`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No more creating variables to reference &lt;code&gt;body&lt;/code&gt; and &lt;code&gt;head&lt;/code&gt;; they're always available on the &lt;code&gt;document&lt;/code&gt; object.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;document.head&lt;/code&gt; and &lt;code&gt;document.body&lt;/code&gt; are available in all browsers after IE8: &lt;a href="https://caniuse.com/#feat=documenthead"&gt;checkout the availability chart on CanIUse.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>html</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
