<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>justmarkup</title>
	<atom:link href="https://justmarkup.com/log/feed/" rel="self" type="application/rss+xml" />
	<link>https://justmarkup.com/log</link>
	<description></description>
	<lastBuildDate>2025-01-31T10:12:08+01:00</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.10</generator>
		
			
				
							
						
						
						<item>
							<title> Thirteen years</title>
							<link>https://justmarkup.com/notes/2025-01-31-thirteen-years/</link>
							<pubDate>2025-01-31T10:12:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2025-01-31-thirteen-years/</guid>
							<description>&lt;p&gt;Thirteen years ago I published my first article on this site, and it&#39;s still alive (is it?).&lt;/p&gt;
&lt;h2 id=&quot;this-site&quot;&gt;This site &lt;a class=&quot;permalink&quot; href=&quot;#this-site&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I&#39;ve only posted once in the past year, and that&#39;s perfectly fine. I could list all the reasons for my irregular posting schedule, but honestly, it boils down to time and motivation. The best part is that I still have this space online to publish whatever I want, whenever I want.&lt;/p&gt;
&lt;h2 id=&quot;social&quot;&gt;Social &lt;a class=&quot;permalink&quot; href=&quot;#social&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I&#39;m not very active on social media these days. I occasionally check Mastodon and LinkedIn, but that&#39;s about it. I rely on RSS to stay informed—it just works.&lt;/p&gt;
&lt;p&gt;Since the end of last year, my family and I have had a small garden with a dacha (a &amp;quot;Schrebergarten&amp;quot;). I&#39;m currently renovating it, and I&#39;m really enjoying the hands-on work. I&#39;m also looking forward to growing vegetables and simply spending time in the garden.&lt;/p&gt;
&lt;p&gt;That&#39;s my yearly update. Stay safe, and keep being awesome!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Not sharing GIFs</title>
							<link>https://justmarkup.com/notes/2025-01-13-not-sharing-gifs/</link>
							<pubDate>2025-01-13T18:12:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2025-01-13-not-sharing-gifs/</guid>
							<description>&lt;p&gt;This morning I shared an article about &lt;a href=&quot;https://ishadeed.com/article/balancing-text-css/&quot;&gt;Balancing text in CSS&lt;/a&gt; (it&#39;s a great article, read it) on LinkedIn. To give a quick preview I decided to create a simple GIF of the first interactive example in the article. The GIF showed more or less how I clicked a button, which, after I clicked it, applied the CSS text-wrap: balance; to the text, and the text visually looked more balanced after that. I added an alternative text to it, as well as some more text, and shared it. All good I thought, the post is accessible for all.&lt;/p&gt;
&lt;p&gt;Was I wrong! Shortly after that, I read a post, which reminded everyone &lt;a href=&quot;https://www.linkedin.com/posts/marcusherrmann_linkedin-sollte-es-einem-erm%C3%B6glichen-neben-activity-7284499373361664000-Pfh-&quot;&gt;how problematic it is to share GIFs on LinkedIn&lt;/a&gt; in terms of accessibility. It fails &lt;a href=&quot;https://www.w3.org/WAI/WCAG21/Understanding/three-flashes-or-below-threshold.html&quot;&gt;Web Content Accessibility Guidelines (WCAG) success criterion 2.3.1&lt;/a&gt; and &lt;a href=&quot;https://www.w3.org/WAI/WCAG21/Understanding/pause-stop-hide.html&quot;&gt;WCAG success criterion 2.2.2&lt;/a&gt;. The issues are that you can&#39;t stop, pause or hide the GIF on LinkedIn, and as it starts automatically (which you can&#39;t disable in settings, like you can on Mastodon) there is flash of content.&lt;/p&gt;
&lt;p&gt;I quickly converted the GIF to a MP4 video file and tried to edit my article. But, after I tried to upload the video on LinkedIn, it didn&#39;t work. The issue? It was too small with only 31Kb, the minimum there is 75 Kb. Great, so I just removed the GIF and didn&#39;t replace it with anything.&lt;/p&gt;
&lt;p&gt;LinkedIn has various options to make this better for everyone. They could add settings where you could disable autoplaying GIFs. They could automatically convert GIFs to a video, which would even improve performance, as videos are way smaller than GIFs. Don&#39;t know why they didn&#39;t change anything yet, but let&#39;s hope they will.&lt;/p&gt;
&lt;p&gt;For now please don&#39;t use GIFs on LinkedIn, and the same is most probably true for many other social networks, where GIFs are always automatically played.&lt;/p&gt;
&lt;p&gt;I planned to share some stuff on LinkedIn starting this year, so far it doesn&#39;t work out so great, but you can still &lt;a href=&quot;https://www.linkedin.com/in/justmarkup/&quot;&gt;connect&lt;/a&gt; with me there if you want.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Twelve years</title>
							<link>https://justmarkup.com/notes/2024-01-31-twelve-years/</link>
							<pubDate>2024-01-31T10:12:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2024-01-31-twelve-years/</guid>
							<description>&lt;p&gt;Twelve years ago I published my first article on this site, and it&#39;s still alive (is it?).&lt;/p&gt;
&lt;h2 id=&quot;writing&quot;&gt;Writing &lt;a class=&quot;permalink&quot; href=&quot;#writing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I haven&#39;t published anything in the last year. Last year I thought I will come back to writing again, but it didn&#39;t happen. Maybe I will get back to writing again here, but I just don&#39;t know.&lt;/p&gt;
&lt;h2 id=&quot;social&quot;&gt;Social &lt;a class=&quot;permalink&quot; href=&quot;#social&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I&#39;m also not really active anymore on social media. I do browse through my Mastodon timeline from time to time, but don&#39;t post much there.&lt;/p&gt;
&lt;p&gt;So, what am I doing all day? Glad you asked. I leased a small piece of land last year to grow vegetables, which was a fantastic experience. This year I started to draw more and more, every day after dinner my daughter and me sit together to draw something. It&#39;s interesting how much better you can get by doing something ten minutes a day.&lt;/p&gt;
&lt;p&gt;Besides that I enjoy my time with my family and friends.&lt;/p&gt;
&lt;p&gt;That&#39;s it with my yearly update, stay safe, and keep on being awesome.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Eleven years</title>
							<link>https://justmarkup.com/notes/2023-01-31-eleven-years/</link>
							<pubDate>2023-01-31T10:12:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2023-01-31-eleven-years/</guid>
							<description>&lt;p&gt;Eleven years ago I published my first article on this site, and it&#39;s still alive.&lt;/p&gt;
&lt;h2 id=&quot;writing&quot;&gt;Writing &lt;a class=&quot;permalink&quot; href=&quot;#writing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I haven&#39;t really published anything in the last year, only five thoughts (notes), but no technical article at all. After spending a lot of time in 2021 working on the &lt;a href=&quot;https://web.dev/learn/forms/&quot;&gt;Learn Forms course&lt;/a&gt; I needed a break from writing, and somehow never managed to get back to writing again.&lt;/p&gt;
&lt;p&gt;I hope to get back to writing, but as &lt;a href=&quot;https://mxb.dev/blog/seven-reasons-why-i-dont-write/&quot;&gt;Max Böck&lt;/a&gt; I have reasons why I don&#39;t write, mostly time.&lt;/p&gt;
&lt;p&gt;Miss writing more and more, so 2023 may be the year I write regularly again.&lt;/p&gt;
&lt;h2 id=&quot;social&quot;&gt;Social &lt;a class=&quot;permalink&quot; href=&quot;#social&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Like many others I abandoned Twitter last year and use only &lt;a href=&quot;https://mastodon.social/@justmarkup&quot;&gt;Mastodon&lt;/a&gt; now. This time I didn&#39;t want to have the content only there, but also on my site, so created a simple form, which sends my thoughts to a Node.js server, which then kicks off an Eleventy build publishing the content on &lt;a href=&quot;https://bits.justmarkup.com/&quot;&gt;bits.justmarkup.com&lt;/a&gt;. In the form I also have a checkbox to sync to Masto, so If I check this, the thought will also be posted on my Mastodon profile.&lt;/p&gt;
&lt;p&gt;It&#39;s really minimal, but works fine for me for the moment. Plan to improve the setup though.&lt;/p&gt;
&lt;p&gt;Early this year I also decided to only use Social Media only while I work, so I forced myself to have no access to Mastodon on my phone, and can only check it on my laptop.&lt;/p&gt;
&lt;p&gt;That&#39;s it with my yearly update, stay safe, and keep on being awesome.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Book – Engineering Management for the Rest of Us</title>
							<link>https://justmarkup.com/notes/2022-12-06-engineering-management-for-the-rest-of-us/</link>
							<pubDate>2022-12-06T14:12:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2022-12-06-engineering-management-for-the-rest-of-us/</guid>
							<description>&lt;p&gt;Rating: 4,5/5&lt;br&gt;
Would recommend: yes&lt;br&gt;
Would read again: yes&lt;/p&gt;
&lt;h2 id=&quot;review-and-takeaway&quot;&gt;Review and takeaway &lt;a class=&quot;permalink&quot; href=&quot;#review-and-takeaway&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;After reading this book, I reminded myself to be more open, be more human. I was often acting like a machine in the last month, doing good work, but missing the human part, the important part of working.&lt;/p&gt;
&lt;p&gt;It also reminded me to say No more often, to trust others.&lt;/p&gt;
&lt;p&gt;It&#39;s also a good reminder how important communication is, to build trust, to document.&lt;/p&gt;
&lt;p&gt;I can recommend this book for everyone thinking about changing to management, but also for everybody else working as a developer or with developers, or really anyone working in a team.&lt;/p&gt;
&lt;h2 id=&quot;summary-and-remarks&quot;&gt;Summary and remarks &lt;a class=&quot;permalink&quot; href=&quot;#summary-and-remarks&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;values-%E2%80%93-individual%2C-company%2C-and-team-values.&quot;&gt;Values – individual, company, and team values. &lt;a class=&quot;permalink&quot; href=&quot;#values-%E2%80%93-individual%2C-company%2C-and-team-values.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Clarity is key&lt;/li&gt;
&lt;li&gt;Understand each other&lt;/li&gt;
&lt;li&gt;Set boundaries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: As a freelancer, I have worked with lots of companies. Companies communicating their values, and practicing them, are a joy to work with.&lt;/p&gt;
&lt;h3 id=&quot;trust-and-vulnerability.&quot;&gt;Trust and vulnerability. &lt;a class=&quot;permalink&quot; href=&quot;#trust-and-vulnerability.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Trust takes time&lt;/li&gt;
&lt;li&gt;Trust is crucial.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: If I can&#39;t trust my team colleagues, it makes working with them very hard.&lt;/p&gt;
&lt;h3 id=&quot;your-team-is-not-them%2C-your-team-is-we.&quot;&gt;Your team is not them, your team is we. &lt;a class=&quot;permalink&quot; href=&quot;#your-team-is-not-them%2C-your-team-is-we.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Boost morale&lt;/li&gt;
&lt;li&gt;Explain reason behind decisions&lt;/li&gt;
&lt;li&gt;Clarify mistakes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: It&#39;s really important to communicate with the team, and be transparent.&lt;/p&gt;
&lt;h3 id=&quot;happiness-and-drive&quot;&gt;Happiness and drive &lt;a class=&quot;permalink&quot; href=&quot;#happiness-and-drive&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Create space where people feel like they&#39;re getting their best work done&lt;/li&gt;
&lt;li&gt;Provide an environment where flow state can happen&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Everyone works different. If the team provides me the option to work the way I prefer, I will do my best work.&lt;/p&gt;
&lt;h3 id=&quot;long-term-care-of-employees&quot;&gt;Long-term care of employees &lt;a class=&quot;permalink&quot; href=&quot;#long-term-care-of-employees&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Set your team up for success&lt;/li&gt;
&lt;li&gt;Understand how to delegate&lt;/li&gt;
&lt;li&gt;Trust is inclusion&lt;/li&gt;
&lt;li&gt;We all have bias&lt;/li&gt;
&lt;li&gt;Talk about employee goals&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Having managers who care is fundamental. I worked with fantastic managers, again, the best communicate very well, build trust, and understand the needs of employees.&lt;/p&gt;
&lt;h3 id=&quot;career-laddering&quot;&gt;Career laddering &lt;a class=&quot;permalink&quot; href=&quot;#career-laddering&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Senior: best you&lt;/li&gt;
&lt;li&gt;Staff: beyond yourself, teach people&lt;/li&gt;
&lt;li&gt;Principal: help people where they are&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: The further you are into your career, the more it&#39;s about helping other people. Care about people in every stage of your career.&lt;/p&gt;
&lt;h3 id=&quot;1%3A1s-are-critical&quot;&gt;1:1s are critical &lt;a class=&quot;permalink&quot; href=&quot;#1%3A1s-are-critical&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Provide clarity&lt;/li&gt;
&lt;li&gt;Place to talk freely&lt;/li&gt;
&lt;li&gt;Come prepared to 1:1s&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: In the past, I considered 1:1s as not important. I was wrong there. Once I took the 1:1s seriously, they made a lot of sense, and I look forward to having them.&lt;/p&gt;
&lt;h3 id=&quot;communicating-as-a-manager&quot;&gt;Communicating as a manager &lt;a class=&quot;permalink&quot; href=&quot;#communicating-as-a-manager&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Teach people to fish&lt;/li&gt;
&lt;li&gt;Address the goals, mission&lt;/li&gt;
&lt;li&gt;Format things clearly&lt;/li&gt;
&lt;li&gt;All about transparency&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: I have worked with many companies who have no clear mission, this is unsatisfying in the long-term. If you don&#39;t know why you do something, it makes no sense.&lt;/p&gt;
&lt;h3 id=&quot;change-management&quot;&gt;Change management &lt;a class=&quot;permalink&quot; href=&quot;#change-management&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;More to lose by staying still&lt;/li&gt;
&lt;li&gt;Connect people to the why&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Again, it&#39;s all about communicating.&lt;/p&gt;
&lt;h3 id=&quot;giving-and-receiving-feedback&quot;&gt;Giving and receiving feedback &lt;a class=&quot;permalink&quot; href=&quot;#giving-and-receiving-feedback&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Ask about feedback preference&lt;/li&gt;
&lt;li&gt;Give guidance for the future&lt;/li&gt;
&lt;li&gt;It&#39;s necessary, thoughtful, helps them improve at work&lt;/li&gt;
&lt;li&gt;Praise in public, feedback in private&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: I personally started to request feedback, and it really helps me to see where I could do better, what I do well.&lt;/p&gt;
&lt;h3 id=&quot;prioritizing-your-teams-work&quot;&gt;Prioritizing your teams work &lt;a class=&quot;permalink&quot; href=&quot;#prioritizing-your-teams-work&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;know / communicate what&#39;s most important&lt;/li&gt;
&lt;li&gt;have focus&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Objectives and key results (OKR)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;70% rule (fine to establish 70%)&lt;/li&gt;
&lt;li&gt;Look forward and look back&lt;/li&gt;
&lt;li&gt;Quarterly planning&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Take them seriously, but not too seriously. OKRs should be in line with the overall mission.&lt;/p&gt;
&lt;h3 id=&quot;scope-down-prs&quot;&gt;Scope down PRs &lt;a class=&quot;permalink&quot; href=&quot;#scope-down-prs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Easier to review&lt;/li&gt;
&lt;li&gt;Easier to test&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Feature flags, as mentioned in the book, really helps to achieve this. With feature flags, you can do changes / features step by step without risking anything.&lt;/p&gt;
&lt;h3 id=&quot;speed-of-execution&quot;&gt;Speed of execution &lt;a class=&quot;permalink&quot; href=&quot;#speed-of-execution&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Set direction first&lt;/li&gt;
&lt;li&gt;Assess motivation&lt;/li&gt;
&lt;li&gt;Assess psychological safety&lt;/li&gt;
&lt;li&gt;Assess tech stack&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: What I learned after many years, preparation is key. Be open to changes, don&#39;t fixate on a tech stack, think about users first.&lt;/p&gt;
&lt;h3 id=&quot;split-time-between-product-and-engineering-work&quot;&gt;Split time between product and engineering work &lt;a class=&quot;permalink&quot; href=&quot;#split-time-between-product-and-engineering-work&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Technical debt&lt;/li&gt;
&lt;li&gt;Innovative projects&lt;/li&gt;
&lt;li&gt;Slow, ongoing work (internal documentation, ...)&lt;/li&gt;
&lt;li&gt;Migrations (As much research as possible, Clear decision makers, Document, high and low level, Maintenance and ownership)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Having a lot of technical debts can be frustrating. When doing migrations / refactoring, spend a lot of time with research, documentation to avoid more technical debts.&lt;/p&gt;
&lt;h3 id=&quot;prioritizing&quot;&gt;Prioritizing &lt;a class=&quot;permalink&quot; href=&quot;#prioritizing&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Schedule breaks and focus time&lt;/li&gt;
&lt;li&gt;Create systems&lt;/li&gt;
&lt;li&gt;Add accomplished stuff in the to-do list&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: For me, it is often hard to prioritize. What helps me is having some tasks I know I can finish in a short amount of time on my daily to-do, along with the more time-consuming tasks. Finishing the less time-consuming tasks shows me I did something.&lt;/p&gt;
&lt;h3 id=&quot;boundaries&quot;&gt;Boundaries &lt;a class=&quot;permalink&quot; href=&quot;#boundaries&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Say no more often&lt;/li&gt;
&lt;li&gt;Too many meetings&lt;/li&gt;
&lt;li&gt;Forgive myself&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remark: Saying no is really hard for me, I want to help. But, I need to get better at saying no, as often it&#39;s better someone else takes over or something is not done. I am also very strict with myself, I need to accept that I am not perfect (like anybody else) and it&#39;s okay to make mistakes.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Lazy loading HTML includes</title>
							<link>https://justmarkup.com/notes/2022-08-31-lazy-loading-html/</link>
							<pubDate>2022-08-31T13:12:08+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2022-08-31-lazy-loading-html/</guid>
							<description>&lt;p&gt;Browser supports :has() and container queries. So, why shouldn&#39;t they be able to support lazy loading HTML?&lt;/p&gt;
&lt;h2 id=&quot;html-includes&quot;&gt;HTML includes &lt;a class=&quot;permalink&quot; href=&quot;#html-includes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In PHP (Hypertext Preprocessor), it&#39;s done like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token prolog&quot;&gt;&amp;lt;?php include &#39;component.php&#39;;?&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In HTML, it may look like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;component.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;include&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;component.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;how-would-this-work%3F&quot;&gt;How would this work? &lt;a class=&quot;permalink&quot; href=&quot;#how-would-this-work%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Instead of preprocessing the final HTML before the browser parses it, as it&#39;s done in PHP, with HTML includes, the browser will include the HTML while parsing it.&lt;/p&gt;
&lt;p&gt;The HTML parser starts parsing, detects an include, makes an HTTP request, parses the HTML and inserts it into the DOM tree. Like streaming the HTML.&lt;/p&gt;
&lt;h2 id=&quot;lazy-loading&quot;&gt;Lazy loading &lt;a class=&quot;permalink&quot; href=&quot;#lazy-loading&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Browser supports the lazy loading attribute, loading=&amp;quot;lazy&amp;quot;. This could be reused for the HTML includes.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;include&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;component.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;lazy&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You have a component at the very bottom of a long page. Lazy load it. The browser only includes the HTML if the user scrolls down far enough.&lt;/p&gt;
&lt;p&gt;This will make this feature even more interesting. We have JavaScript to do the same, you say? Yes, but I could say the same for container queries or :has().&lt;/p&gt;
&lt;h2 id=&quot;make-it-happen&quot;&gt;Make it happen &lt;a class=&quot;permalink&quot; href=&quot;#make-it-happen&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are probably hundreds of issues I haven&#39;t thought of, and many would even say it&#39;s impossible. Okay, but browsers gets better and better, hardware gets better and better. Browser vendors will figure this out.&lt;/p&gt;
&lt;p&gt;One day we will have HTML includes and HTML lazy loading includes. Looking forward to it.&lt;/p&gt;
&lt;p&gt;Of course I am not the only one thinking about HTML includes, see this long &lt;a href=&quot;https://github.com/whatwg/html/issues/2791&quot;&gt;thread&lt;/a&gt; which started in 2017 and people still discuss.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Building a house</title>
							<link>https://justmarkup.com/notes/2022-08-05-building-a-house/</link>
							<pubDate>2022-08-05T09:12:08+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2022-08-05-building-a-house/</guid>
							<description>&lt;p&gt;No, I am not really building a house. This is a story about many houses (websites) are build these days.&lt;/p&gt;
&lt;h2 id=&quot;the-building&quot;&gt;The building &lt;a class=&quot;permalink&quot; href=&quot;#the-building&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You are a group of developers and get the task to build a house. You have done this before multiple times, you check the acceptance criteria and start building; you build the base, walls and the roof. After that, you paint the house like requested.&lt;/p&gt;
&lt;h2 id=&quot;the-issue&quot;&gt;The issue &lt;a class=&quot;permalink&quot; href=&quot;#the-issue&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The house looks gorgeous, all acceptance criteria are fulfilled. You applaud each other and move on to building another house.&lt;/p&gt;
&lt;p&gt;Suddenly, a call from the manager: The customer is not at all happy with the house. There is no door, they can&#39;t get in the house. Is this a bug or a feature, you wonder. According to the acceptance criteria, the house should have no door, so this will be handled as a feature request.&lt;/p&gt;
&lt;p&gt;So, you demolish part of the wall and add a door. The customer likes the new door. You applaud each other and move on to building another house.&lt;/p&gt;
&lt;p&gt;Wait, another call from the customer: They also say they miss windows. The calls, building, applauding continues for some more month. At the end, it cost ten times more, took 8 months longer; nobody is applauding anymore.&lt;/p&gt;
&lt;h2 id=&quot;before-not-after&quot;&gt;Before not after &lt;a class=&quot;permalink&quot; href=&quot;#before-not-after&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This could all have been avoided by planing it right from the beginning.&lt;/p&gt;
&lt;p&gt;It has been said thousands of time; Plan for accessibility and performance before you start building. Sure, you can fix accessibility issues and improve performance after you build, but it will take way longer.&lt;/p&gt;
&lt;p&gt;Think, think some more, start building.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Stop supporting Internet Explorer!</title>
							<link>https://justmarkup.com/notes/2022-07-06-stop-supporting-ie/</link>
							<pubDate>2022-07-06T09:12:08+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2022-07-06-stop-supporting-ie/</guid>
							<description>&lt;p&gt;As of 15th of June 2022 Internet Explorer &lt;a href=&quot;https://blogs.windows.com/windowsexperience/2022/06/15/internet-explorer-11-has-retired-and-is-officially-out-of-support-what-you-need-to-know/&quot;&gt;has retired and is officially out of support&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Great, let&#39;s stop supporting Internet Explorer finally, you say? Sure, I will do the same, but your support may be different from how I approach this. Let&#39;s have a look.&lt;/p&gt;
&lt;h2 id=&quot;ways-to-support-a-browser&quot;&gt;Ways to support a browser &lt;a class=&quot;permalink&quot; href=&quot;#ways-to-support-a-browser&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are two ways to support a browser:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Glossary/Polyfill&quot;&gt;polyfills&lt;/a&gt;/workarounds, so all unsupported features work the &lt;em&gt;same&lt;/em&gt; in unsupported browsers as in supported browsers.&lt;/li&gt;
&lt;li&gt;Use progressive enhancement. Basics work in &lt;em&gt;every&lt;/em&gt; browser, new features (extras) only in supported browsers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;support-internet-explorer&quot;&gt;Support Internet Explorer &lt;a class=&quot;permalink&quot; href=&quot;#support-internet-explorer&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When I say &#39;Stop supporting IE&#39; it means to me that I won&#39;t go the extra mile to get unsupported features working in Internet Explorer, but still make sure Internet Explorer users get the basics, and can use the site.&lt;/p&gt;
&lt;p&gt;For example, in one project, we are using the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API&quot;&gt;Beacon API&lt;/a&gt; for a feature (an extra, not required). At the time (about 3 years ago), we integrated the feature, Internet Explorer was still fully supported, and we had quite some users using IE11. Therefore, we decided that it&#39;s worth to load a &lt;a href=&quot;https://github.com/miguelmota/Navigator.sendBeacon&quot;&gt;polyfill&lt;/a&gt;, so IE11 users will also get this extra. Now, this changed, the numbers of IE users are really low, so we will now remove this polyfill. IE users still get the basic experience, but not this extra feature.&lt;/p&gt;
&lt;p&gt;We could also have kept the polyfill, you say? Sure, but we try to keep our third-party dependencies as low as possible. One fewer means one fewer to check for security issues, updates – one less dependency to care about.&lt;/p&gt;
&lt;p&gt;So, this is how I will support Internet Explorer from now on. You could also think about it this way: Your Internet Explorer user should now get the same experience as your No-JavaScript user – the basics.&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blogs.windows.com/windowsexperience/2022/06/15/internet-explorer-11-has-retired-and-is-officially-out-of-support-what-you-need-to-know/&quot;&gt;Internet Explorer 11 has retired and is officially out of support—what you need to know&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://adrianroselli.com/2022/06/internet-explorer-still-does-not-go-away-today.html&quot;&gt;Internet Explorer Still Does Not Go Away Today&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Ten years 🎉</title>
							<link>https://justmarkup.com/notes/2022-01-31-ten-years/</link>
							<pubDate>2022-01-31T10:12:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2022-01-31-ten-years/</guid>
							<description>&lt;p&gt;Reached the milestone of one decade of publishing. On this day ten years ago, I published my first article on this site.&lt;/p&gt;
&lt;p&gt;Since then, I published over 145 articles and notes.&lt;/p&gt;
&lt;p&gt;From the ~315.569,520 seconds since I published the first article, I wasted quite some time staring at loading screens, and trying to interact with inaccessible websites. Hopefully, though, saved some seconds for others, by helping developers build faster, and more accessible sites by sharing my knowledge here.&lt;/p&gt;
&lt;p&gt;I haven&#39;t published a lot during the previous year, and don&#39;t really know if this will change again. I still enjoy writing and sharing content, but I don&#39;t feel forced anymore to do it.&lt;/p&gt;
&lt;p&gt;Stay safe and on to the next ten years!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Keeping up-to-date with web development</title>
							<link>https://justmarkup.com/notes/2022-01-04-keeping-up-to-date-with-the-web/</link>
							<pubDate>2022-01-04T12:04:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2022-01-04-keeping-up-to-date-with-the-web/</guid>
							<description>&lt;p&gt;Over the last ten years I spend many hours to keep up-to-date with the web platform: Reading articles, writing articles, trying out new web platform features, listening to web development podcasts, using Twitter to stay in the loop, watching conference talks, reading books, reading RSS feeds.&lt;/p&gt;
&lt;p&gt;Out of interest, I asked on Twitter &lt;a href=&quot;https://twitter.com/justmarkup/status/1434085540941475843?s=20&quot;&gt;how much time my followers spend on keeping up-to-date with the web platform&lt;/a&gt;. Most spend 0-5 hours, about a quarter spend 5-10 hours, and 11% spend 10 or more hours.&lt;/p&gt;
&lt;p&gt;About 40% of all respondents spend more than five hours a week of their leisure time. I guess there aren’t many other professions where people spend so much unpaid time to get better at their jobs.&lt;/p&gt;
&lt;p&gt;As a follow-up, I asked the same question, this time &lt;a href=&quot;https://twitter.com/justmarkup/status/1435179706823987202?s=20&quot;&gt;how much time of their paid/work time they spend keeping up-to-date&lt;/a&gt;. 75% spend 0-5 hours, 10% 5-10 hours, 7% 10-20 hours, and 7% spend more than 20 hours a week. It seems some companies enable employees to spend time (some quite a lot) trying out new things, and keeping up-to-date, while most don’t.&lt;/p&gt;
&lt;p&gt;What about me? In average, I spend about 5-10 hours a week doing all this, as a freelancer this all happens in my leisure time, all unpaid. Somewhere in 2021 I reduced this to 1-2 hours, after realizing I am on my way to burn-out, spending so much time of my leisure time on keeping up-to-date.&lt;/p&gt;
&lt;p&gt;On the one hand it’s great that the web platform evolves so quickly nowadays, on the other hand it’s getting really hard to keep up-to-date with all new features. And there is more, new frameworks, new build tools, new coding approaches, new plugins. I had to realize that is’s impossible to try out and learn everything. Nobody is able to keep up-to-date with everything; That’s okay.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Learn forms course on web.dev</title>
							<link>https://justmarkup.com/articles/2021-12-23-learn-forms-web-dev/</link>
							<pubDate>2021-12-23T12:01:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2021-12-23-learn-forms-web-dev/</guid>
							<description>&lt;p&gt;This year I was fortunate enough to write a complete course about HTML forms together with the help of &lt;a href=&quot;https://twitter.com/rachelandrew&quot;&gt;Rachel Andrew&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/sw12&quot;&gt;Sam Dutton&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It has been some intense months of writing and editing, and I am really excited how it turned out.&lt;/p&gt;
&lt;p&gt;In total, there are 22 modules.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/form-element/&quot;&gt;Use forms to get data from users&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/form-fields/&quot;&gt;Help users enter data in forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/auto/&quot;&gt;Help users avoid re-entering data in forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/validation/&quot;&gt;Help users enter the right data in forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/testing/&quot;&gt;Test your forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/design-basics/&quot;&gt;Design basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/accessibility/&quot;&gt;Accessibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/internationalization/&quot;&gt;Internationalization and localization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/security-privacy/&quot;&gt;Security and privacy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/autofill/&quot;&gt;Autofill&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/usability-testing/&quot;&gt;How to test forms for usability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/cross-platform-testing/&quot;&gt;Test forms across devices and platforms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/data/&quot;&gt;Gathering data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/form/&quot;&gt;The form element in depth&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/fields/&quot;&gt;Form fields in depth&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/attributes/&quot;&gt;Form attributes in depth&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/styling/&quot;&gt;Styling forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/styling-form-controls/&quot;&gt;Styling form controls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/javascript/&quot;&gt;JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/identity/&quot;&gt;Identity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/payment/&quot;&gt;Payment forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/learn/forms/address/&quot;&gt;Address forms&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I learned a lot about forms (again), and hope you will too.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://web.dev/learn/forms/&quot;&gt;Start the course on web.dev&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> 100 days - 100 HTML elements in a tweet</title>
							<link>https://justmarkup.com/articles/2021-04-13-html-elements-in-a-tweet/</link>
							<pubDate>2021-04-12T15:51:20+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2021-04-13-html-elements-in-a-tweet/</guid>
							<description>&lt;p&gt;After tweeting about a &lt;a href=&quot;https://justmarkup.com/articles/2020-04-15-css-property-in-a-tweet/&quot;&gt;CSS property&lt;/a&gt; for 100 days in a row last year, I did it again this year, this time it was all about HTML elements.&lt;/p&gt;
&lt;p&gt;Again, I learned quite a lot about a language I have been using for over 15 years now almost daily. There is some interesting about almost every HTML element. I also have to say that it is fantastic to have &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element&quot;&gt;MDN&lt;/a&gt; as a reference available. You can learn so much by looking things up there.&lt;/p&gt;
&lt;p&gt;So, without further ado here is the full list of elements I tweeted about. You can also look them up directly on twitter using the &lt;a href=&quot;https://twitter.com/search?f=live&amp;amp;q=(%23HTMLElementInATweet)%20(from%3Ajustmarkup)&amp;amp;src=typed_query&quot;&gt;#HTMLElementInATweet hashtag&lt;/a&gt; if you prefer.&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 1: &amp;lt;html&amp;gt;&lt;br&gt;&lt;br&gt;The root element. All other elements must be descendants of this element.&lt;br&gt;&lt;br&gt;ℹ️ Always set the lang attribute&lt;a href=&quot;https://t.co/1M9IuYKfnU&quot;&gt;https://t.co/1M9IuYKfnU&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1344918532581167106?ref_src=twsrc%5Etfw&quot;&gt;January 1, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 2: &amp;lt;audio&amp;gt;&lt;br&gt;&lt;br&gt;Embed sound content in documents&lt;br&gt;&lt;br&gt;ℹ️ Never use the autoplay attribute - let the users decide if they want to hear it.&lt;a href=&quot;https://t.co/a73RjyygRz&quot;&gt;https://t.co/a73RjyygRz&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1345280920488652805?ref_src=twsrc%5Etfw&quot;&gt;January 2, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 3: &amp;lt;br&amp;gt;&lt;br&gt;&lt;br&gt;Produces a line break in text&lt;br&gt;&lt;br&gt;ℹ️ Better use &amp;lt;p&amp;gt; elements, and use CSS properties to control the spacing.&lt;a href=&quot;https://t.co/dDkty2QVhh&quot;&gt;https://t.co/dDkty2QVhh&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1345643308530487296?ref_src=twsrc%5Etfw&quot;&gt;January 3, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 4: &amp;lt;li&amp;gt;&lt;br&gt;&lt;br&gt;Represents an item in a list&lt;br&gt;&lt;br&gt;ℹ️ You can use the value attribute to indicate the current ordinal value of the list item as defined by the &amp;lt;ol&amp;gt; element.&lt;a href=&quot;https://t.co/x3NEHrXHNq&quot;&gt;https://t.co/x3NEHrXHNq&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1346005696387563520?ref_src=twsrc%5Etfw&quot;&gt;January 4, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 5: &amp;lt;h1&amp;gt; - &amp;lt;h6&amp;gt;&lt;br&gt;&lt;br&gt;The section headings&lt;br&gt;&lt;br&gt;ℹ️ Although no browser support &amp;lt;h&amp;gt; and/or the document outline they do style headlines different based on surrounding sections &lt;a href=&quot;https://t.co/bipv4RJ155&quot;&gt;https://t.co/bipv4RJ155&lt;/a&gt;&lt;a href=&quot;https://t.co/NlBCXtRtcq&quot;&gt;https://t.co/NlBCXtRtcq&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1346368084039389189?ref_src=twsrc%5Etfw&quot;&gt;January 5, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 6: &amp;lt;base&amp;gt;&lt;br&gt;&lt;br&gt;Specifies the base URL to use for all relative URLs in a document.&lt;br&gt;&lt;br&gt;ℹ️ Open Graph tags do not acknowledge &amp;lt;base&amp;gt;, and should always have full absolute URLs.&lt;a href=&quot;https://t.co/qY7k4jT4Xt&quot;&gt;https://t.co/qY7k4jT4Xt&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1346730472035000321?ref_src=twsrc%5Etfw&quot;&gt;January 6, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 7: &amp;lt;ins&amp;gt;&lt;br&gt;&lt;br&gt;Represents a range of text that has been added to a document.&lt;br&gt;&lt;br&gt;ℹ️ The presence of the &amp;lt;ins&amp;gt; element is not announced by most screen reading technology in its default configuration.&lt;a href=&quot;https://t.co/okkdDoubPz&quot;&gt;https://t.co/okkdDoubPz&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1347092859942367232?ref_src=twsrc%5Etfw&quot;&gt;January 7, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 8: &amp;lt;noscript&amp;gt;&lt;br&gt;&lt;br&gt;Defines a section of HTML to be inserted if scripting is currently turned off in the browser.&lt;br&gt;&lt;br&gt;ℹ️ If you use &amp;lt;noscript&amp;gt;Turn on JavaScript to view this page&amp;lt;/noscript&amp;gt;, you are doing it wrong.&lt;a href=&quot;https://t.co/1sHapOe0MV&quot;&gt;https://t.co/1sHapOe0MV&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1347455247778676742?ref_src=twsrc%5Etfw&quot;&gt;January 8, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 9: &amp;lt;title&amp;gt;&lt;br&gt;&lt;br&gt;Defines the document&amp;#39;s title.&lt;br&gt;&lt;br&gt;ℹ️ It is important to provide a title value that describes the page&amp;#39;s purpose. &lt;a href=&quot;https://t.co/pLXMBFEkJb&quot;&gt;https://t.co/pLXMBFEkJb&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1347817635652591616?ref_src=twsrc%5Etfw&quot;&gt;January 9, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 10: &amp;lt;math&amp;gt;&lt;br&gt;&lt;br&gt;The top-level element in MathML for describing mathematical notations&lt;br&gt;&lt;br&gt;ℹ️ Only supported in Firefox and Safari&lt;br&gt;&lt;br&gt;Example: &lt;a href=&quot;https://t.co/Ym9yV4DNG9&quot;&gt;https://t.co/Ym9yV4DNG9&lt;/a&gt;&lt;a href=&quot;https://t.co/zKeVlxm020&quot;&gt;https://t.co/zKeVlxm020&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1348180023535161344?ref_src=twsrc%5Etfw&quot;&gt;January 10, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 11: &amp;lt;p&amp;gt;&lt;br&gt;&lt;br&gt;Represents a paragraph&lt;br&gt;&lt;br&gt;ℹ️ The end tag may be omitted if the element is immediately followed by another block-level element.&lt;a href=&quot;https://t.co/VJCdX94I4g&quot;&gt;https://t.co/VJCdX94I4g&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1348542411429933061?ref_src=twsrc%5Etfw&quot;&gt;January 11, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 12: &amp;lt;span&amp;gt;&lt;br&gt;&lt;br&gt;A generic inline container for phrasing content&lt;br&gt;&lt;br&gt;ℹ️ It should only be used when no other semantic element is appropriate.&lt;a href=&quot;https://t.co/jTI5MvAZx1&quot;&gt;https://t.co/jTI5MvAZx1&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1348904799429947392?ref_src=twsrc%5Etfw&quot;&gt;January 12, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 13: &amp;lt;button&amp;gt;&lt;br&gt;&lt;br&gt;A clickable button, used to submit forms or anywhere in a document for accessible, standard button functionality.&lt;br&gt;&lt;br&gt;ℹ️ A &amp;lt;button&amp;gt; inside a form will act as a submit button, unless you add type=&amp;quot;button&amp;quot;&lt;a href=&quot;https://t.co/slNtJwZBoc&quot;&gt;https://t.co/slNtJwZBoc&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1349267187169574912?ref_src=twsrc%5Etfw&quot;&gt;January 13, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 14: &amp;lt;tr&amp;gt;&lt;br&gt;&lt;br&gt;Defines a row of cells in a table&lt;br&gt;&lt;br&gt;ℹ️ There are various valid use cases for a table, layout is none of them.&lt;a href=&quot;https://t.co/aa9w6Oo9Bw&quot;&gt;https://t.co/aa9w6Oo9Bw&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1349629574968082437?ref_src=twsrc%5Etfw&quot;&gt;January 14, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 15: &amp;lt;div&amp;gt;&lt;br&gt;&lt;br&gt;Is the generic container for flow content.&lt;br&gt;&lt;br&gt;ℹ️ It is a container, never misuse as an interactive element. &lt;br&gt;&lt;br&gt;Would personally prefer they would have it called &amp;lt;block&amp;gt; :-)&lt;a href=&quot;https://t.co/rI22G7tcVg&quot;&gt;https://t.co/rI22G7tcVg&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1349991962795905029?ref_src=twsrc%5Etfw&quot;&gt;January 15, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 16: &amp;lt;cite&amp;gt;&lt;br&gt;&lt;br&gt;It is used to describe a reference to a cited creative work.&lt;br&gt;&lt;br&gt;ℹ️ Typically, browsers style the contents of an &amp;lt;cite&amp;gt; element in italics by default.&lt;a href=&quot;https://t.co/9nmfjuk5vV&quot;&gt;https://t.co/9nmfjuk5vV&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1350354350623903749?ref_src=twsrc%5Etfw&quot;&gt;January 16, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 17: &amp;lt;tfoot&amp;gt;&lt;br&gt;&lt;br&gt;Defines a set of rows summarizing the columns of the table.&lt;br&gt;&lt;br&gt;ℹ️ Not the most interesting element, still very useful for semantics and accessibility if used right.&lt;a href=&quot;https://t.co/mwMTLpN3Yk&quot;&gt;https://t.co/mwMTLpN3Yk&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1350716738481094657?ref_src=twsrc%5Etfw&quot;&gt;January 17, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 18: &amp;lt;time&amp;gt;&lt;br&gt;&lt;br&gt;Represents a specific period in time&lt;br&gt;&lt;br&gt;ℹ️ You should include the datetime attribute to translate dates into machine-readable format&lt;a href=&quot;https://t.co/UoffxKUXJc&quot;&gt;https://t.co/UoffxKUXJc&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1351079126342496259?ref_src=twsrc%5Etfw&quot;&gt;January 18, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 19: &amp;lt;body&amp;gt;&lt;br&gt;&lt;br&gt;Represents the content of an HTML document&lt;br&gt;&lt;br&gt;ℹ️ The element with the most possible attributes, including many deprecated like link=&amp;quot;pink&amp;quot; (used to change default browser defined color for links)&lt;a href=&quot;https://t.co/K2FtL6FSHn&quot;&gt;https://t.co/K2FtL6FSHn&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1351441514279428097?ref_src=twsrc%5Etfw&quot;&gt;January 19, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 20: &amp;lt;textarea&amp;gt;&lt;br&gt;&lt;br&gt;Represents a multi-line plain-text editing control.&lt;br&gt;&lt;br&gt;ℹ️ Never set resize: none; better use resize: vertical; so users can still resize vertically, but it won&amp;#39;t break your horizontal layout.&lt;a href=&quot;https://t.co/GfiwvcM4pg&quot;&gt;https://t.co/GfiwvcM4pg&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1351803902111305728?ref_src=twsrc%5Etfw&quot;&gt;January 20, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 21: &amp;lt;param&amp;gt;&lt;br&gt;&lt;br&gt;Defines parameters for an &amp;lt;object&amp;gt; element.&lt;br&gt;&lt;br&gt;ℹ️ Was useful for embedding Flash (officially gone since 31.12.2020)&lt;a href=&quot;https://t.co/vjkogoJwCD&quot;&gt;https://t.co/vjkogoJwCD&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1352166289968607233?ref_src=twsrc%5Etfw&quot;&gt;January 21, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 22: &amp;lt;ruby&amp;gt;&lt;br&gt;&lt;br&gt;Represents small annotations &lt;br&gt;&lt;br&gt;ℹ️ The term ruby originated as a unit of measurement used by typesetters, representing the smallest size that text can be printed on newsprint while remaining legible.&lt;a href=&quot;https://t.co/pg7Lh5q9Cb&quot;&gt;https://t.co/pg7Lh5q9Cb&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1352528677892972545?ref_src=twsrc%5Etfw&quot;&gt;January 22, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 23: &amp;lt;colgroup&amp;gt;&lt;br&gt;&lt;br&gt;Defines a group of columns within a table.&lt;br&gt;&lt;br&gt;ℹ️ You can use the span attribute indicating the number of consecutive columns the &amp;lt;colgroup&amp;gt; element spans&lt;a href=&quot;https://t.co/vInvCA4OQe&quot;&gt;https://t.co/vInvCA4OQe&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1352891065733419009?ref_src=twsrc%5Etfw&quot;&gt;January 23, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 24: &amp;lt;kbd&amp;gt;&lt;br&gt;&lt;br&gt;Represents a span of inline text denoting textual user input from a keyboard, voice input, or any other text entry device.&lt;br&gt;&lt;br&gt;For example: &amp;lt;kbd&amp;gt;Strg&amp;lt;/kbd&amp;gt;+&amp;lt;kbd&amp;gt;b&amp;lt;/kbd&amp;gt;: Bold&lt;a href=&quot;https://t.co/jH2vI5xCNW&quot;&gt;https://t.co/jH2vI5xCNW&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1353253453573857281?ref_src=twsrc%5Etfw&quot;&gt;January 24, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 25: &amp;lt;head&amp;gt;&lt;br&gt;&lt;br&gt;Contains machine-readable information (metadata) about the document&lt;br&gt;&lt;br&gt;ℹ️ There is a lot that can be in the &amp;lt;head&amp;gt; &lt;a href=&quot;https://t.co/SBkYBl8nWl&quot;&gt;https://t.co/SBkYBl8nWl&lt;/a&gt;&lt;a href=&quot;https://t.co/nClLKh7Wlk&quot;&gt;https://t.co/nClLKh7Wlk&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1353615841426857986?ref_src=twsrc%5Etfw&quot;&gt;January 25, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 26: &amp;lt;meter&amp;gt;&lt;br&gt;&lt;br&gt;Represents either a scalar value within a known range or a fractional value.&lt;br&gt;&lt;br&gt;ℹ️ The meter element should not be used to indicate progress&lt;a href=&quot;https://t.co/FW4EQKhALq&quot;&gt;https://t.co/FW4EQKhALq&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1353978229330243584?ref_src=twsrc%5Etfw&quot;&gt;January 26, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 27: &amp;lt;main&amp;gt;&lt;br&gt;&lt;br&gt;Represents the dominant content of the &amp;lt;body&amp;gt; of a document.&lt;br&gt;&lt;br&gt;ℹ️ Browser reader mode functionality looks for the presence of the &amp;lt;main&amp;gt; element.&lt;a href=&quot;https://t.co/Geo65nsC2J&quot;&gt;https://t.co/Geo65nsC2J&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1354340617225080833?ref_src=twsrc%5Etfw&quot;&gt;January 27, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 28: &amp;lt;fieldset&amp;gt;&lt;br&gt;&lt;br&gt;Is used to group several controls as well as labels (&amp;lt;label&amp;gt;) within a web form.&lt;br&gt;&lt;br&gt;ℹ️ Great for grouping radio buttons, checkboxes and related fields.&lt;a href=&quot;https://t.co/CFoYzwVK7i&quot;&gt;https://t.co/CFoYzwVK7i&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1354703004973346817?ref_src=twsrc%5Etfw&quot;&gt;January 28, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 29: &amp;lt;b&amp;gt;&lt;br&gt;&lt;br&gt;Is used to draw the reader&amp;#39;s attention to the element&amp;#39;s contents&lt;br&gt;&lt;br&gt;ℹ️ Although browsers style content inside &amp;lt;b&amp;gt; as bold, do not use it for styling purposes.&lt;a href=&quot;https://t.co/YwvzssVgv7&quot;&gt;https://t.co/YwvzssVgv7&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1355065393069527042?ref_src=twsrc%5Etfw&quot;&gt;January 29, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 30: &amp;lt;var&amp;gt;&lt;br&gt;&lt;br&gt;Represents the name of a variable in a mathematical expression or a programming context.&lt;a href=&quot;https://t.co/X3ELf5tFpO&quot;&gt;https://t.co/X3ELf5tFpO&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1355427780993765376?ref_src=twsrc%5Etfw&quot;&gt;January 30, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 31: &amp;lt;map&amp;gt;&lt;br&gt;&lt;br&gt;Is used with &amp;lt;area&amp;gt; elements to define an image map (a clickable link area).&lt;br&gt;&lt;br&gt;ℹ️ Instead of image map you can create the same functionality nowadays with SVG.&lt;a href=&quot;https://t.co/1vWcWCy21A&quot;&gt;https://t.co/1vWcWCy21A&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1355790168704176128?ref_src=twsrc%5Etfw&quot;&gt;January 31, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 32: &amp;lt;ul&amp;gt;&lt;br&gt;&lt;br&gt;Represents an unordered list of items&lt;br&gt;&lt;br&gt;ℹ️ If you using list-style:none; Safari will remove semantics &lt;a href=&quot;https://t.co/xQ4ym6MyLi&quot;&gt;https://t.co/xQ4ym6MyLi&lt;/a&gt;&lt;a href=&quot;https://t.co/O4wIqkyp7R&quot;&gt;https://t.co/O4wIqkyp7R&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1356152556553195521?ref_src=twsrc%5Etfw&quot;&gt;February 1, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 33: &amp;lt;sup&amp;gt;&lt;br&gt;&lt;br&gt;Specifies inline text which is to be displayed as superscript&lt;br&gt;&lt;br&gt;ℹ️ The &amp;lt;sup&amp;gt; element should only be used for typographical reasons&lt;a href=&quot;https://t.co/9LPdgoIA5l&quot;&gt;https://t.co/9LPdgoIA5l&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1356514944318132224?ref_src=twsrc%5Etfw&quot;&gt;February 2, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 34: &amp;lt;address&amp;gt;&lt;br&gt;&lt;br&gt;Indicates that the enclosed HTML provides contact information&lt;br&gt;&lt;br&gt;ℹ️ Can be used for physical address, URL, email address, phone number, social media handle, geographic coordinates, and so forth.&lt;a href=&quot;https://t.co/QMEAa29JPl&quot;&gt;https://t.co/QMEAa29JPl&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1356877332179537920?ref_src=twsrc%5Etfw&quot;&gt;February 3, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 35: &amp;lt;picture&amp;gt;&lt;br&gt;&lt;br&gt;Contains zero or more &amp;lt;source&amp;gt; elements and one &amp;lt;img&amp;gt; element to offer alternative versions of an image&lt;br&gt;&lt;br&gt;ℹ️ Great for art direction, handling multiple image formats and adapting to user preferences&lt;a href=&quot;https://t.co/I2toAM8P1O&quot;&gt;https://t.co/I2toAM8P1O&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1357239720112254978?ref_src=twsrc%5Etfw&quot;&gt;February 4, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 36: &amp;lt;slot&amp;gt;&lt;br&gt;&lt;br&gt;Is a placeholder inside a web component that you can fill with your own markup.&lt;br&gt;&lt;br&gt;ℹ️ It lets you create separate DOM trees and present them together.&lt;a href=&quot;https://t.co/e9Mfmw6x9e&quot;&gt;https://t.co/e9Mfmw6x9e&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1357602108044840961?ref_src=twsrc%5Etfw&quot;&gt;February 5, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 37: &amp;lt;aside&amp;gt;&lt;br&gt;&lt;br&gt;Represents a portion of a document whose content is only indirectly related to the document&amp;#39;s main content.&lt;br&gt;&lt;br&gt;ℹ️ One of the elements added with HTML5 – which was already supported in IE 9 – time flies&lt;a href=&quot;https://t.co/tNcJShsZGc&quot;&gt;https://t.co/tNcJShsZGc&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1357964495797239809?ref_src=twsrc%5Etfw&quot;&gt;February 6, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 38: &amp;lt;table&amp;gt;&lt;br&gt;&lt;br&gt;Represents tabular data&lt;br&gt;&lt;br&gt;ℹ️ You can use the CSS property border-collapse only for this element, although I wish it could be used for other elements.&lt;a href=&quot;https://t.co/fhMqCDMnqL&quot;&gt;https://t.co/fhMqCDMnqL&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1358326883734212613?ref_src=twsrc%5Etfw&quot;&gt;February 7, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 39: &amp;lt;caption&amp;gt;&lt;br&gt;&lt;br&gt;Specifies the caption (or title) of a table.&lt;br&gt;&lt;br&gt;ℹ️ The &amp;lt;caption&amp;gt; element should be the first child of its parent &amp;lt;table&amp;gt; element.&lt;a href=&quot;https://t.co/1gixqJ5lLs&quot;&gt;https://t.co/1gixqJ5lLs&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1358689271591227393?ref_src=twsrc%5Etfw&quot;&gt;February 8, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 40: &amp;lt;s&amp;gt;&lt;br&gt;&lt;br&gt;Renders text with a strikethrough, or a line through it.&lt;br&gt;&lt;br&gt;ℹ️ Use the &amp;lt;s&amp;gt; element to represent things that are no longer relevant or no longer accurate – not for styling.&lt;a href=&quot;https://t.co/xhQv6giGQD&quot;&gt;https://t.co/xhQv6giGQD&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1359051659352166402?ref_src=twsrc%5Etfw&quot;&gt;February 9, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 41: &amp;lt;area&amp;gt;&lt;br&gt;&lt;br&gt;Defines an area inside an image map that has predefined clickable areas&lt;br&gt;&lt;br&gt;ℹ️ Did you know, that before image map in HTML there were server-side image maps? &lt;a href=&quot;https://t.co/fZqCMEW3sB&quot;&gt;https://t.co/fZqCMEW3sB&lt;/a&gt;&lt;a href=&quot;https://t.co/2ydPQXlZYZ&quot;&gt;https://t.co/2ydPQXlZYZ&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1359414047376953354?ref_src=twsrc%5Etfw&quot;&gt;February 10, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 42: &amp;lt;dd&amp;gt;&lt;br&gt;&lt;br&gt;Provides the description, definition, or value for the preceding term (&amp;lt;dt&amp;gt;) in a description list (&amp;lt;dl&amp;gt;).&lt;br&gt;&lt;br&gt;ℹ️ VoiceOver on iOS 14 Supports Description Lists &lt;a href=&quot;https://t.co/3U5vNLRjpa&quot;&gt;https://t.co/3U5vNLRjpa&lt;/a&gt;&lt;a href=&quot;https://t.co/RVg9JRnImk&quot;&gt;https://t.co/RVg9JRnImk&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1359776435473326081?ref_src=twsrc%5Etfw&quot;&gt;February 11, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 43: &amp;lt;section&amp;gt;&lt;br&gt;&lt;br&gt;Represents a standalone section&lt;br&gt;&lt;br&gt;ℹ️ If the contents of the element would make sense syndicated as a standalone piece, the &amp;lt;article&amp;gt; element may be a better choice.&lt;a href=&quot;https://t.co/H4pXPlj2ll&quot;&gt;https://t.co/H4pXPlj2ll&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1360138823187853314?ref_src=twsrc%5Etfw&quot;&gt;February 12, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 44: &amp;lt;q&amp;gt;&lt;br&gt;&lt;br&gt;Indicates that the enclosed text is a short inline quotation.&lt;br&gt;&lt;br&gt;ℹ️ Most modern browsers will automatically add quotation marks around text inside a &amp;lt;q&amp;gt; element.&lt;a href=&quot;https://t.co/CqZoW7GRbe&quot;&gt;https://t.co/CqZoW7GRbe&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1360501210801795077?ref_src=twsrc%5Etfw&quot;&gt;February 13, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 45: &amp;lt;source&amp;gt;&lt;br&gt;&lt;br&gt;Specifies multiple media resources &amp;lt;picture&amp;gt;, &amp;lt;audio&amp;gt;, or the &amp;lt;video&amp;gt; element&lt;br&gt;&lt;br&gt;ℹ️ The media attribute currently only works for &amp;lt;picture&amp;gt;, it was removed for &amp;lt;video&amp;gt; in all browsers but Safari &lt;a href=&quot;https://t.co/94Z3tw8ES2&quot;&gt;https://t.co/94Z3tw8ES2&lt;/a&gt;&lt;a href=&quot;https://t.co/ufC46N61en&quot;&gt;https://t.co/ufC46N61en&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1360863598759862273?ref_src=twsrc%5Etfw&quot;&gt;February 14, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 46: &amp;lt;dfn&amp;gt;&lt;br&gt;&lt;br&gt;Is used to indicate the term being defined within the context of a definition phrase or sentence.&lt;br&gt;&lt;br&gt;ℹ️ If the &amp;lt;dfn&amp;gt; element has a title attribute, it must contain the term being defined and no other text.&lt;a href=&quot;https://t.co/m986AlyNlc&quot;&gt;https://t.co/m986AlyNlc&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1361225986709225477?ref_src=twsrc%5Etfw&quot;&gt;February 15, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 47: &amp;lt;embed&amp;gt;&lt;br&gt;&lt;br&gt;Embeds external content at the specified point in the document.&lt;br&gt;&lt;br&gt;ℹ️ Use the title attribute on an embed element to label its content so that people using assistive technology can understand what it contains.&lt;a href=&quot;https://t.co/RhgTwpliKq&quot;&gt;https://t.co/RhgTwpliKq&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1361588374557978627?ref_src=twsrc%5Etfw&quot;&gt;February 16, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 48: &amp;lt;hr&amp;gt;&lt;br&gt;&lt;br&gt;Represents a thematic break between paragraph-level elements&lt;br&gt;&lt;br&gt;ℹ️ Only use if for semantic reason. If you wish to draw a horizontal line, you should do so using CSS.&lt;a href=&quot;https://t.co/GJFGkbc4xm&quot;&gt;https://t.co/GJFGkbc4xm&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1361950762486681600?ref_src=twsrc%5Etfw&quot;&gt;February 17, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 49: &amp;lt;dialog&amp;gt;&lt;br&gt;&lt;br&gt;Represents a dialog box or other interactive component&lt;br&gt;&lt;br&gt;ℹ️ While supported in Chromium, there are accessibility issues which makes it not usable for now &lt;a href=&quot;https://t.co/dC9DVeaffd&quot;&gt;https://t.co/dC9DVeaffd&lt;/a&gt;&lt;a href=&quot;https://t.co/V7PHaDGr5I&quot;&gt;https://t.co/V7PHaDGr5I&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1362313150230450176?ref_src=twsrc%5Etfw&quot;&gt;February 18, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 50: &amp;lt;tbody&amp;gt;&lt;br&gt;&lt;br&gt;Encapsulates a set of table rows (&amp;lt;tr&amp;gt;), indicating that they comprise the body of the table.&lt;br&gt;&lt;br&gt;ℹ️ If the table includes a &amp;lt;thead&amp;gt; block (to semantically identify header rows), the &amp;lt;tbody&amp;gt; block must come after it.&lt;a href=&quot;https://t.co/M5tCuCPFo0&quot;&gt;https://t.co/M5tCuCPFo0&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1362675538108682243?ref_src=twsrc%5Etfw&quot;&gt;February 19, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 51: &amp;lt;canvas&amp;gt;&lt;br&gt;&lt;br&gt;Use the HTML &amp;lt;canvas&amp;gt; element with either the canvas scripting API or the WebGL API to draw graphics and animations.&lt;br&gt;&lt;br&gt;ℹ️ You should provide alternate content inside the &amp;lt;canvas&amp;gt; block.&lt;a href=&quot;https://t.co/c7unZdWlbY&quot;&gt;https://t.co/c7unZdWlbY&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1363037925877940226?ref_src=twsrc%5Etfw&quot;&gt;February 20, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 52: &amp;lt;abbr&amp;gt;&lt;br&gt;&lt;br&gt;Represents an abbreviation or acronym&lt;br&gt;&lt;br&gt;ℹ️ Spelling out the acronym or abbreviation in full the first time it is used on a page is beneficial for helping people understand it&lt;a href=&quot;https://t.co/aBzHZtzMLH&quot;&gt;https://t.co/aBzHZtzMLH&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1363400313932288010?ref_src=twsrc%5Etfw&quot;&gt;February 21, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 53: &amp;lt;a&amp;gt;&lt;br&gt;&lt;br&gt;Creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.&lt;br&gt;&lt;br&gt;ℹ️ If it goes somewhere, use &amp;lt;a&amp;gt;&lt;a href=&quot;https://t.co/3lFe7alPyn&quot;&gt;https://t.co/3lFe7alPyn&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1363762701743316993?ref_src=twsrc%5Etfw&quot;&gt;February 22, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 54: &amp;lt;code&amp;gt;&lt;br&gt;&lt;br&gt;Displays its contents styled in a fashion intended to indicate that the text is a short fragment of computer code.&lt;br&gt;&lt;br&gt;ℹ️ To represent multiple lines of code, wrap the &amp;lt;code&amp;gt; element within a &amp;lt;pre&amp;gt; element.&lt;a href=&quot;https://t.co/DDnsn7FJgm&quot;&gt;https://t.co/DDnsn7FJgm&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1364125089613160450?ref_src=twsrc%5Etfw&quot;&gt;February 23, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 55: &amp;lt;sub&amp;gt;&lt;br&gt;&lt;br&gt;Specifies inline text which should be displayed as subscript for solely typographical reasons.&lt;br&gt;&lt;br&gt;ℹ️ Should be used only for typographical reasons, else use CSS like vertical-align: -25%&lt;a href=&quot;https://t.co/LcsftBH5Sg&quot;&gt;https://t.co/LcsftBH5Sg&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1364487477357142016?ref_src=twsrc%5Etfw&quot;&gt;February 24, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 56: &amp;lt;mark&amp;gt;&lt;br&gt;&lt;br&gt;Represents text which is marked or highlighted for reference or notation purpose&lt;br&gt;&lt;br&gt;ℹ️ Don&amp;#39;t use &amp;lt;mark&amp;gt; for syntax highlighting purposes&lt;a href=&quot;https://t.co/PHiUxXISxT&quot;&gt;https://t.co/PHiUxXISxT&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1364849865365225472?ref_src=twsrc%5Etfw&quot;&gt;February 25, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 57: &amp;lt;figure&amp;gt;&lt;br&gt;&lt;br&gt;Represents self-contained content, potentially with an optional caption&lt;br&gt;&lt;br&gt;ℹ️ Not only for &amp;lt;img&amp;gt;, can also be used for things like code, poems and everything referenced as a single unit.&lt;a href=&quot;https://t.co/aa48awSs1T&quot;&gt;https://t.co/aa48awSs1T&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1365212253188853762?ref_src=twsrc%5Etfw&quot;&gt;February 26, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 58: &amp;lt;header&amp;gt;&lt;br&gt;&lt;br&gt;Represents introductory content&lt;br&gt;&lt;br&gt;ℹ️ It was originally used as the &amp;lt;head&amp;gt; element and was used on the first website &lt;a href=&quot;https://t.co/U8p1rlqJ1z&quot;&gt;https://t.co/U8p1rlqJ1z&lt;/a&gt; but made it only in the specification with HTML5&lt;a href=&quot;https://t.co/R1YfxnZjfC&quot;&gt;https://t.co/R1YfxnZjfC&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1365574640924561410?ref_src=twsrc%5Etfw&quot;&gt;February 27, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 59: &amp;lt;strong&amp;gt;&lt;br&gt;&lt;br&gt;Indicates that its contents have strong importance, seriousness, or urgency.&lt;br&gt;&lt;br&gt;ℹ️ You have to be strong now, but this is not for styling.&lt;a href=&quot;https://t.co/TfWctuelug&quot;&gt;https://t.co/TfWctuelug&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1365937028966326272?ref_src=twsrc%5Etfw&quot;&gt;February 28, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 60: &amp;lt;rb&amp;gt;&lt;br&gt;&lt;br&gt;Is used to delimit the base text component of a  &amp;lt;ruby&amp;gt; annotation&lt;br&gt;&lt;br&gt;ℹ️ This feature is non-standard and is not on a standards track. Only supported in Firefox and, wait for it, Internet Explorer 5 - 11&lt;a href=&quot;https://t.co/9iNu7xsCcX&quot;&gt;https://t.co/9iNu7xsCcX&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1366299416647389188?ref_src=twsrc%5Etfw&quot;&gt;March 1, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 61: &amp;lt;thead&amp;gt;&lt;br&gt;&lt;br&gt;Defines a set of rows defining the head of the columns of the table.&lt;br&gt;&lt;br&gt;ℹ️ There was a (now obsolete) attribute called char, which is now specified (but not supported) in CSS as text-align: &amp;quot;.&amp;quot;; &lt;a href=&quot;https://t.co/WNXU0t3aJm&quot;&gt;https://t.co/WNXU0t3aJm&lt;/a&gt;&lt;a href=&quot;https://t.co/ur8Re83rfP&quot;&gt;https://t.co/ur8Re83rfP&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1366661804718366722?ref_src=twsrc%5Etfw&quot;&gt;March 2, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 62: &amp;lt;nav&amp;gt;&lt;br&gt;&lt;br&gt;Represents a section of a page whose purpose is to provide navigation links&lt;br&gt;&lt;br&gt;ℹ️ Use aria-label to describe the purpose of the nav&lt;a href=&quot;https://t.co/CX5oVSDuuj&quot;&gt;https://t.co/CX5oVSDuuj&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1367024192562946055?ref_src=twsrc%5Etfw&quot;&gt;March 3, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 63: &amp;lt;figcaption&amp;gt;&lt;br&gt;&lt;br&gt;Represents a caption or legend describing the rest of the contents of its parent &amp;lt;figure&amp;gt; element.&lt;br&gt;&lt;br&gt;ℹ️ How to figure? &lt;a href=&quot;https://t.co/sOCylQ9yRP&quot;&gt;https://t.co/sOCylQ9yRP&lt;/a&gt;&lt;a href=&quot;https://t.co/T7WsFio39a&quot;&gt;https://t.co/T7WsFio39a&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1367386580386598912?ref_src=twsrc%5Etfw&quot;&gt;March 4, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 64: &amp;lt;bdo&amp;gt;&lt;br&gt;&lt;br&gt;Overrides the current directionality of text, so that the text within is rendered in a different direction.&lt;br&gt;&lt;br&gt;&amp;lt;p&amp;gt;This text will go left to right.&amp;lt;/p&amp;gt;&lt;br&gt;&amp;lt;p&amp;gt;&amp;lt;bdo dir=&amp;quot;rtl&amp;quot;&amp;gt;This text will go right&lt;br&gt;to left.&amp;lt;/bdo&amp;gt;&amp;lt;/p&amp;gt;&lt;a href=&quot;https://t.co/9QNvAh1HD1&quot;&gt;https://t.co/9QNvAh1HD1&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1367748968256528385?ref_src=twsrc%5Etfw&quot;&gt;March 5, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 65: &amp;lt;meta&amp;gt;&lt;br&gt;&lt;br&gt;Represents metadata that cannot be represented by other HTML meta-related elements&lt;br&gt;&lt;br&gt;ℹ️ There are many interesting standard metadata names &lt;a href=&quot;https://t.co/VNFmOXVZzv&quot;&gt;https://t.co/VNFmOXVZzv&lt;/a&gt;&lt;a href=&quot;https://t.co/pozxavczFW&quot;&gt;https://t.co/pozxavczFW&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1368111356352720898?ref_src=twsrc%5Etfw&quot;&gt;March 6, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 66: &amp;lt;del&amp;gt;&lt;br&gt;&lt;br&gt;Represents a range of text that has been deleted from a document.&lt;br&gt;&lt;br&gt;ℹ️ As it is not announced to screen reader you should use :before/:after to announce it &lt;a href=&quot;https://t.co/jJD0twc2od&quot;&gt;https://t.co/jJD0twc2od&lt;/a&gt;&lt;a href=&quot;https://t.co/g6F1ndpQJf&quot;&gt;https://t.co/g6F1ndpQJf&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1368473743857758208?ref_src=twsrc%5Etfw&quot;&gt;March 7, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 67: &amp;lt;input&amp;gt;&lt;br&gt;&lt;br&gt;Is used to create interactive controls for web-based forms in order to accept data from the user&lt;br&gt;&lt;br&gt;ℹ️ Don&amp;#39;t use the placeholder attribute instead of a label.&lt;a href=&quot;https://t.co/b1KBxtS7oG&quot;&gt;https://t.co/b1KBxtS7oG&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1368836131790479362?ref_src=twsrc%5Etfw&quot;&gt;March 8, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 68: &amp;lt;template&amp;gt;&lt;br&gt;&lt;br&gt;Is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded&lt;br&gt;&lt;br&gt;ℹ️ Great for web components to define the enhanced HTML.&lt;a href=&quot;https://t.co/zzgt2lQAe2&quot;&gt;https://t.co/zzgt2lQAe2&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1369198519609856003?ref_src=twsrc%5Etfw&quot;&gt;March 9, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 69: &amp;lt;hgroup&amp;gt;&lt;br&gt;&lt;br&gt;Represents a multi-level heading for a section of a document&lt;br&gt;&lt;br&gt;ℹ️ It is partially implemented in most browsers, but will most likely never be usable. Looking at you outline algorithm.&lt;a href=&quot;https://t.co/ojBekuxNUv&quot;&gt;https://t.co/ojBekuxNUv&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1369560907534147586?ref_src=twsrc%5Etfw&quot;&gt;March 10, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 70: &amp;lt;iframe&amp;gt;&lt;br&gt;&lt;br&gt;Represents a nested browsing context, embedding another HTML page into the current one.&lt;br&gt;&lt;br&gt;ℹ️ Always set the title attribute to concisely describe the embedded content.&lt;a href=&quot;https://t.co/hKEF3Brl0N&quot;&gt;https://t.co/hKEF3Brl0N&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1369923295693348870?ref_src=twsrc%5Etfw&quot;&gt;March 11, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 71: &amp;lt;samp&amp;gt;&lt;br&gt;&lt;br&gt;Is used to enclose inline text which represents sample (or quoted) output from a computer program.&lt;br&gt;&lt;br&gt;ℹ️ Can be used for example to show the output after running a command in bash on your site.&lt;a href=&quot;https://t.co/TFzFdSVHWg&quot;&gt;https://t.co/TFzFdSVHWg&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1370285683277975552?ref_src=twsrc%5Etfw&quot;&gt;March 12, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 72: &amp;lt;data&amp;gt;&lt;br&gt;&lt;br&gt;Links a given piece of content with a machine-readable translation.&lt;br&gt;&lt;br&gt;ℹ️ Can be combined with microformats or the microdata attributes&lt;a href=&quot;https://t.co/NhLlsp9Fzr&quot;&gt;https://t.co/NhLlsp9Fzr&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1370648071202336770?ref_src=twsrc%5Etfw&quot;&gt;March 13, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 73: &amp;lt;summary&amp;gt;&lt;br&gt;&lt;br&gt;Specifies a summary, caption, or legend for a &amp;lt;details&amp;gt; element&amp;#39;s disclosure box.&lt;br&gt;&lt;br&gt;ℹ️ Content can be any heading content, plain text, or HTML that can be used within a paragraph.&lt;a href=&quot;https://t.co/kZ9nUi306l&quot;&gt;https://t.co/kZ9nUi306l&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1371010459000696836?ref_src=twsrc%5Etfw&quot;&gt;March 14, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 74: &amp;lt;style&amp;gt;&lt;br&gt;&lt;br&gt;Contains style information for a document, or part of a document.&lt;br&gt;&lt;br&gt;ℹ️ You can use the nonce attribute to whitelist inline styles in a style-src Content-Security-Policy.&lt;a href=&quot;https://t.co/1LPAXXhtJm&quot;&gt;https://t.co/1LPAXXhtJm&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1371372846904119297?ref_src=twsrc%5Etfw&quot;&gt;March 15, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 75: &amp;lt;track&amp;gt;&lt;br&gt;&lt;br&gt;Is used as a child of the media elements, &amp;lt;audio&amp;gt; and &amp;lt;video&amp;gt; to specify timed text tracks.&lt;br&gt;&lt;br&gt;ℹ️ Can be used to provide captions and subtitles.&lt;a href=&quot;https://t.co/aOJivzBCm7&quot;&gt;https://t.co/aOJivzBCm7&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1371735234702610434?ref_src=twsrc%5Etfw&quot;&gt;March 16, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 76: &amp;lt;datalist&amp;gt;&lt;br&gt;&lt;br&gt;Contains a set of &amp;lt;option&amp;gt; elements that represent the permissible or recommended options available&lt;br&gt;&lt;br&gt;ℹ️ It is very basic and you can&amp;#39;t really style or define when it should be shown. Still good for some use cases.&lt;a href=&quot;https://t.co/DO2ucDECuV&quot;&gt;https://t.co/DO2ucDECuV&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1372097622622752788?ref_src=twsrc%5Etfw&quot;&gt;March 17, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 77: &amp;lt;img&amp;gt;&lt;br&gt;&lt;br&gt;Embeds an image into the document.&lt;br&gt;&lt;br&gt;ℹ️ Always set the alt attribute, use empty value if decorative or decide if background-image or none is better in that case anyway.&lt;a href=&quot;https://t.co/TLNZwGa2lZ&quot;&gt;https://t.co/TLNZwGa2lZ&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1372460010438025217?ref_src=twsrc%5Etfw&quot;&gt;March 18, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 78: &amp;lt;option&amp;gt;&lt;br&gt;&lt;br&gt;Is used to define an item contained in a &amp;lt;select&amp;gt;, an &amp;lt;optgroup&amp;gt;, or a &amp;lt;datalist&amp;gt; element.&lt;br&gt;&lt;br&gt;ℹ️ Not really stylable as of now, but this might change someday I hope.&lt;a href=&quot;https://t.co/dWkOGt4gOm&quot;&gt;https://t.co/dWkOGt4gOm&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1372822398358147073?ref_src=twsrc%5Etfw&quot;&gt;March 19, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 79: &amp;lt;i&amp;gt;&lt;br&gt;&lt;br&gt;Represents a range of text that is set off from the normal text for some reason, such as idiomatic text, technical terms, taxonomical designations, among others. &lt;a href=&quot;https://t.co/2Z4Yd5URdW&quot;&gt;https://t.co/2Z4Yd5URdW&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1373184786089541633?ref_src=twsrc%5Etfw&quot;&gt;March 20, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 80: &amp;lt;video&amp;gt;&lt;br&gt;&lt;br&gt;Embeds a media player which supports video playback into the document.&lt;br&gt;&lt;br&gt;ℹ️ Videos should provide both captions and transcripts that accurately describe its content&lt;a href=&quot;https://t.co/FmuilLQYI8&quot;&gt;https://t.co/FmuilLQYI8&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1373547174059991040?ref_src=twsrc%5Etfw&quot;&gt;March 21, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 81: &amp;lt;label&amp;gt;&lt;br&gt;&lt;br&gt;Represents a caption for an item in a user interface.&lt;br&gt;&lt;br&gt;ℹ️ Don&amp;#39;t place interactive elements such as anchors or buttons inside a label.&lt;a href=&quot;https://t.co/UYgloacd2J&quot;&gt;https://t.co/UYgloacd2J&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1373909561829113857?ref_src=twsrc%5Etfw&quot;&gt;March 22, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 82: &amp;lt;em&amp;gt;&lt;br&gt;&lt;br&gt;Marks text that has stress emphasis.&lt;br&gt;&lt;br&gt;&amp;lt;p&amp;gt;Use HTML &amp;lt;em&amp;gt;now&amp;lt;/em&amp;gt;!&amp;lt;/p&amp;gt;&lt;a href=&quot;https://t.co/5xg3GDBnyp&quot;&gt;https://t.co/5xg3GDBnyp&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1374271949669552129?ref_src=twsrc%5Etfw&quot;&gt;March 23, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 83: &amp;lt;object&amp;gt;&lt;br&gt;&lt;br&gt;Represents an external resource&lt;a href=&quot;https://t.co/m63WG7xYq6&quot;&gt;https://t.co/m63WG7xYq6&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1374634337757454337?ref_src=twsrc%5Etfw&quot;&gt;March 24, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 84: &amp;lt;article&amp;gt;&lt;br&gt;&lt;br&gt;Represents a self-contained composition in a document&lt;br&gt;&lt;br&gt;ℹ️ Each &amp;lt;article&amp;gt; should be identified by a heading&lt;a href=&quot;https://t.co/U8UACwXFYq&quot;&gt;https://t.co/U8UACwXFYq&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1374996725509808128?ref_src=twsrc%5Etfw&quot;&gt;March 25, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 85: &amp;lt;ol&amp;gt;&lt;br&gt;&lt;br&gt;Represents an ordered list of items&lt;br&gt;&lt;br&gt;ℹ️ You can use the reversed attribute to number the items from high to low.&lt;a href=&quot;https://t.co/bT8uueUE6M&quot;&gt;https://t.co/bT8uueUE6M&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1375359113295618054?ref_src=twsrc%5Etfw&quot;&gt;March 26, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 86: &amp;lt;pre&amp;gt;&lt;br&gt;&lt;br&gt;Represents preformatted text which is to be presented exactly as written in the HTML file.&lt;br&gt;&lt;br&gt;ℹ️ If you want to show ASCII images, always provide an alternate description.&lt;a href=&quot;https://t.co/zFtc9zsxrm&quot;&gt;https://t.co/zFtc9zsxrm&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1375721501253570563?ref_src=twsrc%5Etfw&quot;&gt;March 27, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 87: &amp;lt;small&amp;gt;&lt;br&gt;&lt;br&gt;Represents side-comments and small print, like copyright and legal text.&lt;br&gt;&lt;br&gt;ℹ️ Like with every other HTML element, don&amp;#39;t misuse for styling. &lt;a href=&quot;https://t.co/1XPHfeotdw&quot;&gt;https://t.co/1XPHfeotdw&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1376068789658296325?ref_src=twsrc%5Etfw&quot;&gt;March 28, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 88: &amp;lt;link&amp;gt;&lt;br&gt;&lt;br&gt;Specifies relationships between the current document and an external resource.&lt;br&gt;&lt;br&gt;ℹ️ prefetch/preload can be very helpful, but as always, test if this is really the best for your case.&lt;a href=&quot;https://t.co/Wo5bA0RZXN&quot;&gt;https://t.co/Wo5bA0RZXN&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1376431177398157316?ref_src=twsrc%5Etfw&quot;&gt;March 29, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 89: &amp;lt;legend&amp;gt;&lt;br&gt;&lt;br&gt;Represents a caption for the content of its parent &amp;lt;fieldset&amp;gt;&lt;br&gt;&lt;br&gt;ℹ️ Always use a &amp;lt;legend&amp;gt; if you use a &amp;lt;fieldset&amp;gt;&lt;a href=&quot;https://t.co/AjsTCIh5Ck&quot;&gt;https://t.co/AjsTCIh5Ck&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1376793565326667778?ref_src=twsrc%5Etfw&quot;&gt;March 30, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 90: &amp;lt;optgroup&amp;gt;&lt;br&gt;&lt;br&gt;Creates a grouping of options within a &amp;lt;select&amp;gt; element.&lt;br&gt;&lt;br&gt;ℹ️ Use the label attribute to give the group a heading.&lt;a href=&quot;https://t.co/X57gusVAkt&quot;&gt;https://t.co/X57gusVAkt&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1377155953146044416?ref_src=twsrc%5Etfw&quot;&gt;March 31, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 91: &amp;lt;blockquote&amp;gt;&lt;br&gt;&lt;br&gt;Indicates that the enclosed text is an extended quotation.&lt;br&gt;&lt;br&gt;ℹ️ You can use the cite attribute to specify the source of the quotation.&lt;a href=&quot;https://t.co/qB76gYp7Ba&quot;&gt;https://t.co/qB76gYp7Ba&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1377518341124935681?ref_src=twsrc%5Etfw&quot;&gt;April 1, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 92: &amp;lt;script&amp;gt;&lt;br&gt;&lt;br&gt;Is used to embed executable code or data&lt;br&gt;&lt;br&gt;ℹ️ Use type=&amp;quot;module&amp;quot; to only load JavaScript for modern browsers, make sure base experience is still working without JavaScript.&lt;a href=&quot;https://t.co/VZybDYSSeb&quot;&gt;https://t.co/VZybDYSSeb&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1377880728977956866?ref_src=twsrc%5Etfw&quot;&gt;April 2, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 93: &amp;lt;select&amp;gt;&lt;br&gt;&lt;br&gt;Represents a control that provides a menu of options.&lt;br&gt;&lt;br&gt;ℹ️ Yes, hard to style, still think twice before using a JavaScript-based alternative - getting them accessibility is really hard.&lt;a href=&quot;https://t.co/QYG7iLAw24&quot;&gt;https://t.co/QYG7iLAw24&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1378243116738748417?ref_src=twsrc%5Etfw&quot;&gt;April 3, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 94: &amp;lt;output&amp;gt;&lt;br&gt;&lt;br&gt;Is a container element into which a site or app can inject the results of a calculation or the outcome of a user action.&lt;br&gt;&lt;br&gt;ℹ️ Many browsers implement this element as an aria-live region&lt;a href=&quot;https://t.co/hwbaEDHOXd&quot;&gt;https://t.co/hwbaEDHOXd&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1378605504675602432?ref_src=twsrc%5Etfw&quot;&gt;April 4, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 95: &amp;lt;progress&amp;gt;&lt;br&gt;&lt;br&gt;Displays an indicator showing the completion progress of a task.&lt;br&gt;&lt;br&gt;ℹ️ The minimum value is always 0, and you can not set any other value for min.&lt;a href=&quot;https://t.co/Znu2lTjqKR&quot;&gt;https://t.co/Znu2lTjqKR&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1378967892528656384?ref_src=twsrc%5Etfw&quot;&gt;April 5, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 96: &amp;lt;details&amp;gt;&lt;br&gt;&lt;br&gt;Creates a disclosure widget in which information is visible only when the widget is toggled into an &amp;quot;open&amp;quot; state.&lt;br&gt;&lt;br&gt;ℹ️ Do not misuse as a hamburger menu.&lt;a href=&quot;https://t.co/PyfpMKWNwU&quot;&gt;https://t.co/PyfpMKWNwU&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1379330280381505539?ref_src=twsrc%5Etfw&quot;&gt;April 6, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 97: &amp;lt;svg&amp;gt;&lt;br&gt;&lt;br&gt;Is a container that defines a new coordinate system and viewport.&lt;br&gt;&lt;br&gt;ℹ️ You don&amp;#39;t need the xmlns attribute when using it directly in HTML.&lt;a href=&quot;https://t.co/cof8ojVnjl&quot;&gt;https://t.co/cof8ojVnjl&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1379692668272451586?ref_src=twsrc%5Etfw&quot;&gt;April 7, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 98: &amp;lt;wbr&amp;gt;&lt;br&gt;&lt;br&gt;Represents a word break opportunity&lt;br&gt;&lt;br&gt;ℹ️ Behaves like the U+200B ZERO-WIDTH SPACE code point&lt;a href=&quot;https://t.co/ZP5eVSesmH&quot;&gt;https://t.co/ZP5eVSesmH&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1380055056133787648?ref_src=twsrc%5Etfw&quot;&gt;April 8, 2021&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 99: &amp;lt;form&amp;gt;&lt;br&gt;&lt;br&gt;Represents a document section containing interactive controls for submitting information.&lt;br&gt;&lt;br&gt;ℹ️ Your daily reminder that you can do a lot using form and server-side code.&lt;a href=&quot;https://t.co/in4Qr8pikw&quot;&gt;https://t.co/in4Qr8pikw&lt;/a&gt;&lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1380417444058124292?ref_src=twsrc%5Etfw&quot;&gt;April 9, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 100: &amp;lt;footer&amp;gt;&lt;br&gt;&lt;br&gt;Represents a footer for its nearest sectioning content or sectioning root element.&lt;br&gt;&lt;br&gt;🎉 That&amp;#39;s it. That was fun. 100 days of &lt;a href=&quot;https://twitter.com/hashtag/HTMLElementInATweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#HTMLElementInATweet&lt;/a&gt; are over now. Hope you learned something.&lt;a href=&quot;https://t.co/KWujbA3OXH&quot;&gt;https://t.co/KWujbA3OXH&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1380779831886024706?ref_src=twsrc%5Etfw&quot;&gt;April 10, 2021&lt;/a&gt;&lt;/blockquote&gt; 
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Overenhancement</title>
							<link>https://justmarkup.com/notes/2021-03-19-overenhancement/</link>
							<pubDate>2021-03-19T16:04:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2021-03-19-overenhancement/</guid>
							<description>&lt;p&gt;A friend of mine upgraded their bicycle to an electric bicycle some years ago, mainly to improve their commute to work. It sounded like a great choice, in the end the upgrade did however not make their life easier. The upgrade had the opposite effect.&lt;/p&gt;
&lt;p&gt;This article is all about enhancements, enhancements going too far; Overenhancements.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;quot;Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better.&amp;quot; — Edsger W. Dijkstra (1930-2002) &amp;quot;On the nature of Computing Science&amp;quot; (EWD896) August 10, 1984&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;hamburger&quot;&gt;Hamburger &lt;a class=&quot;permalink&quot; href=&quot;#hamburger&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The first &lt;a href=&quot;http://info.cern.ch/hypertext/WWW/TheProject.html&quot;&gt;websites&lt;/a&gt; didn&#39;t have a main navigation we are used to having today. They linked from one page to another.&lt;/p&gt;
&lt;p&gt;Today, almost every website has some sort of main navigation – a list of links for the most important (overview) pages of a site. When smartphones got popular, people realized that the spare space available had to be used effectively. So they came up with a solution – the hamburger menu.&lt;/p&gt;
&lt;p&gt;Given the spare space available on small screens it sounds like a great idea to hide the navigation behind a button at first and only reveal it once the hamburger is selected. This can also be build in a progressive and accessible way making it available for as many users as possible.&lt;/p&gt;
&lt;p&gt;There is however one problem – using this pattern in every case. If you only have three navigation items, it makes no sense at all to initially hide them. Enhancing a list of three navigation items to a hamburger menu will make it more complicated to use the navigation; Overenhancement.&lt;/p&gt;
&lt;h2 id=&quot;tabs&quot;&gt;Tabs &lt;a class=&quot;permalink&quot; href=&quot;#tabs&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Another prominent enhancement pattern are tabs. Say, you have a page with multiple headlines all with corresponding text. In HTML one would structure it like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;A topic&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;This is all about...&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Another topic&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;More about this topic...&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, the idea is to enhance this using tabs to save space and give the user a better overview of available topics and the option to quickly switch between them.&lt;/p&gt;
&lt;p&gt;Again, this sounds like a great enhancement at first, and it is again possible to build it in a progressive and accessible way. For many users though, this can make things worse.&lt;/p&gt;
&lt;p&gt;First, by using tabs you make it harder for users to use the native in-search functionality browsers offer. In addition, you may run into problems if there are too many tabs, if headlines are really long and so forth.&lt;/p&gt;
&lt;p&gt;Most importantly, as tabs are not a native HTML feature, all work a bit differently for keyboard users, on some you can switch tabs with the arrow keys, on some only with tabs, on some with both. This makes them hard to use for keyboard users and users using assistive technologies. Much harder than our basic version with headlines and paragraphs.&lt;/p&gt;
&lt;p&gt;There are lots of other enhancements which can turn out to have the opposite effect, so be really careful when you enhance. Don&#39;t enhance just for the sake of it.&lt;/p&gt;
&lt;h2 id=&quot;it-depends%E2%84%A2&quot;&gt;It depends™ &lt;a class=&quot;permalink&quot; href=&quot;#it-depends%E2%84%A2&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Remember my friend I mentioned at the beginning, who upgraded to an electric bicycle to enhance their commute? The reason why the enhancement did not work out for them? The commute was only 1 km and while the electric power made the biking itself less exhausting they didn&#39;t think about the other consequences.&lt;/p&gt;
&lt;p&gt;The power only lasted for a while, so they regularly had to charge the battery, which means taking the battery out of the bicycle, charge it and not forget it to take it back the next morning. Even more frustrating was, that at work they had no elevator and as they wouldn&#39;t want their expensive bike to be stolen, they had to carry the bike (which was much heavier than the non-electric one) to the 4th floor every day.&lt;/p&gt;
&lt;p&gt;The enhancement looked great at first, in the end though it did make their life not easier, but quite the opposite.&lt;/p&gt;
&lt;p&gt;As with electric bicycles, there are a lot of cases where some mentioned patterns do make things easier and do enhance the user experience, at the same time there are a lot of cases where using these patterns do overcomplicate things and make it harder for users; Overenhancement.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The Void</title>
							<link>https://justmarkup.com/notes/2021-03-01-the-void/</link>
							<pubDate>2021-03-01T16:11:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2021-03-01-the-void/</guid>
							<description>&lt;p&gt;I have a document in &lt;a href=&quot;https://app.writerie.com/&quot;&gt;Writerie&lt;/a&gt; which is called The Void - every time (at least most of the time) I am angry about something or want to complain and would normally tweet it out, I instead write it down in The Void.&lt;/p&gt;
&lt;p&gt;This way it is out of the way, and at the same time I don&#39;t tweet something stupid I may regret later. Getting it out of my head is very important for me. If I don&#39;t write it down, I will think about it again and again and get mad.&lt;/p&gt;
&lt;p&gt;The Void helps me here and frees my thoughts.&lt;/p&gt;
&lt;p&gt;Happy voiding!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Reduce your client-side JavaScript in Next.js</title>
							<link>https://justmarkup.com/articles/2021-02-15-recude-client-js-next-js/</link>
							<pubDate>2021-02-10T20:01:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2021-02-15-recude-client-js-next-js/</guid>
							<description>&lt;p&gt;I am currently working on a side-project, where most parts are static, but there are pages where I need to access a database and do things on the server which I can not pre-build. In the past I would have probably used Node.js with an Express server for this, but I thought it is time to give Next.js a try. After using it for some weeks, I have to say I like it, and it is a good option for these type of projects.&lt;/p&gt;
&lt;p&gt;The performance you get with Next.js is already pretty good, but there is always room for more. In this article I would like to outline some ways to ship less client-side JavaScript in Next.js.&lt;/p&gt;
&lt;h2 id=&quot;disable-client-side-javascript&quot;&gt;Disable client-side JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#disable-client-side-javascript&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Almost every app or site has one or various landing pages. And let&#39;s be honest here - a lot of users visiting your landing page(s) will leave your site without further interacting with it. Therefore, we should do our best to serve that page(s) as fast as possible and requesting as few data as possible. If it takes too long to load, people may even leave before they see the content – another potential customer lost.&lt;/p&gt;
&lt;p&gt;Among optimizing images, limiting web fonts and other performance improvements, we could serve this pages without any client-side JavaScript. Almost all landing pages I ever visited are static and not interactive, so why ship JavaScript if you don&#39;t need it there?&lt;/p&gt;
&lt;p&gt;In Next.js by default there will always be client-side JavaScript, but you can disable this with this experimental config.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;export const config =&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;unstable_runtimeJS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; false&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can add this to every page (path), where you don&#39;t need client-side JavaScript. I said it is experimental, so while it works great for me, there may be some edge cases where this won&#39;t work.&lt;/p&gt;
&lt;p&gt;I learned about this one from &lt;a href=&quot;https://piccalil.li/blog/new-year-new-website&quot;&gt;Andy Bell&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;use-preact&quot;&gt;Use Preact &lt;a class=&quot;permalink&quot; href=&quot;#use-preact&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You don&#39;t have only landing pages in most of the cases, so what can you do to reduce the size of your client-side JavaScript? A good approach for many apps to replace React with Preact.&lt;/p&gt;
&lt;p&gt;As a first step to use Preact instead of React, we should install the needed Preact packages by running&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; --save preact preact-compat preact-render-to-string&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in your terminal.&lt;/p&gt;
&lt;p&gt;Now we can open our package.json and alias React to Preact with:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;react&quot;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;github:preact-compat/react#1.0.0&quot;&lt;/span&gt;,&lt;br&gt;&lt;span class=&quot;token string&quot;&gt;&quot;react-dom&quot;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;github:preact-compat/react-dom#1.0.0&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and after that open your terminal and run&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;just to be sure.&lt;/p&gt;
&lt;p&gt;As a last step, we can uninstall &lt;code&gt;react&lt;/code&gt; and &lt;code&gt;react-dom&lt;/code&gt; by running&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; uninstall react react-dom&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the end it should look like this:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token string&quot;&gt;&quot;dependencies&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;preact&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;^10.5.12&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;preact-render-to-string&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;^5.1.12&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;react&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;github:preact-compat/react#1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;react-dom&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;github:preact-compat/react-dom#1.0.0&quot;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While using Preact instead of React will reduce your client-side JavaScript enormous, but be aware that not everything may work as expected by using Preact instead of React. You should still at least try to replace it, if you encounter unsolvable problems you can switch back pretty easy.&lt;/p&gt;
&lt;h2 id=&quot;preload&quot;&gt;Preload &lt;a class=&quot;permalink&quot; href=&quot;#preload&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some time ago &lt;a href=&quot;https://twitter.com/csswizardry&quot;&gt;Harry Roberts&lt;/a&gt; asked about a way to &lt;a href=&quot;https://twitter.com/csswizardry/status/1349681832393109510?s=20&quot;&gt;disable rel=&amp;quot;preload&amp;quot; in Next.js&lt;/a&gt;, and they got some good answers there. As with disabling client-side JavaScript there is an experimental config setting for disabling Preload using:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;export const config =&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;unstable_JsPreload&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; false&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This has only been added &lt;a href=&quot;https://github.com/vercel/next.js/pull/21329/files&quot;&gt;recently&lt;/a&gt; so may not be available in the Next.js version you are using. And it is also experimental, so be aware that I may not always work like expected.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next.js is already doing a great job regarding performance, but as you can see there are some ways to reduce the JavaScript code users have to download and most important, the JavaScript code the browser has to parse and execute. I always recommend testing your site with an average Android Device like the Moto G. If you don&#39;t own such a device you can also use &lt;a href=&quot;https://webpagetest.org/easy.php&quot;&gt;WebPageTest&lt;/a&gt; to test on a real Moto G – if your site loads fast there, you have done a great job.&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://fettblog.eu/go-preact/&quot;&gt;Go Preact!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://justinnoel.dev/2020/05/12/using-preact-in-a-next-js-project/&quot;&gt;Using Preact Instead of React in a NEXT.js Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://piccalil.li/blog/new-year-new-website&quot;&gt;New year, new website &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Nine years</title>
							<link>https://justmarkup.com/notes/2021-01-31-nine-years/</link>
							<pubDate>2021-01-31T12:11:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2021-01-31-nine-years/</guid>
							<description>&lt;p&gt;The site is live now for almost a decade. Nine years ago I published my first article here.&lt;/p&gt;
&lt;p&gt;Since then, I published over 140 more articles and notes.&lt;/p&gt;
&lt;p&gt;The biggest change on this site since last year is, that I now a have a &lt;a href=&quot;https://justmarkup.com/bookmarks/&quot;&gt;bookmark section&lt;/a&gt;. I wrote an article about this change and how you too can integrate &lt;a href=&quot;https://justmarkup.com/articles/2021-01-19-integrate-pocket-in-eleventy/&quot;&gt;Pocket in your Eleventy site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There is also another section coming to this page - the reading section. It is almost done and will go live soon. It will be a bit different from the usual bookshelves, but I think you will like it.&lt;/p&gt;
&lt;p&gt;I also wanted to restyle everything again, but this will take some more time, as at the moment I enjoy writing more than redesigning.&lt;/p&gt;
&lt;p&gt;Oh, and early this year I added the option to &lt;a href=&quot;https://www.buymeacoffee.com/justmarkup&quot;&gt;support me&lt;/a&gt; underneath each article. Thanks to everybody supporting, reading, sharing and discussing my articles. Thank you.&lt;/p&gt;
&lt;p&gt;On to the next nine years!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Integrate Pocket in Eleventy</title>
							<link>https://justmarkup.com/articles/2021-01-19-integrate-pocket-in-eleventy/</link>
							<pubDate>2021-01-19T13:04:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2021-01-19-integrate-pocket-in-eleventy/</guid>
							<description>&lt;p&gt;I have been using &lt;a href=&quot;https://app.getpocket.com/&quot;&gt;Pocket&lt;/a&gt; since many years to organize my bookmarks and reading list and thought it would be great to show them on my blog where I use &lt;a href=&quot;https://www.11ty.dev/&quot;&gt;Eleventy&lt;/a&gt;. In this article you will learn how to get your data from Pocket and show them on your Eleventy site.&lt;/p&gt;
&lt;h2 id=&quot;get-a-consumer-key-from-pocket&quot;&gt;Get a consumer key from Pocket &lt;a class=&quot;permalink&quot; href=&quot;#get-a-consumer-key-from-pocket&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We assume that you already have a Pocket account, if not you should register an account &lt;a href=&quot;https://getpocket.com/&quot;&gt;there&lt;/a&gt; first.&lt;/p&gt;
&lt;p&gt;First, we need a consumer key, which we get on their &lt;a href=&quot;https://getpocket.com/developer/apps/&quot;&gt;Developer site&lt;/a&gt; - use &amp;quot;Create an Application&amp;quot; there. Give it a name and description of your choice, set permissions to Retrieve, and Platforms to Web. After the application got created you will be directed to a site where you can see your consumer key which you should save somewhere now as we need it later.&lt;/p&gt;
&lt;h2 id=&quot;obtain-the-access-token&quot;&gt;Obtain the access token &lt;a class=&quot;permalink&quot; href=&quot;#obtain-the-access-token&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To be able to use the Pocket API, we also need the access token of our account. To get this you can use &lt;a href=&quot;https://github.com/mheap/pocket-auth-cli&quot;&gt;pocket-auth-cli&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Open your terminal and install the package globally:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; -g pocket-auth-cli&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After the installation is finished run the following command (replace &amp;lt;consumer_key&amp;gt; with the key you saved above):&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pocket-auth &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;consumer_key&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If everything worked, you will see your access_token in your terminal. Copy and save that as we also need this one later as well.&lt;/p&gt;
&lt;p&gt;You can test if all worked by opening the URL &lt;a href=&quot;https://getpocket.com/v3/get?consumerkey=%3Cconsumer_key%3E&amp;amp;access_token=%3Caccess_token%3E&quot;&gt;https://getpocket.com/v3/get?consumerkey=&amp;lt;consumer_key&amp;gt;&amp;amp;access_token=&amp;lt;access_token&amp;gt;&lt;/a&gt; in your browser (replace &lt;code&gt;&amp;lt;consumer_key&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;access_token&amp;gt;&lt;/code&gt; with your data)&lt;/p&gt;
&lt;h2 id=&quot;fetch-data-from-pocket&quot;&gt;Fetch data from Pocket &lt;a class=&quot;permalink&quot; href=&quot;#fetch-data-from-pocket&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now, let&#39;s switch to your Eleventy project.&lt;/p&gt;
&lt;p&gt;To start, create a file called pocket.js and save it in the &lt;code&gt;_data&lt;/code&gt; folder (if you don&#39;t have the &lt;code&gt;_data&lt;/code&gt; folder already create it now)&lt;/p&gt;
&lt;p&gt;Now, switch back to the terminal and navigate to the root of your Eleventy project. To be able to fetch data, we need to install node-fetch and to be able to read our environment variables (more on this later) we need the dotenv package&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; node-fetch dotenv --save-dev&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After this has been installed, we need to define the environment variables. To do this in your local project, create a file called .env (if there is none) and safe it in the root of the project.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Never add your environment variables and files (in our case &lt;code&gt;.env&lt;/code&gt;) to your Git repository. To avoid ever having them there you can use a &lt;code&gt;.gitignore&lt;/code&gt; file in the root of your project and add &lt;code&gt;.env&lt;/code&gt; there.&lt;/p&gt;
&lt;p&gt;Next, we define our variables there:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;POCKET_CONSUMER_KEY&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;CONSUMER_KEY&lt;br&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;POCKET_ACCESS_TOKEN&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;ACCESS_TOKEN&lt;br&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;POCKET_TAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;TAG&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace CONSUMERKEY and ACCESSTOKEN with your values you saved above. For TAG, you can either use the value &lt;em&gt;all&lt;/em&gt; to get all, or use one of your tags to be able to define what you want to show in public. I use a tag called public for example.&lt;/p&gt;
&lt;p&gt;Now, let&#39;s move back to our code editor and open the &lt;code&gt;pocket.js&lt;/code&gt; file we created before and insert the following code.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fetch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;node-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;dotenv&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CONSUMER_KEY&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;env&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;POCKET_CONSUMER_KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;ACCESS_TOKEN&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;env&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;POCKET_ACCESS_TOKEN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;TAG&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;env&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;POCKET_TAG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;POCKET_URI&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;https://getpocket.com/v3/get?consumer_key=&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CONSUMER_KEY&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;amp;access_token=&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;ACCESS_TOKEN&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;amp;tag=&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;POCKET_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;json&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; Object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;list&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let&#39;s go through this. In the first two lines we import the packages we installed before. Next we define some variables we extract from the &lt;code&gt;.env&lt;/code&gt; file. The interesting part happens in &lt;code&gt;module.exports&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;There we have a function, which uses fetch to, well fetch the data from the pocket API, transform this to json and return an Object with our list of items we saved in Pocket.&lt;/p&gt;
&lt;h2 id=&quot;integrate-in-your-template&quot;&gt;Integrate in your template &lt;a class=&quot;permalink&quot; href=&quot;#integrate-in-your-template&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now, that we have the data fetch in place, let&#39;s integrate the data in our template. We are using &lt;a href=&quot;https://mozilla.github.io/nunjucks/&quot;&gt;Nunjucks&lt;/a&gt; as our template engine as the example here, but you can also use any other template language supported by Eleventy.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;{% if pocket.length %}&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  {%- for entry in pocket | reverse %}&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;{{ entry.given_url }}&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;{{ entry.resolved_title }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;{{ entry.excerpt }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  {%- endfor %}&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;{%- endif %}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let&#39;s have a look there. First we check if there are any items available at all, and if yes, output an &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now we use a for loop to go through every item and output some of the values we got from Pocket. On the &lt;a href=&quot;https://getpocket.com/developer/docs/v3/retrieve&quot;&gt;Pocket Developer site&lt;/a&gt; you find a list of all values available.&lt;/p&gt;
&lt;p&gt;With this in place, we can go back to the terminal and run the Eleventy serve command:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;npx eleventy --serve&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you now open the template where you integrated Pocket you should see a list of all your items (or if you used a specific tag, all your items tagged with the specific tag).&lt;/p&gt;
&lt;p&gt;You can now deploy your site and show your Pocket list on your site.&lt;/p&gt;
&lt;h2 id=&quot;extra-(automatic-deploys%2C-caching)&quot;&gt;Extra (automatic deploys, caching) &lt;a class=&quot;permalink&quot; href=&quot;#extra-(automatic-deploys%2C-caching)&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You most probably want to have the data up-to-date and have automatic deploys. Here is a tutorial how you can do that on &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/netlify-ifttt/&quot;&gt;Netlify&lt;/a&gt;, but this is also possible with many other hosts. In my case it is a bit more complicated, so will share my setup to do automatic deploys on a traditional hoster in a future article.&lt;/p&gt;
&lt;p&gt;Be aware that there is a rate limit, but it is very generous with &lt;a href=&quot;https://getpocket.com/developer/docs/rate-limits&quot;&gt;320 calls per hour&lt;/a&gt;. You probably will never reach that, but you may still want to cache data requests. I won&#39;t cover this here as well, if you want to integrate caching I can recommend this &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/&quot;&gt;tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;my-bookmarks&quot;&gt;My Bookmarks &lt;a class=&quot;permalink&quot; href=&quot;#my-bookmarks&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you are curious what I have saved at Pocket have a look at my &lt;a href=&quot;https://justmarkup.com/bookmarks/&quot;&gt;bookmark section&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
			
			
				
							
						
						
						<item>
							<title> Make the page count of a 3D book visible using CSS custom properties</title>
							<link>https://justmarkup.com/articles/2021-01-12-make-the-page-count-of-a-3d-book-visible-using-css-custom-properties/</link>
							<pubDate>2021-01-12T13:34:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2021-01-12-make-the-page-count-of-a-3d-book-visible-using-css-custom-properties/</guid>
							<description>&lt;p&gt;I am currently building a book section for this site and thought it would be cool to show the books in 3D and also to make it visible how many pages a book has. In this article I would like to show you how to use CSS custom properties to adapt the depth of a 3D book showing how many pages the book has.&lt;/p&gt;
&lt;h2 id=&quot;3d-book-in-css&quot;&gt;3D Book in CSS &lt;a class=&quot;permalink&quot; href=&quot;#3d-book-in-css&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are many &lt;a href=&quot;https://freefrontend.com/css-book-effects/&quot;&gt;resources&lt;/a&gt; and &lt;a href=&quot;https://codepen.io/poulamic/pen/RwrKqmb&quot;&gt;code examples&lt;/a&gt; how to build a &lt;a href=&quot;https://codepen.io/mina-mounir/pen/gOPppdv&quot;&gt;3D Book&lt;/a&gt; in CSS. As a starting point I used &lt;a href=&quot;https://scastiel.dev/posts/2020-07-23-animated-3d-book-css/&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is the HTML for creating the book:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;book&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;book__wrapper&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;book__cover&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/books/world-wide-waste.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;World Wide Waste: How Digital Is Killing Our Planet-and What We Can Do About It by Gerry McGovern &lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And here is the CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.book&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 30px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;perspective&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 400px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.book__wrapper&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotateY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;-30deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; preserve-3d&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; transform 1s ease&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.book__cover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #0d47a1aa&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;border-top-right-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;border-bottom-right-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5px 5px 20px #666&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.book__wrapper::before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fff&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;300px - 2 * 3px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;translateX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;200px - 50px / 2 - 3px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotateY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;90deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;translateX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50px / 2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.book__wrapper::after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;border-top-right-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;border-bottom-right-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #01060f&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;translateZ&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;-50px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; -10px 0 50px 10px #666&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;max-width: 400px;&quot;&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/img/3d-book-v1.png&quot; alt=&quot;Screenshot of the above demo showing the book World Wide Waste - How Digital Is Killing Our Planet-and What We Can Do About It by Gerry McGovern&quot;&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Demo: &lt;a href=&quot;https://jsbin.com/nuzaten/1/edit?html,css,output&quot;&gt;https://jsbin.com/nuzaten/1/edit?html,css,output&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;customize-via-css-custom-properties&quot;&gt;Customize via CSS custom properties &lt;a class=&quot;permalink&quot; href=&quot;#customize-via-css-custom-properties&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This looks already really great, so now enhance this and change the depth of the book based on the pages of the book.&lt;/p&gt;
&lt;p&gt;First let&#39;s define a range – I decided to increase the depth every 50 pages, starting from 50 pages and ending at 1000 pages.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--page-count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--page-count-range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;clamp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--page-count&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; / 50&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 20&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--page-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;10px * &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--page-count-range&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* only showing the updated stuff here */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.book__wrapper::before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--page-width&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;translateX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;200px - &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--page-width&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; / 2 - 3px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotateY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;90deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;translateX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--page-width&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; / 2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.book__wrapper::after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;translateZ&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--page-width&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; * -1&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let&#39;s go through this.&lt;/p&gt;
&lt;p&gt;First, we set three CSS custom properties whereas the first one defines the actual page count.&lt;/p&gt;
&lt;p&gt;In the second one it is getting interesting. There we use clamp() to define our minimum as 1 (50 pages or fewer), our preferred value (page count divided by 50) and a maximum of 20 (1000 pages or more).&lt;/p&gt;
&lt;p&gt;In the last property we multiply the range by 10px, so we can use that in our CSS for the transform and width properties that we need to adapt.&lt;/p&gt;
&lt;p&gt;If you open the &lt;a href=&quot;https://jsbin.com/dozadun/3/edit?html,css,output&quot;&gt;demo&lt;/a&gt; you can change the --page-count property to see how the depth changes. And that&#39;s it. With some small changes, the depth of the book is now reactive. CSS: What a wonderful language!&lt;/p&gt;
&lt;p&gt;That was a fun challenge and can&#39;t wait to share my book section where you will see this in action.&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Demo: &lt;a href=&quot;https://jsbin.com/dozadun/3/edit?html,css,output&quot;&gt;https://jsbin.com/dozadun/3/edit?html,css,output&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://scastiel.dev/posts/2020-07-23-animated-3d-book-css/&quot;&gt;Create an animated 3D book in CSS, step by step&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
				
			
			
				
				
			
			
			
			
			
				
							
						
						
						<item>
							<title> Loading and replacing HTML parts with HTML</title>
							<link>https://justmarkup.com/notes/2020-12-28-loading-and-replacing-html-parts-with-html/</link>
							<pubDate>2020-12-28T14:11:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-12-28-loading-and-replacing-html-parts-with-html/</guid>
							<description>&lt;p&gt;In the last weeks there has been another round of approaches about loading &lt;a href=&quot;https://hotwire.dev/&quot;&gt;HTML&lt;/a&gt; and &lt;a href=&quot;https://reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components.html&quot;&gt;server-rendered components&lt;/a&gt;. We had the option to only load and replace some parts of an HTML page for over &lt;a href=&quot;https://en.wikipedia.org/wiki/Ajax_(programming)&quot;&gt;20 years&lt;/a&gt; with JavaScript, and even longer by using &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frameset&quot;&gt;framesets&lt;/a&gt;. The idea is always the same, replace only some parts of HTML instead of loading everything again. There has been many approaches to load and replace parts of a document and there will be many more. This got me thinking again. What if we can do that with HTML properly. In this article I would like to describe an idea to load and replace HTML with HTML and why browsers could do it best.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I am probably not the first one thinking about such an approach, but I couldn&#39;t find any article describing. If you know about one, please let me &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;know&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-idea&quot;&gt;The idea &lt;a class=&quot;permalink&quot; href=&quot;#the-idea&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s get straight to the basic idea with an example:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/another-article.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#main&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Another article&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;main&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, if a user clicks on the link, there will be no page reload, instead the browser will fetch another-article.html, parse the HTML, look for the first element with the id of main, and replaces the content on the page the link was triggered.&lt;/p&gt;
&lt;p&gt;This means, by adding two attributes in our HTML to make a connection we can get SPA-like loading experiences. The browser will do the job, they would also replace the title of the page, not load any requests outside our target, take care of focus and browser history and probably also about caching and more.&lt;/p&gt;
&lt;p&gt;This feature should make simple things simple and also possible to achieve more complicated things, which I will explain later down.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; We would need another attribute, as using a value like &amp;quot;#main&amp;quot; for target currently opens the page in a new tab - which is not what we want as a fallback.&lt;/p&gt;
&lt;h2 id=&quot;let-the-browser-do-the-job&quot;&gt;Let the browser do the job &lt;a class=&quot;permalink&quot; href=&quot;#let-the-browser-do-the-job&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This can all be done already today using JavaScript, but to make this accessible and robust you need to take care of a lot of stuff and handle edge cases you might never think of. This is hard. Do you handle focus properly, do you update the title correctly, do you handle errors correctly and much more? So, why not let the browser to the job.&lt;/p&gt;
&lt;h2 id=&quot;accessibility-build-in&quot;&gt;Accessibility build-in &lt;a class=&quot;permalink&quot; href=&quot;#accessibility-build-in&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;HTML is accessible by default, at least &lt;a href=&quot;https://daverupert.com/2020/02/html-the-inaccessible-parts/&quot;&gt;mostly&lt;/a&gt;. This is a big advantage over any approach using JavaScript to replace HTML - doing it with JavaScript means you have to take care of accessibility for yourself, and it is easy to do it wrong. By using HTML it is less likely that we will mess it up, on top of it is also a lot more robust, if there are any JavaScript errors it will still work.&lt;/p&gt;
&lt;p&gt;There are a lot of intelligent people writing specifications and implementing this in browsers. They know their job and I have more trust in native features over any tool/library to make something accessible. It would make it also a lot easier for assistive technologies to adapt to this.&lt;/p&gt;
&lt;h2 id=&quot;easily-enhanceable&quot;&gt;Easily enhanceable &lt;a class=&quot;permalink&quot; href=&quot;#easily-enhanceable&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As said above I would like to make it as simple as possible to use this, but also give developers tools to handle more complicated use cases.&lt;/p&gt;
&lt;h3 id=&quot;enhance-with-javascript&quot;&gt;Enhance with JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#enhance-with-javascript&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;On top of the HTML part, there could be JavaScript events we can listen to. There could be an event when the fetch starts, one while the browser is loading and parsing the document and one once it is done.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; myElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;main&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;myElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;beforeload&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;The user triggered a change of the content&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;myElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;loading&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;The content is loading&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;myElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;loaded&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Successfully replaced the HTML of #main&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There may be even more events, but this would already make it possible to add transitions and animations and more and improve the loading experience even more.&lt;/p&gt;
&lt;h3 id=&quot;enhance-with-css&quot;&gt;Enhance with CSS &lt;a class=&quot;permalink&quot; href=&quot;#enhance-with-css&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Speaking of transitions and animations, why not also implement a new CSS pseudo-class on top of it.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;main:loading&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;blur&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;5px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;main:loading:before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Loading&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would make it very easy to implement the loading experience we are used from SPA today.&lt;/p&gt;
&lt;p&gt;We also may want to change the styling of the current active navigation item, so we could get another pseudo-class there as well, which will check the value of the href attribute and if it matches will apply the styles, something like:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;a:active-link&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; bold&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;enhance-with-request-header&quot;&gt;Enhance with request header &lt;a class=&quot;permalink&quot; href=&quot;#enhance-with-request-header&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You might wonder why my idea is based on the idea to fetch the whole document, and not only parts of it, say you have the full html and then only the HTML of main at another-article.content.html. This would require quite some changes to implement and not every developer might be able to generate two versions. The simple should be simple principle.&lt;/p&gt;
&lt;p&gt;The browser could however send a header for these types of links, say something like:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;link-target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #main&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This way developers could check for the header on the backend and only send back the HTML required.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token doctype&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span class=&quot;token name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Another article&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;main&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Another article&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Lorem&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would reduce the page load even more.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Does this make sense at all, or is it a bad idea? Please let me &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;know&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are of course many details missing here, but I really would like HTML to be more powerful, and I think showing other content without a full page reload is something people wanted for decades and will probably also want in the future, so it may be worth to see if we can do this in HTML.&lt;/p&gt;
&lt;p&gt;To be honest, I had to write this down, because I was thinking about this for way too long, and by writing it and publishing it, it is out of my head and I can focus on other things again.&lt;/p&gt;
&lt;p&gt;I would still like to follow-up on this and will open an issue about this in the &lt;a href=&quot;https://github.com/w3c/html&quot;&gt;GitHub repo&lt;/a&gt; of the W3C in the new year.&lt;/p&gt;
&lt;h2 id=&quot;references&quot;&gt;References &lt;a class=&quot;permalink&quot; href=&quot;#references&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Hotwire &lt;a href=&quot;https://hotwire.dev/&quot;&gt;https://hotwire.dev/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;React Server Components &lt;a href=&quot;https://reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components.html&quot;&gt;https://reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;HTML: The Inaccessible Parts &lt;a href=&quot;https://daverupert.com/2020/02/html-the-inaccessible-parts/&quot;&gt;https://daverupert.com/2020/02/html-the-inaccessible-parts/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Smaller HTML Payloads with Service Workers &lt;a href=&quot;https://philipwalton.com/articles/smaller-html-payloads-with-service-workers/&quot;&gt;https://philipwalton.com/articles/smaller-html-payloads-with-service-workers/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Too much noise</title>
							<link>https://justmarkup.com/notes/2020-11-13-too-much-noise/</link>
							<pubDate>2020-11-13T10:11:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-11-13-too-much-noise/</guid>
							<description>&lt;p&gt;On the 12th of November I decided to take a break from Twitter. I really enjoy the little bubble I have there, meet new people there, made new friends, and discovered lots of fantastic resources there. It also helps me to keep up-to-date with all the stuff happening in Frontend. The problem is that it is too much, the constant feeling of missing out if I don&#39;t check my Twitter feed for some time, the urge to contribute there. It more and more felt to me like a huge to-do list which grows and grows and will never be completed.&lt;/p&gt;
&lt;p&gt;It&#39;s all about engagement and social networks know how to play this game perfectly. I don&#39;t want to play this game any more.&lt;/p&gt;
&lt;p&gt;I am sure I will return to Twitter again, but first I have to find a cheat which works for me to be able to play there again. Maybe it will be screen-saving apps, which won&#39;t let me access twitter after I spend, say 30 minutes there a day, or something else. We will see.&lt;/p&gt;
&lt;p&gt;After one day I still have the reflex to open twitter, but I am logged out everywhere, and so I just see the login screen and close it again.&lt;/p&gt;
&lt;p&gt;In the meantime I really look forward to writing more here on my blog.&lt;/p&gt;
&lt;p&gt;Stay healthy and happy.&lt;/p&gt;
&lt;p&gt;If you want to get in touch, you can still reach me by good old &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Styling the details element</title>
							<link>https://justmarkup.com/articles/2020-09-22-styling-and-animation-details/</link>
							<pubDate>2020-09-22T07:11:10+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2020-09-22-styling-and-animation-details/</guid>
							<description>&lt;p&gt;I recently worked on a FAQ page, and as I like semantic and accessible HTML I chose to use the &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; element to show the questions and answers. The default styling of &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; is pretty okay, but the designer had something different in mind, and so I had to find ways to style it according to the design specification.&lt;/p&gt;
&lt;p&gt;In this article you will learn how to style the summary, change the default arrows, and how to animate the opening/closing.&lt;/p&gt;
&lt;h2 id=&quot;style-the-summary&quot;&gt;Style the summary &lt;a class=&quot;permalink&quot; href=&quot;#style-the-summary&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First I had to get rid of the default disclosure triangle.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;summary&amp;gt;&lt;/code&gt; element supports the list-style property, so to remove the default triangle we can use list-style: none; to remove it. In theory, we are done now, the icon is removed, and we can add our own icon. Unfortunately, Chromium-based browsers do not support list-style on the summary element, so we additionally have to use the non-standard &lt;code&gt;::-webkit-details-marker&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here is the CSS to remove the icon in all modern browsers:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;summary&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;list-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;summary::-webkit-details-marker&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this in place we can now add our own icons.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;details summary::before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;🡒&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;/* you can style it however you want, use background-image for example */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* By using [open] we can define different styles when the disclosure widget is open */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;details[open] summary::before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;🡑&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;animate-it&quot;&gt;Animate it &lt;a class=&quot;permalink&quot; href=&quot;#animate-it&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The next issue was that the designer didn&#39;t like the abrupt opening/closing. To achieve this, we need a way to transition the height of the content. As you may know, transition doesn&#39;t work for height: auto; and while there are some &lt;a href=&quot;https://css-tricks.com/using-css-transitions-auto-dimensions/&quot;&gt;workarounds&lt;/a&gt; to still achieve this in CSS, this won&#39;t work for &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To still achieve this we therefore need JavaScript and here is my attempt.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@keyframes&lt;/span&gt; slideDown&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;0%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-height-open&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;100%&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--details-transition-time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 400ms&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;details&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; all ease-out &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-transition-time&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-height-closed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;details[open]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-height-open&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;details div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; all ease-out &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-transition-time&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-content-height-closed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;animation-name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; slideDown&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;animation-duration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-transition-time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;details.is--open div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--details-content-height-open&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; details &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;details&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;details&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;detail&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; detailContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;div&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; detailClosedHeight &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollHeight&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// open the details to get the height of the content&lt;/span&gt;&lt;br&gt;  detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;open &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// pass it to the the element as CSS property&lt;/span&gt;&lt;br&gt;  detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--details-content-height-open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--details-height-open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; detailClosedHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// close the details again&lt;/span&gt;&lt;br&gt;  detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;open &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--details-content-height-closed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--details-height-closed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; detailClosedHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; container &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// get time of transition from CSS property&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; timeout &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;getComputedStyle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;container&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;div&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getPropertyValue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--details-transition-time&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// we can&#39;t use [open] as it will be only removed after the transition&lt;/span&gt;&lt;br&gt;    container&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toggle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is--open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;   &lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// remove the open attribute once the transition is done, because otherwise we won&#39;t see the transition&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;container&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;open&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        container&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;open &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;timeout&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Lets got through it line by line.&lt;/p&gt;
&lt;p&gt;First, let&#39;s get all details in the DOM and iterate over them.&lt;/p&gt;
&lt;p&gt;Next, we set the open attribute to true to get the actual height of the content, pass it to CSS using custom properties and remove the open attribute again.&lt;/p&gt;
&lt;p&gt;After that we create an eventListener for the details element.&lt;/p&gt;
&lt;p&gt;There we get the transition time defined in our CSS which we use further down.&lt;/p&gt;
&lt;p&gt;Next we toggle the class is--open, which we need in CSS to make the transition work, as we can&#39;t use the open attribute for this. The reason is, that if we would use the transition on [open] it will only work when opening it, but not when closing it, as the content will transition, but the details will already be closed by then.&lt;/p&gt;
&lt;p&gt;To avoid this, we set a timeout here with the value we set in CSS before via a custom property and remove the open attribute not before the transition is done.&lt;/p&gt;
&lt;p&gt;As an extra for Chromium we have to use CSS animation for the opening, as transition somehow doesn&#39;t work there. To get it also working in Safari, we need also transition the height of the details itself.&lt;/p&gt;
&lt;h2 id=&quot;reacting-to-preferences-and-screen-changes&quot;&gt;Reacting to preferences and screen changes &lt;a class=&quot;permalink&quot; href=&quot;#reacting-to-preferences-and-screen-changes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There is still some issue with this approach, if you resize the browser the height of the container will be either too small or too big.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;details&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;detail&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// ...code from above&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// this is the new part&lt;/span&gt;&lt;br&gt;  window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;resize&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// if the details is open, adjust height&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;detail&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is--open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--details-height-open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; detailContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To correct this, we listen on resize and if the details is currently open, we change the value of our CSS custom property, to adjust the height accordingly. This way the height of our details element is always as big as the content.&lt;/p&gt;
&lt;p&gt;As a final step let&#39;s reduce the transition time to 1ms if the user prefers reduced motion.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;prefers-reduced-motion&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; reduce&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;details div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;--details-transition-time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1ms&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this in place we are done. The details element is now styled to our liking and there is a transition when opening/closing it.&lt;/p&gt;
&lt;p&gt;You can find the final demo on &lt;a href=&quot;https://jsbin.com/wogeyey/1/edit?html,css,js,output&quot;&gt;JS Bin&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details&quot;&gt;MDN: details&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/using-css-transitions-auto-dimensions/&quot;&gt;Using CSS Transitions on Auto Dimensions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://caniuse.com/details&quot;&gt;Browser support for details&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Update 24.09.2020: &lt;a href=&quot;https://twitter.com/pepelsbey_&quot;&gt;Vadim Makeev&lt;/a&gt; pointed out that the opening transition is not working in Chrome and Safari. And while I was 100% sure it did work at least in Chrome, they were absolutely right and it didn&#39;t work. To fix this in Chrome I added the animation.&lt;/p&gt;
&lt;p&gt;Update 25.09.2020: Add workaround for Safari to transition also there the opening.&lt;/p&gt;
</description>
						</item>
				
			
			
				
				
			
			
				
							
						
						
						<item>
							<title> Better Image Description Browser Extension</title>
							<link>https://justmarkup.com/notes/2020-06-09-better-image-description-extensions/</link>
							<pubDate>2020-06-09T06:11:08+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-06-09-better-image-description-extensions/</guid>
							<description>&lt;p&gt;I sometimes run accessibility audits and one issue I almost always find is missing or insufficient alt text for images. Many of these images are from authors publishing the images via some sort of CMS.&lt;/p&gt;
&lt;p&gt;To make it easier for them and for everybody else to see if an image has insufficient alt text I created a &lt;a href=&quot;https://www.better-image-description.com/&quot;&gt;browser extension&lt;/a&gt; which lets you run a check on every website.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is meant for everybody and not only developers.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/img/better-image-desc1.PNG&quot; alt=&quot;A dialog showing one image from smashing-magazine.com (a cat) which has sufficient alt text &amp;quot;Smashing cat brewing a fresth, tasty capuccino&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot;&gt;Firefox &lt;a class=&quot;permalink&quot; href=&quot;#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There is a &lt;a href=&quot;https://addons.mozilla.org/de/firefox/addon/better-image-descriptions/&quot;&gt;Firefox extension&lt;/a&gt; available if you want to give it a try.&lt;/p&gt;
&lt;h2 id=&quot;chrome&quot;&gt;Chrome &lt;a class=&quot;permalink&quot; href=&quot;#chrome&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There is also a version for &lt;a href=&quot;https://chrome.google.com/webstore/detail/mmkgjkmlfjhebcfbpehoogdndcbllnlk/&quot;&gt;Chrome&lt;/a&gt; which will also work in most other Chromium-based browsers like the new Edge.&lt;/p&gt;
&lt;h2 id=&quot;current-checks&quot;&gt;Current checks &lt;a class=&quot;permalink&quot; href=&quot;#current-checks&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The following checks are currently covered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Missing alt attribute (error)&lt;/li&gt;
&lt;li&gt;Name of image is used as value for alt attribute (error)&lt;/li&gt;
&lt;li&gt;Only the word image is used for the alt attribute (error) - looking at you Twitter.&lt;/li&gt;
&lt;li&gt;Empty alt attribute (warning, one should check if only decorative)&lt;/li&gt;
&lt;li&gt;Image uses aria-hidden, aria-role=&amp;quot;presentation&amp;quot; or aria-role=&amp;quot;none&amp;quot; (warning, one should check if only decorative)&lt;/li&gt;
&lt;li&gt;Alt attribute uses the same text as the nearby headline. (warning)&lt;/li&gt;
&lt;li&gt;Alt attribute starts with &amp;quot;Image of&amp;quot; (warning)&lt;/li&gt;
&lt;li&gt;Alt attribute contains image extension (.jpg, .gif) (warning)&lt;/li&gt;
&lt;li&gt;Alt attribute contains two or fewer characters (warning)&lt;/li&gt;
&lt;li&gt;Image is only child of link (warning, alt should describe the link action)&lt;/li&gt;
&lt;/ul&gt;
&lt;img src=&quot;https://justmarkup.com/img/better-image-desc2.PNG&quot; style=&quot;width: 400px&quot; alt=&quot;The extension popup showing that 11 images where found, one error and one warning and a button to reset the check as well as a link to give feedback&quot;&gt;
&lt;p&gt;There will be more in the future, but it is a good start I think.&lt;/p&gt;
&lt;p&gt;If you have any feedback or checks I should add please let me know via &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt; or on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;Twitter&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The need for a web accessibility law</title>
							<link>https://justmarkup.com/notes/2020-05-27-accessibility-law/</link>
							<pubDate>2020-05-27T14:23:12+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-05-27-accessibility-law/</guid>
							<description>&lt;p&gt;Yesterday I was frustrated again that so many websites are still inaccessible, so as you do, I &lt;a href=&quot;https://twitter.com/justmarkup/status/1265180442107482113?s=20&quot; title=&quot;https://twitter.com/justmarkup/status/1265180442107482113?s=20&quot;&gt;tweeted&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;More and more convinced that the only way to improve accessibility of the web is to have laws.&lt;/p&gt;
&lt;p&gt;Laws written by accessibility experts in force in every country.&lt;/p&gt;
&lt;p&gt;GDPR, but done right.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As this got quite some replies, and as Twitter is a bad place to write about complex stuff, you can now read here why I think that we need a global web accessibility law.&lt;/p&gt;
&lt;h2 id=&quot;nobody-cares&quot;&gt;Nobody cares &lt;a class=&quot;permalink&quot; href=&quot;#nobody-cares&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By &amp;quot;nobody&amp;quot; I mean all the A holes not caring about accessibility. If you care and build accessible sites, you don&#39;t belong to this group and are a good person.&lt;/p&gt;
&lt;p&gt;The current analysis from &lt;a href=&quot;https://webaim.org/blog/webaim-million-one-year-update/&quot; title=&quot;https://webaim.org/blog/webaim-million-one-year-update/&quot;&gt;WebAIM&lt;/a&gt; (web accessibility in mind) about the state of web accessibility of the top one million websites shows that it got even worse as it was already before. Detectable WCAG (Web Content Accessibility Guidelines) failure rate rose from 97.8% to 98.1%.&lt;/p&gt;
&lt;p&gt;They found for example that 56% of the 3.4 million form inputs identified were unlabeled. This is so frustrating. Adding a label for form inputs is really not rocket science and there is no reason why you should not use a label.&lt;/p&gt;
&lt;p&gt;So, why are still so many sites shipped with these issues?&lt;/p&gt;
&lt;h2 id=&quot;learning&quot;&gt;Learning &lt;a class=&quot;permalink&quot; href=&quot;#learning&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you are able to develop a site with React, there is no reason you can not make it accessible. There are millions of resources out there - articles, videos, conference talks, code examples, tools... It is all there.&lt;/p&gt;
&lt;p&gt;Say you are looking for a new job, you open one of the job search sites and search for &amp;quot;frontend&amp;quot;. I just did this and got 6.565 jobs listed for Germany. Next, I used the advanced search and filtered all jobs which contains the word &amp;quot;accessibility&amp;quot; or the German translation &amp;quot;barrierefreiheit&amp;quot; - only 126 jobs were left. 98% of all frontend jobs currently listed don&#39;t require any sort of skills regarding accessibility. This also show how few companies care.&lt;/p&gt;
&lt;p&gt;Out of curiosity I also checked how many listings used &amp;quot;react&amp;quot; - 1.753 jobs.&lt;/p&gt;
&lt;p&gt;This is a big issue. To get a job you have better chances if you know react than by knowing about web accessibility.&lt;/p&gt;
&lt;p&gt;If you don&#39;t need accessibility to find a job, don&#39;t need it in your job, it is less likely you ever learn it.&lt;/p&gt;
&lt;p&gt;So, what can be done to make accessibility a requirement for all sites, to make it the standard?&lt;/p&gt;
&lt;h2 id=&quot;penalize-sites&quot;&gt;Penalize sites &lt;a class=&quot;permalink&quot; href=&quot;#penalize-sites&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We can write millions of more articles, publish thousands of more videos about accessibility, build hundreds of more examples and tell everyone why accessibility is not a feature but the standard way of building a site. In the end, people and companies are sill A holes and don&#39;t care.&lt;/p&gt;
&lt;p&gt;So, in my opinion, the only way to improve accessibility is by enforcing it.&lt;/p&gt;
&lt;h3 id=&quot;search-engines&quot;&gt;Search engines &lt;a class=&quot;permalink&quot; href=&quot;#search-engines&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Years ago, only a few sites used HTTPS. Even if using HTTPS would make a site more secure, most companies didn&#39;t care. This all changed when &lt;a href=&quot;https://security.googleblog.com/2014/08/https-as-ranking-signal_6.html&quot; title=&quot;https://security.googleblog.com/2014/08/https-as-ranking-signal_6.html&quot;&gt;Google&lt;/a&gt; announced that they will reward sites using HTTPS. Suddenly all sites switched to HTTPS. I remember various clients I tried to convince for month that they should HTTPS, they all refused to until the announcement – suddenly they wanted to switch as soon as possible.&lt;/p&gt;
&lt;p&gt;It clearly shows how much companies care about SEO. They don&#39;t use HTTPS now because they care about security, they do because they don&#39;t want to be penalized by search engines.&lt;/p&gt;
&lt;p&gt;If Google would announce that they will start penalizing inaccessible websites, I am sure all sites will do everything to make their sites accessible. Again, not because they care about their user, they only care that they will lose money.&lt;/p&gt;
&lt;h3 id=&quot;browsers&quot;&gt;Browsers &lt;a class=&quot;permalink&quot; href=&quot;#browsers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Similarly to search engines, browser can also influence how sites are build. For insecure HTTP sites, browser nowadays clearly show in the address bar that the site is not secure - you don&#39;t want to be that company having to tell users why their site is not secure.&lt;/p&gt;
&lt;p&gt;Browsers could also show a warning if a site is inaccessible. As nobody wants a warning when visiting a site, they again would start making their sites more accessible.&lt;/p&gt;
&lt;p&gt;Especially search engines could help to make the web more accessible. There is just one problem – unless with HTTPS, it is nearly impossible to automatically check if a site is accessible. Yet, they could check for color contrast, missing alt attributes, missing semantic, missing labels – this would already help a lot.&lt;/p&gt;
&lt;p&gt;Even, if search engines would introduce an accessibility ranking and browsers would start showing a warning for inaccessible sites, it may be not enough.&lt;/p&gt;
&lt;h2 id=&quot;a-new-law&quot;&gt;A new law &lt;a class=&quot;permalink&quot; href=&quot;#a-new-law&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Which brings us to the title of this article.&lt;/p&gt;
&lt;p&gt;As of today (May 2020), there are various Web &lt;a href=&quot;https://www.w3.org/WAI/policies/&quot;&gt;Accessibility Laws &amp;amp; Policies&lt;/a&gt; in place in various countries. The first issue here is that almost no country enforces the law they have, the other one is that they are country specific, the third one is that these laws are really hard to understand by average people.&lt;/p&gt;
&lt;h3 id=&quot;global&quot;&gt;Global &lt;a class=&quot;permalink&quot; href=&quot;#global&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As you may know, WWW means World Wide Web. There is no Austria Web, no South African Web, no Peru Web. So why should we have a law which only applies to one country. This makes no sense.&lt;/p&gt;
&lt;h3 id=&quot;by-experts&quot;&gt;By experts &lt;a class=&quot;permalink&quot; href=&quot;#by-experts&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The law has to be written by web accessibility experts, by people knowing everything about web accessibility.&lt;/p&gt;
&lt;p&gt;In addition, there has to be a version for us. A version which is understandable, a document you can actually read. This is really important.&lt;/p&gt;
&lt;h3 id=&quot;enforcement&quot;&gt;Enforcement &lt;a class=&quot;permalink&quot; href=&quot;#enforcement&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The law needs to be enforced. First it should apply to all government and public sites, later for all commercial sites.&lt;/p&gt;
&lt;h3 id=&quot;gdpr&quot;&gt;GDPR &lt;a class=&quot;permalink&quot; href=&quot;#gdpr&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Two years ago GDPR went into effect. Personally I don&#39;t have the feeling that my data are now more secure and more private. All the big tech companies still collect all the data they can get, the only thing that changed seems to be that we now have annoying cookie consent popups on every site. All hate these popups.&lt;/p&gt;
&lt;p&gt;I still don&#39;t know why they didn&#39;t use DNT (Do not track header) there. This would have been so much more user-friendly.&lt;/p&gt;
&lt;p&gt;Anyway, we should learn from GDPR and don&#39;t make the same mistakes when introducing an accessibility law.&lt;/p&gt;
&lt;p&gt;I have no idea how to write a law, but I think we really need one to make the web a better place.&lt;/p&gt;
&lt;p&gt;Being optimistic, I also think that we will never get such a law. But the chances are still better than hoping people will not be A holes anymore.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Read out loud - Text to speech with the Web Speech API.</title>
							<link>https://justmarkup.com/articles/2020-05-19-text-to-speech/</link>
							<pubDate>2020-05-19T04:31:10+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2020-05-19-text-to-speech/</guid>
							<description>&lt;p&gt;I recently added Text to speech for &lt;a href=&quot;https://app.writerie.com/&quot; title=&quot;https://app.writerie.com&quot;&gt;Writerie&lt;/a&gt; and here is what I learned about using the Web Speech API.&lt;/p&gt;
&lt;h2 id=&quot;check-for-support&quot;&gt;Check for support &lt;a class=&quot;permalink&quot; href=&quot;#check-for-support&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before using it we have to check if the browser &lt;a href=&quot;https://caniuse.com/#feat=speech-synthesis&quot; title=&quot;https://caniuse.com/#feat=speech-synthesis&quot;&gt;supports&lt;/a&gt; the Web Speech API. We can do this by using a feature test.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;speechSynthesis&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Great, browser supports the Web Speech API - let&#39;s use it&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;voices&quot;&gt;Voices &lt;a class=&quot;permalink&quot; href=&quot;#voices&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;With that in place, we can now start using it. First, let&#39;s see how to get all available voices.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;speechSynthesis&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getVoices&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The available voices differ quite a lot between browser and OS. On Microsoft and also on the new Edge on Mac you will get specific Microsoft voices, on all Google browsers you get Google voices and in some like the Yandex browser you will only get one native voice. For me personally the Microsoft voices sound much less robotic as others.&lt;/p&gt;
&lt;p&gt;One thing to note here is that on Chrome you will get an empty list if you call &lt;code&gt;getVoices()&lt;/code&gt; directly. This is because when a page is loaded, it takes some amount of time to populate the voices array as it does so, asynchronously. If you need to get the voices on page load you can work around this by calling getVoices() after a timeout of some milliseconds (50 seems safe) or by using a Promise. If you call it after a user interaction you should be fine, as at this point it should already be populated.&lt;/p&gt;
&lt;h2 id=&quot;utterance&quot;&gt;Utterance &lt;a class=&quot;permalink&quot; href=&quot;#utterance&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next, let&#39;s have a look at &lt;code&gt;SpeechSynthesisUtterance&lt;/code&gt;, which represents a speech request.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; utterance &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SpeechSynthesisUtterance&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; voice &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;speechSynthesis&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getVoices&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;// Utterance properties&lt;/span&gt;&lt;br&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;My text&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;voice &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; voice&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pitch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;rate &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;volume &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can define what text should be spoken, what voice should be used, and the pitch, rate and volume.&lt;/p&gt;
&lt;p&gt;If you don&#39;t define a voice it will use the first voice in the &lt;code&gt;getVoices()&lt;/code&gt; array. For pitch, rate and volume the default values are 1.&lt;/p&gt;
&lt;p&gt;Text is empty by default, and can either be set via &lt;code&gt;new SpeechSynthesisUtterance().text&lt;/code&gt; or directly by using &lt;code&gt;new SpeechSynthesisUtterance(&#39;My text&#39;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note that the maximum length of the text that can be spoken in each utterance is 32,767 characters.&lt;/p&gt;
&lt;h2 id=&quot;speak%2C-pause%2C-resume%2C-cancel&quot;&gt;Speak, pause, resume, cancel &lt;a class=&quot;permalink&quot; href=&quot;#speak%2C-pause%2C-resume%2C-cancel&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now, let&#39;s see how to speak out our defined text. This can be done by calling &lt;code&gt;.speak()&lt;/code&gt; and passing our defined utterance.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;speechSynthesis&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;speak&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The text will now be spoken with all the settings you defined for the utterance.&lt;/p&gt;
&lt;p&gt;To pause the text use &lt;code&gt;window.speechSynthesis.pause();&lt;/code&gt; to resume from there &lt;code&gt;window.speechSynthesis.resume();&lt;/code&gt; and to cancel it completely use &lt;code&gt;window.speechSynthesis.cancel();&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;breaks&quot;&gt;Breaks &lt;a class=&quot;permalink&quot; href=&quot;#breaks&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you pass a text it will be spoken one sentence after another. While it makes a small break after every dot, line breaks are ignored, to force a break you can however use a comma (,). Here is a simple example to replace all line breaks with a comma for a break.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; text&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;nn&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;, &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;chrome-bug&quot;&gt;Chrome bug &lt;a class=&quot;permalink&quot; href=&quot;#chrome-bug&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I initially tested in Firefox, where everything worked perfect. When I tried it in Chrome though, it always stopped after some seconds and it took me some time to realize it is a browser bug and not a bug in my code.&lt;/p&gt;
&lt;p&gt;In &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=679437&quot; title=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=679437&quot;&gt;Chrome on Windows and Ubuntu&lt;/a&gt;, it always stops after about 15 seconds. To work around this, one have to create an interval which runs every 14 seconds and checks if it is still active.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; synthesis &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;speechSynthesis&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; utterance &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SpeechSynthesisUtterance&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Hello&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; isPlaying &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;synthesis&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;speak&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;isPlaying &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;// somehow chrome stops after 14seconds, so resume from there&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; synthesisInterval &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;setInterval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;isPlaying&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token function&quot;&gt;clearInterval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;synthesisInterval&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        synthesis&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;resume&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;14000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;utterance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onend&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    isPlaying &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo &lt;a class=&quot;permalink&quot; href=&quot;#demo&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I put the code for the demo on &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/text-to-speech/index.html&quot; title=&quot;https://github.com/justmarkup/demos/blob/gh-pages/text-to-speech/index.html&quot;&gt;Github&lt;/a&gt; and you can also directly try the &lt;a href=&quot;https://justmarkup.com/demos/text-to-speech/&quot; title=&quot;https://justmarkup.com/demos/text-to-speech/&quot;&gt;demo&lt;/a&gt; here.&lt;/p&gt;
&lt;p&gt;You should also try it out in &lt;a href=&quot;https://app.writerie.com/&quot; title=&quot;https://app.writerie.com&quot;&gt;Writerie&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Text to speech is a great enhancement. People often prefer to listen instead of reading and by using the Web Speech API we can offer that with little effort.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Written with Writerie</title>
							<link>https://justmarkup.com/notes/2020-04-23-hello-writerie/</link>
							<pubDate>2020-04-23T10:38:12+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-04-23-hello-writerie/</guid>
							<description>&lt;p&gt;Earlier this week I finally launched &lt;a href=&quot;https://app.writerie.com/&quot;&gt;Writerie&lt;/a&gt; – a distraction free writing tool. Here is my story why I build it, what it is and what the future will be for Writerie.&lt;/p&gt;
&lt;h2 id=&quot;background&quot;&gt;Background &lt;a class=&quot;permalink&quot; href=&quot;#background&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I first started to build a writing tool in summer 2017, because I wanted a place where I could store all my documents and articles and not being tracked. Until this point I mostly just used my code editor to write in Markdown, but this meant I couldn&#39;t edit them on the phone or if I don&#39;t have my laptop with me. The first version was very basic and was missing a lot of things, but it did the job for me.&lt;/p&gt;
&lt;p&gt;Time went by and I rarely made changes here and there. Until Autumn 2019, when I wanted to finally make it more usable. At this point I restarted the project with the goal to launch it in 2020 and make it usable to others as well. What followed were months of work.&lt;/p&gt;
&lt;h2 id=&quot;status-quo&quot;&gt;Status Quo &lt;a class=&quot;permalink&quot; href=&quot;#status-quo&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I had thousands of features planned, but also knew that I should first start with a Minimum Viable Product, before having built hundreds of features nobody wants.&lt;/p&gt;
&lt;p&gt;On top of accessible and privacy friendly which I don&#39;t see as features but as a given for every project I wanted to have the option to use plain Markdown to write, but also to have a Rich Text Editor for things like a table which I still find harder to do in Markdown than via a User Interface. So I build it this way that you can switch every time between the two modes.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/img/writerie-2.png&quot; alt=&quot;The Writer in Markdown Mode&quot;&gt;&lt;/p&gt;
&lt;p&gt;Another feature I wanted to have is a better integration of links (resources). You can easily add links to Writerie and later use them in any document. Links are regularly unreachable after some time, so in Writerie we check all links if they are still reachable and show you a warning if not.&lt;/p&gt;
&lt;p&gt;We also generate an automatic outline for you, so you have a better overview on longer documents.&lt;/p&gt;
&lt;p&gt;One of the last things I implemented were comments. This makes it possible to add a comment for every text snippet. It works in Markdown and in WYSIWG Mode and we also added to option to include or exclude them in the export (we support PDF, HTML and Markdown for now). Thanks to &lt;a href=&quot;https://twitter.com/heydonworks/status/1238359513662656512?s=20&quot;&gt;Heydon Pickering&lt;/a&gt; for proposing it.&lt;/p&gt;
&lt;p&gt;It also supports Dark/Light Mode of course.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/img/writerie-1.png&quot; alt=&quot;The Writer in Dark Mode&quot;&gt;&lt;/p&gt;
&lt;p&gt;On 21. April I finally launched the site. It is not perfect, but it is a start. Yes, we are in a pandemic right now and I have thought a lot about postponing the launch to later this year or even next year, but as &lt;a href=&quot;https://twitter.com/cameronmoll/status/1239971692144807938&quot;&gt;Cameron Moll&lt;/a&gt; said:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Deploying in the middle of a pandemic seems so unimportant at the moment. Or maybe there&#39;s no better time for it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;the-future&quot;&gt;The Future &lt;a class=&quot;permalink&quot; href=&quot;#the-future&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are a lot more features I want to integrate in the future, but I also want to build things people want, and not things I think people want, so there is a &lt;a href=&quot;https://app.writerie.com/page/roadmap&quot;&gt;Roadmap&lt;/a&gt; where users can propose new features and vote on features proposed by others.&lt;/p&gt;
&lt;p&gt;One of the next things I will integrate is Text to Speech – hearing the text you wrote often helps a lot to find errors and improve the writing style.&lt;/p&gt;
&lt;p&gt;Some other features I have in mind are collaboration, implement a tool to &lt;a href=&quot;https://alexjs.com/&quot;&gt;catch insensitive, inconsiderate writing&lt;/a&gt;, integration with Static Site Generators and much more. Really looking forward to seeing how Writerie will involve in the months and years to come.&lt;/p&gt;
&lt;p&gt;What features would you like to see in Writerie? Please let me know via &lt;a href=&quot;mailto:support@writerie.com&quot;&gt;Email&lt;/a&gt; or via &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;Twitter DM&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://app.writerie.com/&quot;&gt;Give Writerie a try&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> 100 days - 100 CSS properties in a tweet</title>
							<link>https://justmarkup.com/articles/2020-04-15-css-property-in-a-tweet/</link>
							<pubDate>2020-04-15T05:51:20+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2020-04-15-css-property-in-a-tweet/</guid>
							<description>&lt;p&gt;At the beginning of the year I thought it may be fun to tweet about a CSS property for 100 days in a row. Before I started I wasn&#39;t really sure if there are even so many different CSS properties, but I soon realized there are much more, especially if you count all the long-hand properties as separate properties. Or did you know that there are &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference#Keyword_index&quot;&gt;61 properties&lt;/a&gt; starting with border?&lt;/p&gt;
&lt;p&gt;I have to say I learned quite a lot about CSS the last 100 days, many of the properties I have never used before or even never heard before. It is pretty incredible how CSS involved over all the years. I also have to say that it is fantastic to have &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS&quot;&gt;MDN&lt;/a&gt; as a reference available. You can learn so much by looking things up there.&lt;/p&gt;
&lt;p&gt;So, without further ado here is the full list of properties I tweeted about.&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 1: outline:&lt;br&gt;&lt;br&gt;- Shorthand for outline-style, outline-width, and outline-color&lt;br&gt;- Doesn&amp;#39;t take up space, unlike border&lt;br&gt;- All sides same style, no eg. outline-bottom &lt;br&gt;&lt;br&gt;ℹ️ Never set outline: none; unless you provide alternative styles.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/utFCUb6hQz&quot;&gt;https://t.co/utFCUb6hQz&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/YmlkCsB0IB&quot;&gt;pic.twitter.com/YmlkCsB0IB&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1214175924217950208?ref_src=twsrc%5Etfw&quot;&gt;January 6, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 2: font-size-adjust&lt;br&gt;&lt;br&gt;- How font size should be chosen based on the height of lowercase.&lt;br&gt;- Set size of fallback fonts (less FOUC)&lt;br&gt;&lt;br&gt;ℹ️ Not well supported, so recommend &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/T8NyGx2ifn&quot;&gt;https://t.co/T8NyGx2ifn&lt;/a&gt; for now to set size of fallback fonts&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/sFpo4rFck6&quot;&gt;https://t.co/sFpo4rFck6&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/WDJgT78sFp&quot;&gt;pic.twitter.com/WDJgT78sFp&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1214500162439127047?ref_src=twsrc%5Etfw&quot;&gt;January 7, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 3: transform&lt;br&gt;&lt;br&gt;- Rotate, scale, skew, or translate an element.&lt;br&gt;- If value is not none creates a stacking context.&lt;br&gt;- Perfect for performant animation. &lt;br&gt;&lt;br&gt;ℹ️ When using in animation make use of the prefers-reduced-motion media feature&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/zGLWTRfb8Q&quot;&gt;https://t.co/zGLWTRfb8Q&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/up4M6TWO9w&quot;&gt;pic.twitter.com/up4M6TWO9w&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1214843763161481217?ref_src=twsrc%5Etfw&quot;&gt;January 8, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 4: display&lt;br&gt;&lt;br&gt;- Sets whether an element is treated as a block or inline element and the layout used for its children, such as flow layout, grid or flex.&lt;br&gt;&lt;br&gt;Too many values to fit in a tweet 😁&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/N38gILb57V&quot;&gt;https://t.co/N38gILb57V&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/l2hr19mns0&quot;&gt;pic.twitter.com/l2hr19mns0&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1215216492779917314?ref_src=twsrc%5Etfw&quot;&gt;January 9, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 5: clip-path&lt;br&gt;&lt;br&gt;- Creates a clipping region that sets what part of an element should be shown&lt;br&gt;- You can use svg (eg. url(a.svg#b);), shape values (eg. circle(50px at 0 100px)) and geometry-box values eg. margin-box)&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/V4CrKbieg9&quot;&gt;https://t.co/V4CrKbieg9&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/tT2CV5kH82&quot;&gt;pic.twitter.com/tT2CV5kH82&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1215596914252681216?ref_src=twsrc%5Etfw&quot;&gt;January 10, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 6: box-sizing&lt;br&gt;&lt;br&gt;- Sets how the total width and height of an element is calculated.&lt;br&gt;&lt;br&gt;/* Reset, so an element&amp;#39;s specified width and height aren&amp;#39;t affected by padding or borders */&lt;br&gt;*,&lt;br&gt;*::before,&lt;br&gt;*::after {&lt;br&gt; box-sizing: border-box;&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/LYRZIk1lBI&quot;&gt;https://t.co/LYRZIk1lBI&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1215916337194774529?ref_src=twsrc%5Etfw&quot;&gt;January 11, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 7: position&lt;br&gt;&lt;br&gt;- Sets how an element is positioned&lt;br&gt;- Possible values are relative, absolute, fixed, sticky and static&lt;br&gt;&lt;br&gt;ℹ️ Use absolute, fixed and sticky positioned elements carefully, as they may be problematic for keyboard users.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/UBFoy6p4ke&quot;&gt;https://t.co/UBFoy6p4ke&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1216283482302840832?ref_src=twsrc%5Etfw&quot;&gt;January 12, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 8: all&lt;br&gt;&lt;br&gt;- Resets all of an element&amp;#39;s properties (except unicode-bidi and direction)&lt;br&gt;- Set properties to their initial or inherited values, or to the values specified in another stylesheet origin &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/59MGEEG3nP&quot;&gt;https://t.co/59MGEEG3nP&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/croTcFXSQD&quot;&gt;pic.twitter.com/croTcFXSQD&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1216664333096292353?ref_src=twsrc%5Etfw&quot;&gt;January 13, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 9: border-image&lt;br&gt;&lt;br&gt;- Draws an image around an element. Replaces the element&amp;#39;s regular border.&lt;br&gt;- You can use linear-gradient or an image source.&lt;br&gt;&lt;br&gt;ℹ️ Always define a border-style as fallback in case the border image fails to load.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/NUOCA9u9gH&quot;&gt;https://t.co/NUOCA9u9gH&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/fPpGfDfgAK&quot;&gt;pic.twitter.com/fPpGfDfgAK&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1217009646218752000?ref_src=twsrc%5Etfw&quot;&gt;January 14, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 10: font&lt;br&gt;&lt;br&gt;- Shorthand for font-style, font-variant, font-weight, font-stretch, font-size, line-height, font-family&lt;br&gt;- Alternatively, sets an element&amp;#39;s font to a system font&lt;br&gt;&lt;br&gt;ℹ️ Nobody* knows the correct order for the font property&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/XELaH2zRRR&quot;&gt;https://t.co/XELaH2zRRR&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1217355540944379910?ref_src=twsrc%5Etfw&quot;&gt;January 15, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 11: animation-play-state&lt;br&gt;&lt;br&gt;- Sets whether an animation is running or paused.&lt;br&gt;&lt;br&gt;ℹ️ When you set it to paused and after again to running it will start the animation from where it left off at the time it was paused&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/wyvCnNBVsk&quot;&gt;https://t.co/wyvCnNBVsk&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1217723406000513026?ref_src=twsrc%5Etfw&quot;&gt;January 16, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 13: caption-side&lt;br&gt;&lt;br&gt;- Puts the content of a table&amp;#39;s &amp;lt;caption&amp;gt; on the specified side. The values are relative to the writing-mode of the table&lt;br&gt;- Currently supported values are either top or bottom&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/oCJ5CvSwUm&quot;&gt;https://t.co/oCJ5CvSwUm&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1218483750654357504?ref_src=twsrc%5Etfw&quot;&gt;January 18, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 14: background-attachment&lt;br&gt;&lt;br&gt;- Sets whether a background image&amp;#39;s position is fixed within the viewport, or scrolls with its containing block&lt;br&gt;- Possible values are scroll, local, fixed&lt;br&gt;&lt;br&gt;ℹ️ Was already available in IE4 (scroll, fixed)&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/537iNB8zkd&quot;&gt;https://t.co/537iNB8zkd&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1218801496722169856?ref_src=twsrc%5Etfw&quot;&gt;January 19, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 15: animation-delay&lt;br&gt;&lt;br&gt;- Sets when an animation starts.&lt;br&gt;&lt;br&gt;ℹ️ If you provide a negative value the animation begins immediately, but partway through its cycle&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/T7oLmBqmSG&quot;&gt;https://t.co/T7oLmBqmSG&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1219165804991799296?ref_src=twsrc%5Etfw&quot;&gt;January 20, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 16: text-combine-upright&lt;br&gt;&lt;br&gt;- Sets the combination of characters into the space of a single character. &lt;br&gt;&lt;br&gt;ℹ️ This is used to produce an effect that is known as tate-chū-yoko (縦中横) in Japanese, or as 直書橫向 in Chinese.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/WphlZmZaDB&quot;&gt;https://t.co/WphlZmZaDB&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1219565680170799104?ref_src=twsrc%5Etfw&quot;&gt;January 21, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 17: padding-block-end&lt;br&gt;&lt;br&gt;- Defines logical block end padding of an element, which maps to a physical padding depending on the element&amp;#39;s writing mode&lt;br&gt;&lt;br&gt;ℹ️ To also support old Edge and IE use PostCSS or similiar &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/xlQ1JhsaKD&quot;&gt;https://t.co/xlQ1JhsaKD&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/xwBMV5SuTP&quot;&gt;https://t.co/xwBMV5SuTP&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1219899591765655554?ref_src=twsrc%5Etfw&quot;&gt;January 22, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 18: font-kerning&lt;br&gt;&lt;br&gt;- Sets the use of the kerning information stored in a font.&lt;br&gt;&lt;br&gt;ℹ️ In well-kerned fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/gMdW6u4dhN&quot;&gt;https://t.co/gMdW6u4dhN&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/KRds5rPPJM&quot;&gt;pic.twitter.com/KRds5rPPJM&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1220245420045225984?ref_src=twsrc%5Etfw&quot;&gt;January 23, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 19: columns&lt;br&gt;&lt;br&gt;- Sets the column width and column count of an element.&lt;br&gt;- It is a shorthand property that sets both the column-width and column-count properties in a single, convenient declaration.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/IL4I2i7knx&quot;&gt;https://t.co/IL4I2i7knx&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ygo9ouh5xy&quot;&gt;pic.twitter.com/ygo9ouh5xy&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1220648920939929600?ref_src=twsrc%5Etfw&quot;&gt;January 24, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 20: justify-content&lt;br&gt;&lt;br&gt;- Defines how the browser distributes space between and around content items along the main-axis of a flex container, and the inline axis of a grid container.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/tbOuTMokao&quot;&gt;https://t.co/tbOuTMokao&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/DRfkPgUe3d&quot;&gt;pic.twitter.com/DRfkPgUe3d&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1220983314565210113?ref_src=twsrc%5Etfw&quot;&gt;January 25, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 21: right&lt;br&gt;&lt;br&gt;- Participates in specifying the horizontal position of a positioned element.&lt;br&gt;&lt;br&gt;ℹ️ When both left and right are defined, if not prevented from doing so by other properties, the element will stretch to satisfy both.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/SS7M3cJHmr&quot;&gt;https://t.co/SS7M3cJHmr&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1221320659059531776?ref_src=twsrc%5Etfw&quot;&gt;January 26, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 22: text-shadow&lt;br&gt;&lt;br&gt;- Adds shadows to text.&lt;br&gt;&lt;br&gt;ℹ️ When more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/IrNuESkzOZ&quot;&gt;https://t.co/IrNuESkzOZ&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/BQ1N6nnie3&quot;&gt;pic.twitter.com/BQ1N6nnie3&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1221709561947660288?ref_src=twsrc%5Etfw&quot;&gt;January 27, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 23: list-style-image&lt;br&gt;&lt;br&gt;- Sets an image to be used as the list item marker.&lt;br&gt;&lt;br&gt;ℹ️ Be aware, you can&amp;#39;t define the size of the used image here with CSS.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/Ttl5OgRJnp&quot;&gt;https://t.co/Ttl5OgRJnp&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/1Vn4j3ZHLU&quot;&gt;pic.twitter.com/1Vn4j3ZHLU&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1222053569257529344?ref_src=twsrc%5Etfw&quot;&gt;January 28, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 24: white-space&lt;br&gt;&lt;br&gt;- Sets how white space inside an element is handled.&lt;br&gt;&lt;br&gt;ℹ️ To make words break within themselves, use overflow-wrap, word-break, or hyphens instead.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/88uhqyOnRE&quot;&gt;https://t.co/88uhqyOnRE&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1222411091088695297?ref_src=twsrc%5Etfw&quot;&gt;January 29, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 25: scroll-behavior&lt;br&gt;&lt;br&gt;- Sets the behavior for a scrolling box when scrolling is triggered by the navigation or CSSOM scrolling APIs&lt;br&gt;&lt;br&gt;ℹ️ Note that any other scrolls, eg. those performed by the user, are not affected by this property&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/GnIbDgvOci&quot;&gt;https://t.co/GnIbDgvOci&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1222786086621106176?ref_src=twsrc%5Etfw&quot;&gt;January 30, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 26: max-height&lt;br&gt;&lt;br&gt;- Sets the maximum height of an element&lt;br&gt;- Prevents the height property from becoming larger than the value specified for max-height.&lt;br&gt;&lt;br&gt;ℹ️ Often used to transition height, as to height: auto not possible&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/kTtWBBjUij&quot;&gt;https://t.co/kTtWBBjUij&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1223148031891189761?ref_src=twsrc%5Etfw&quot;&gt;January 31, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 27: block-size&lt;br&gt;&lt;br&gt;- Defines the horizontal or vertical size of an element&amp;#39;s block, depending on its writing mode. &lt;br&gt;&lt;br&gt;ℹ️ It corresponds to either the width or the height property, depending on the value of writing-mode.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/NjupUrEcq1&quot;&gt;https://t.co/NjupUrEcq1&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/k6HHYeUNf7&quot;&gt;pic.twitter.com/k6HHYeUNf7&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1223525960311627776?ref_src=twsrc%5Etfw&quot;&gt;February 1, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 28: text-indent&lt;br&gt;&lt;br&gt;- Sets the length of empty space (indentation) that is put before lines of text in a block&lt;br&gt;&lt;br&gt;ℹ️ Often used to visually hide content (text-indent: -10000px;) - Better use an alternative &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/fAh536rVkv&quot;&gt;https://t.co/fAh536rVkv&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ujqoSG4Rzl&quot;&gt;https://t.co/ujqoSG4Rzl&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/fCPVc8n49q&quot;&gt;pic.twitter.com/fCPVc8n49q&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1223896890393137152?ref_src=twsrc%5Etfw&quot;&gt;February 2, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 29: justify-items&lt;br&gt;&lt;br&gt;- Defines the default justify-self for all items of the box&lt;br&gt;&lt;br&gt;ℹ️ In flexbox layouts, this property is ignored&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ayVvQ3E7Lz&quot;&gt;https://t.co/ayVvQ3E7Lz&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1224233308457926656?ref_src=twsrc%5Etfw&quot;&gt;February 3, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 30: scale&lt;br&gt;&lt;br&gt;- Allows you to specify scale transforms individually and independantly of the transform property&lt;br&gt;&lt;br&gt;ℹ️ One/two values for scale along X and Y axes, by using three values last will be for the Z axis (same as scale3d())&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ZCn4Wcks6E&quot;&gt;https://t.co/ZCn4Wcks6E&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1224585057161162754?ref_src=twsrc%5Etfw&quot;&gt;February 4, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 31: animation-direction&lt;br&gt;&lt;br&gt;- Sets whether an animation should play forwards, backwards, or alternating back and forth.&lt;br&gt;&lt;br&gt;ℹ️ Possible values are normal, reverse, alternate and alternate-reverse&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/CrJTSFegGx&quot;&gt;https://t.co/CrJTSFegGx&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1224960697982967808?ref_src=twsrc%5Etfw&quot;&gt;February 5, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 32: mix-blend-mode&lt;br&gt;&lt;br&gt;- Sets how an element&amp;#39;s content should blend with the content of the element&amp;#39;s parent and the element&amp;#39;s background.&lt;br&gt;&lt;br&gt;ℹ️ Creative demo: &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/kzg2mw9yAJ&quot;&gt;https://t.co/kzg2mw9yAJ&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/WJYOEPh7Ue&quot;&gt;https://t.co/WJYOEPh7Ue&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1225317413551591425?ref_src=twsrc%5Etfw&quot;&gt;February 6, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 33: text-orientation&lt;br&gt;&lt;br&gt;- Sets the orientation of the text characters in a line.&lt;br&gt;- It only affects text in vertical mode (when writing-mode is not horizontal-tb).&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/grMRAZ2D8C&quot;&gt;https://t.co/grMRAZ2D8C&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1225677478762438659?ref_src=twsrc%5Etfw&quot;&gt;February 7, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 34: letter-spacing&lt;br&gt;&lt;br&gt;- Sets the spacing behavior between text characters.&lt;br&gt;&lt;br&gt;ℹ️ Applying negative letter spacing to headings makes them more compact and closer in appearance to the body type. &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/r5D5TdRDnH&quot;&gt;https://t.co/r5D5TdRDnH&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1226044047904690177?ref_src=twsrc%5Etfw&quot;&gt;February 8, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 35: content&lt;br&gt;&lt;br&gt;- Replaces an element with a generated value&lt;br&gt;- Applies to ::before and ::after pseudo-elements&lt;br&gt;&lt;br&gt;ℹ️ Be aware that some screen reader announce the text &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/lKya6R4kQn&quot;&gt;https://t.co/lKya6R4kQn&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/4ZjZXL8LeD&quot;&gt;https://t.co/4ZjZXL8LeD&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1226441812010770433?ref_src=twsrc%5Etfw&quot;&gt;February 9, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 36: hyphens&lt;br&gt;&lt;br&gt;- Specifies how words should be hyphenated when text wraps across multiple lines.&lt;br&gt;&lt;br&gt;ℹ️ Hyphenation does vary from browser to browser and language support varies quite a lot between them. &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/PorF3qmsfP&quot;&gt;https://t.co/PorF3qmsfP&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1226761930163007488?ref_src=twsrc%5Etfw&quot;&gt;February 10, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 37: object-fit&lt;br&gt;&lt;br&gt;- Sets how the content of a replaced element, such as an &amp;lt;img&amp;gt; or &amp;lt;video&amp;gt;, should be resized to fit its container&lt;br&gt;&lt;br&gt;ℹ️ It&amp;#39;s one of the properties I somehow always forget the name and have to look it up.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/bgGuCwUkwH&quot;&gt;https://t.co/bgGuCwUkwH&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1227127353236742144?ref_src=twsrc%5Etfw&quot;&gt;February 11, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 38: caret-color&lt;br&gt;&lt;br&gt;- Sets the color of the insertion caret, the visible marker where the next character typed will be inserted. &lt;br&gt;&lt;br&gt;ℹ️ The caret is typically a thin vertical line that flashes to help make it more noticeable.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/BwwdaVmdvi&quot;&gt;https://t.co/BwwdaVmdvi&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1227483447926632459?ref_src=twsrc%5Etfw&quot;&gt;February 12, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 39: scroll-margin&lt;br&gt;&lt;br&gt;- Is a shorthand property which sets all of the scroll-margin longhands,&lt;br&gt;&lt;br&gt;ℹ️ The value specified for scroll-margin determines how much of the page that&amp;#39;s primarily outside the snapport should remain visible.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ZBB8PmFnCD&quot;&gt;https://t.co/ZBB8PmFnCD&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1227851227314184192?ref_src=twsrc%5Etfw&quot;&gt;February 13, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 40: resize&lt;br&gt;&lt;br&gt;- Sets whether an element is resizable, and if so, in which directions.&lt;br&gt;&lt;br&gt;ℹ️ You shouldn&amp;#39;t use resize: none; for textarea &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/wiLKtbIunh&quot;&gt;https://t.co/wiLKtbIunh&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/USYjrWZItZ&quot;&gt;https://t.co/USYjrWZItZ&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1228214651814416386?ref_src=twsrc%5Etfw&quot;&gt;February 14, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 41: background-blend-mode&lt;br&gt;&lt;br&gt;- Sets how an element&amp;#39;s background images should blend with each other and with the element&amp;#39;s background color.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/QBVLLmS2S1&quot;&gt;https://t.co/QBVLLmS2S1&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/aqV3isCvCY&quot;&gt;pic.twitter.com/aqV3isCvCY&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1228631229211271170?ref_src=twsrc%5Etfw&quot;&gt;February 15, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 42: isloation&lt;br&gt;&lt;br&gt;-Determines whether an element must create a new stacking context.&lt;br&gt;&lt;br&gt;ℹ️ This property is especially helpful when used in conjunction with mix-blend-mode.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/yvW3kujQ44&quot;&gt;https://t.co/yvW3kujQ44&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1228974826146193408?ref_src=twsrc%5Etfw&quot;&gt;February 16, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 43: text-decoration-thickness&lt;br&gt;&lt;br&gt;- Sets the thickness, or width, of the decoration line that is used on text in an element, such as a line-through, underline, or overline.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/JkWuUFXCRU&quot;&gt;https://t.co/JkWuUFXCRU&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1229307544721674240?ref_src=twsrc%5Etfw&quot;&gt;February 17, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 44: direction&lt;br&gt;&lt;br&gt;- Sets the direction of text, table columns, and horizontal overflow. &lt;br&gt;&lt;br&gt;ℹ️ Note that text direction is usually defined within a document (e.g. dir attribute) rather than through direct use of the direction property.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/CCMA49D01C&quot;&gt;https://t.co/CCMA49D01C&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1229699445576650752?ref_src=twsrc%5Etfw&quot;&gt;February 18, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 45: translate&lt;br&gt;&lt;br&gt;- Allows you to specify translation transforms individually and independently of the transform property.&lt;br&gt;&lt;br&gt;ℹ️ Currently only supported in Firefox, but others will follow soon hopefully.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/sxpsbri2jp&quot;&gt;https://t.co/sxpsbri2jp&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1230013174176518144?ref_src=twsrc%5Etfw&quot;&gt;February 19, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 46: background-position&lt;br&gt;&lt;br&gt;- Sets the initial position for each background image. &lt;br&gt;- It is relative to the position layer set by background-origin.&lt;br&gt;&lt;br&gt;Note: You can&amp;#39;t position background-color.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/zYhVYjn1Q7&quot;&gt;https://t.co/zYhVYjn1Q7&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1230388464178298880?ref_src=twsrc%5Etfw&quot;&gt;February 20, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 47: text-justify&lt;br&gt;&lt;br&gt;- Sets what type of justification should be applied to text when text-align: justify; is set on an element.&lt;br&gt;&lt;br&gt;ℹ️ Be careful as the uneven spaces created by justify can harm readability and be very distracting.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/Eg1Qd3KAZi&quot;&gt;https://t.co/Eg1Qd3KAZi&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1230739972677754883?ref_src=twsrc%5Etfw&quot;&gt;February 21, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 48: flex&lt;br&gt;&lt;br&gt;- Sets how a flex item will grow or shrink to fit the space available in its flex container.&lt;br&gt;- It is a shorthand for flex-grow, flex-shrink, and flex-basis.&lt;br&gt;&lt;br&gt;ℹ️ CSS Flexbox is awesome in case you didn&amp;#39;t know :-)&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/JV9zVKTld3&quot;&gt;https://t.co/JV9zVKTld3&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1231109306474532864?ref_src=twsrc%5Etfw&quot;&gt;February 22, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 49: z-index&lt;br&gt;&lt;br&gt;- Sets the z-order of a positioned element and its descendants or flex items.&lt;br&gt;&lt;br&gt;ℹ️ The maximum value is infinite, bounded only by a browser&amp;#39;s variable size. For most browsers this days the highest is 2147483647 though.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/PleBHuDPF6&quot;&gt;https://t.co/PleBHuDPF6&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1231496444458262529?ref_src=twsrc%5Etfw&quot;&gt;February 23, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 50: cursor&lt;br&gt;&lt;br&gt;- Sets the type of cursor, if any, to show when the mouse pointer is over an element.&lt;br&gt;&lt;br&gt;ℹ️ cursor: none; is for mouse users as outline: none; is for keyboard users - don&amp;#39;t do either!&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/CgFcXsxLwt&quot;&gt;https://t.co/CgFcXsxLwt&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1231827557684858880?ref_src=twsrc%5Etfw&quot;&gt;February 24, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 51: will-change&lt;br&gt;&lt;br&gt;- Hints to browsers how an element is expected to change. &lt;br&gt;&lt;br&gt;ℹ️ In some situations it imay have negative performance impact. So, always test carefully and use as a last resort.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/yvI73qtT0e&quot;&gt;https://t.co/yvI73qtT0e&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1232198081808130048?ref_src=twsrc%5Etfw&quot;&gt;February 25, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 52: tab-size&lt;br&gt;&lt;br&gt;- Is used to customize the width of tab characters (U+0009).&lt;br&gt;- The default value for the tab-size property is 8 space characters&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/P7PhDnECvp&quot;&gt;https://t.co/P7PhDnECvp&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1232553935602421760?ref_src=twsrc%5Etfw&quot;&gt;February 26, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 53: margin-block&lt;br&gt;&lt;br&gt;- Defines the logical block start and end margins of an element&lt;br&gt;&lt;br&gt;ℹ️ More about logical properties and values: &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/AdGKPGFkVP&quot;&gt;https://t.co/AdGKPGFkVP&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/atyk48pdfZ&quot;&gt;https://t.co/atyk48pdfZ&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1232918338285768704?ref_src=twsrc%5Etfw&quot;&gt;February 27, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 54: font-feature-settings&lt;br&gt;&lt;br&gt;- Controls advanced typographic features in OpenType fonts.&lt;br&gt;&lt;br&gt;ℹ️ Lots of examples: &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/6yHo5tbHvk&quot;&gt;https://t.co/6yHo5tbHvk&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/5aPWsdJPHg&quot;&gt;https://t.co/5aPWsdJPHg&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1233289721263951872?ref_src=twsrc%5Etfw&quot;&gt;February 28, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 55: image-orientation&lt;br&gt;&lt;br&gt;- Specifies a layout-independent correction to the orientation of an image&lt;br&gt;&lt;br&gt;ℹ️ Will be probably deprecated in the future. The good news is that browsers will honor EXIF info (Safari and Chrome already does)&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/8jPaLmQWGT&quot;&gt;https://t.co/8jPaLmQWGT&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1233645418518654978?ref_src=twsrc%5Etfw&quot;&gt;February 29, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 56: line-break&lt;br&gt;&lt;br&gt;- Sets how to break lines of Chinese, Japanese, or Korean (CJK) text when working with punctuation and symbols.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/fUlpqxPRsn&quot;&gt;https://t.co/fUlpqxPRsn&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1234027909251203072?ref_src=twsrc%5Etfw&quot;&gt;March 1, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 57: box-shadow&lt;br&gt;&lt;br&gt;- Adds shadow effects around an element&amp;#39;s frame.&lt;br&gt;&lt;br&gt;ℹ️ Generator: &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/jRiFIKPL1N&quot;&gt;https://t.co/jRiFIKPL1N&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/JJPeiRy5tq&quot;&gt;https://t.co/JJPeiRy5tq&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1234374417570058240?ref_src=twsrc%5Etfw&quot;&gt;March 2, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 58: writing-mode&lt;br&gt;&lt;br&gt;- Sets whether lines of text are laid out horizontally or vertically, as well as the direction in which blocks progress.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/7zwoyWb55Z&quot;&gt;https://t.co/7zwoyWb55Z&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1234742636847812608?ref_src=twsrc%5Etfw&quot;&gt;March 3, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 59: counter-increment&lt;br&gt;&lt;br&gt;- Increases or decreases the value of a CSS counter by a given value.&lt;br&gt;&lt;br&gt;ℹ️ You can change multiple counter at once, eg. counter-increment: cter1 cter2 -4; will increment cter1 by 1 and decrement cter2 by 4&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/pO99ufKqtg&quot;&gt;https://t.co/pO99ufKqtg&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1235106380215767040?ref_src=twsrc%5Etfw&quot;&gt;March 4, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 60: quotes&lt;br&gt;&lt;br&gt;- Sets how quotation marks appear.&lt;br&gt;&lt;br&gt;/* Set open-quote and close-quote to the French quotation marks */&lt;br&gt;&lt;br&gt;quotes: &amp;quot;«&amp;quot; &amp;quot;»&amp;quot; &amp;quot;‹&amp;quot; &amp;quot;›&amp;quot;;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ipLqlHQ9go&quot;&gt;https://t.co/ipLqlHQ9go&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1235457103516573696?ref_src=twsrc%5Etfw&quot;&gt;March 5, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 61: image-rendering&lt;br&gt;&lt;br&gt;- Sets an image scaling algorithm.&lt;br&gt;- Values are auto, smooth, high-quality, crisp-edges and pixelated&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/OkZtGa3S1o&quot;&gt;https://t.co/OkZtGa3S1o&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1235823329635782658?ref_src=twsrc%5Etfw&quot;&gt;March 6, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 62: justify-self&lt;br&gt;&lt;br&gt;- Sets the way a box is justified inside its alignment container along the appropriate axis.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/frjanwHj3D&quot;&gt;https://t.co/frjanwHj3D&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1236181143176859649?ref_src=twsrc%5Etfw&quot;&gt;March 7, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 63: place-content&lt;br&gt;&lt;br&gt;- Is a shorthand for align-content and justify-content.&lt;br&gt;&lt;br&gt;ℹ️ If the second value is not present, the first value is used for both, provided it is a valid value for both.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/gLGy8W36vR&quot;&gt;https://t.co/gLGy8W36vR&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1236568685625708544?ref_src=twsrc%5Etfw&quot;&gt;March 8, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 64: row-gap (grid-row-gap)&lt;br&gt;&lt;br&gt;- Sets the size of the gap (gutter) between an element&amp;#39;s grid rows.&lt;br&gt;&lt;br&gt;ℹ️ CSS Grid Layout initially defined the grid-row-gap property. This prefixed property is being replaced by row-gap.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/rVCfOvFrA2&quot;&gt;https://t.co/rVCfOvFrA2&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1236916309255995392?ref_src=twsrc%5Etfw&quot;&gt;March 9, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 65: backface-visibility&lt;br&gt;&lt;br&gt;- Sets whether the back face of an element is visible when turned towards the user.&lt;br&gt;&lt;br&gt;ℹ️ Though invisible in 2D, it can become visible when a transformation causes the element to be rotated in 3D space.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/gUyvfEqUNG&quot;&gt;https://t.co/gUyvfEqUNG&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/BoOXYJW84h&quot;&gt;pic.twitter.com/BoOXYJW84h&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1237261728355942400?ref_src=twsrc%5Etfw&quot;&gt;March 10, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 66: opacity&lt;br&gt;&lt;br&gt;- Sets the opacity of an element.&lt;br&gt;&lt;br&gt;ℹ️ Browsers can animate opacity cheaply &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/McNwz7DY2z&quot;&gt;https://t.co/McNwz7DY2z&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/sjhEbofYeA&quot;&gt;https://t.co/sjhEbofYeA&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1237617788757389312?ref_src=twsrc%5Etfw&quot;&gt;March 11, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 67: border-block-end&lt;br&gt;&lt;br&gt;- Is a shorthand property for setting the individual logical block-end border property value&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/1qzRHeOQym&quot;&gt;https://t.co/1qzRHeOQym&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1237989561839562752?ref_src=twsrc%5Etfw&quot;&gt;March 12, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 68: box-decoration-break&lt;br&gt;&lt;br&gt;- Specifies how an element&amp;#39;s fragments should be rendered when broken across multiple lines, columns, or pages.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/ToTEQkl6el&quot;&gt;https://t.co/ToTEQkl6el&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1238347006223007744?ref_src=twsrc%5Etfw&quot;&gt;March 13, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 69: padding&lt;br&gt;&lt;br&gt;- Sets the padding area on all four sides of an element.&lt;br&gt;&lt;br&gt;ℹ️ If you use box-sizing: border-box; the padding the width/height will include the padding value.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/8NHhePLv0O&quot;&gt;https://t.co/8NHhePLv0O&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1238709352837582853?ref_src=twsrc%5Etfw&quot;&gt;March 14, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 70: gap (grid-gap)&lt;br&gt;&lt;br&gt;- Sets the gaps (gutters) between rows and columns.&lt;br&gt;&lt;br&gt;ℹ️ Can be used with Flexbox (Supported only in Firefox for now) and with Grid.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/IeQ4v0TKi5&quot;&gt;https://t.co/IeQ4v0TKi5&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1239093572219084800?ref_src=twsrc%5Etfw&quot;&gt;March 15, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 71: filter&lt;br&gt;&lt;br&gt;- Applies graphical effects like blur or color shift to an element.&lt;br&gt;&lt;br&gt;ℹ️ filter: invert(80%); works great to adjust e.g. SVG for dark/light mode&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/MoSs7oVC2D&quot;&gt;https://t.co/MoSs7oVC2D&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1239441173472776198?ref_src=twsrc%5Etfw&quot;&gt;March 16, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 72: grid&lt;br&gt;&lt;br&gt;- Is a shorthand property that sets all of the explicit grid properties, and all the implicit grid properties, in a single declaration.&lt;br&gt;&lt;br&gt;ℹ️ It rocks!&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/IEzRQo4wJj&quot;&gt;https://t.co/IEzRQo4wJj&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1239792861790568448?ref_src=twsrc%5Etfw&quot;&gt;March 17, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 73: mask-image&lt;br&gt;&lt;br&gt;- Sets the image that is used as mask layer for an element.&lt;br&gt;&lt;br&gt;Example: &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/BOw1LpSkvy&quot;&gt;https://t.co/BOw1LpSkvy&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/bwYMae31yf&quot;&gt;https://t.co/bwYMae31yf&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1240158152890486784?ref_src=twsrc%5Etfw&quot;&gt;March 18, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 74: object-position&lt;br&gt;&lt;br&gt;- Specifies the alignment of the selected replaced element&amp;#39;s contents within the element&amp;#39;s box.&lt;br&gt;&lt;br&gt;ℹ️ Like background-position, but for &amp;lt;img&amp;gt;, &amp;lt;video&amp;gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/KxxZXzhYGt&quot;&gt;https://t.co/KxxZXzhYGt&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1240519858229587968?ref_src=twsrc%5Etfw&quot;&gt;March 19, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 75: order&lt;br&gt;&lt;br&gt;- Sets the order to lay out an item in a flex or grid container.&lt;br&gt;&lt;br&gt;ℹ️ Only effects visual order and not logical or tab order, so be aware of accessibility issues. &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/i84A4VIc01&quot;&gt;https://t.co/i84A4VIc01&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/kUH5T8HQv8&quot;&gt;https://t.co/kUH5T8HQv8&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1240887034258087937?ref_src=twsrc%5Etfw&quot;&gt;March 20, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 76: margin&lt;br&gt;&lt;br&gt;- Sets the margin area on all four sides of an element.&lt;br&gt;&lt;br&gt;ℹ️ Learn about mastering margin collapsing &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/uNfSQtiv0G&quot;&gt;https://t.co/uNfSQtiv0G&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/cpX5S4ZGFi&quot;&gt;https://t.co/cpX5S4ZGFi&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1241234386365952000?ref_src=twsrc%5Etfw&quot;&gt;March 21, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 77: orphans&lt;br&gt;&lt;br&gt;- Sets the minimum number of lines in a block container that must be shown at the bottom of a page, region, or column.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/PvZUesvDvb&quot;&gt;https://t.co/PvZUesvDvb&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1241617299242704897?ref_src=twsrc%5Etfw&quot;&gt;March 22, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 78: place-self&lt;br&gt;&lt;br&gt;- Is a shorthand property sets both the align-self and justify-self properties.&lt;br&gt;&lt;br&gt;ℹ️ The first value is the align-self property value, the second the justify-self one.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/7dRDJF7QrF&quot;&gt;https://t.co/7dRDJF7QrF&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1241980115279581184?ref_src=twsrc%5Etfw&quot;&gt;March 23, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 79: table-layout&lt;br&gt;&lt;br&gt;- Sets the algorithm used to lay out &amp;lt;table&amp;gt; cells, rows, and columns.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/pR4ilvN9Pq&quot;&gt;https://t.co/pR4ilvN9Pq&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1242333800434208769?ref_src=twsrc%5Etfw&quot;&gt;March 24, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 80: scrollbar-color&lt;br&gt;&lt;br&gt;- Sets the color of the scrollbar track and thumb.&lt;br&gt;&lt;br&gt;ℹ️ As with every color you set, make sure the color contrast is sufficient.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/lOkTcCSLTu&quot;&gt;https://t.co/lOkTcCSLTu&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1242691974509068290?ref_src=twsrc%5Etfw&quot;&gt;March 25, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 81: overflow&lt;br&gt;&lt;br&gt;- Sets what to do when an element&amp;#39;s content is too big to fit in its block formatting context.&lt;br&gt;&lt;br&gt;ℹ️ Setting one axis to visible while setting the other to a different value results in visible behaving as auto.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/c3DLcTHYMs&quot;&gt;https://t.co/c3DLcTHYMs&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1243057508819832832?ref_src=twsrc%5Etfw&quot;&gt;March 26, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 82: word-spacing&lt;br&gt;&lt;br&gt;- Sets the length of space between words and between tags.&lt;br&gt;&lt;br&gt;ℹ️ A large positive or negative word-spacing value will make the sentences the styling is applied to unreadable and therefore inaccessible.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/p2Kj4cxTqA&quot;&gt;https://t.co/p2Kj4cxTqA&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1243413866140192770?ref_src=twsrc%5Etfw&quot;&gt;March 27, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 83: padding-inline-start&lt;br&gt;&lt;br&gt;- Defines the logical inline start padding of an element, which maps to a physical padding depending on the element&amp;#39;s writing mode, directionality, and text orientation.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/H2SPAqIv06&quot;&gt;https://t.co/H2SPAqIv06&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1243787419121582080?ref_src=twsrc%5Etfw&quot;&gt;March 28, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 84: color&lt;br&gt;&lt;br&gt;- Sets the foreground color value of an element&amp;#39;s text and text decorations, and sets the currentcolor value.&lt;br&gt;&lt;br&gt;ℹ️ The value must be a uniform color. It can&amp;#39;t be a &amp;lt;gradient&amp;gt;, which is actually a type of &amp;lt;image&amp;gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/Jr6UW0Wd7I&quot;&gt;https://t.co/Jr6UW0Wd7I&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1244139889173594113?ref_src=twsrc%5Etfw&quot;&gt;March 29, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 85: widows&lt;br&gt;&lt;br&gt;- Sets the minimum number of lines in a block container that must be shown at the top of a page, region, or column.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/6oTxmYx2cy&quot;&gt;https://t.co/6oTxmYx2cy&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1244504910181343236?ref_src=twsrc%5Etfw&quot;&gt;March 30, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 86: scroll-snap-stop&lt;br&gt;&lt;br&gt;- Defines whether the scroll container is allowed to &amp;quot;pass over&amp;quot; possible snap positions.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/BvCy8UGauR&quot;&gt;https://t.co/BvCy8UGauR&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1244860689849647105?ref_src=twsrc%5Etfw&quot;&gt;March 31, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 87: text-emphasis-style&lt;br&gt;&lt;br&gt;- Sets the appearance of emphasis marks.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/A2iwHN8C2n&quot;&gt;https://t.co/A2iwHN8C2n&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/JfILoQrMBz&quot;&gt;pic.twitter.com/JfILoQrMBz&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1245232886422396929?ref_src=twsrc%5Etfw&quot;&gt;April 1, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 88: visibility&lt;br&gt;&lt;br&gt;- Shows or hides an element without changing the layout of a document.&lt;br&gt;&lt;br&gt;ℹ️ visibility: hidden removes the element from the accessibility tree&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/L0VBlgNE1i&quot;&gt;https://t.co/L0VBlgNE1i&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1245585717465505794?ref_src=twsrc%5Etfw&quot;&gt;April 2, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 89: place-items&lt;br&gt;&lt;br&gt;- Sets the align-items and justify-items properties, respectively.&lt;br&gt;&lt;br&gt;ℹ️ If the second value is not set, the first value is also used for it.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/XLtwvan7NW&quot;&gt;https://t.co/XLtwvan7NW&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1245953795688935425?ref_src=twsrc%5Etfw&quot;&gt;April 3, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 90: inline-size&lt;br&gt;&lt;br&gt;- Defines the horizontal or vertical size of an element&amp;#39;s block, depending on its writing mode.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/5vB4X5klwU&quot;&gt;https://t.co/5vB4X5klwU&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1246307801435160577?ref_src=twsrc%5Etfw&quot;&gt;April 4, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 91: text-transform&lt;br&gt;&lt;br&gt;- Specifies how to capitalize an element&amp;#39;s text.&lt;br&gt;&lt;br&gt;ℹ️ Support for language-specific cases varies between browsers&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/YSDkZVnfz3&quot;&gt;https://t.co/YSDkZVnfz3&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1246668047403945985?ref_src=twsrc%5Etfw&quot;&gt;April 5, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 92: perspective&lt;br&gt;&lt;br&gt;- Determines the distance between the z=0 plane and the user in order to give a 3D-positioned element some perspective.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/wENb9rGFJj&quot;&gt;https://t.co/wENb9rGFJj&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1247055271169581056?ref_src=twsrc%5Etfw&quot;&gt;April 6, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 93: shape-outside&lt;br&gt;&lt;br&gt;- Defines a shape—which may be non-rectangular—around which adjacent inline content should wrap.&lt;br&gt;&lt;br&gt;ℹ️ The shape editor in Firefox Devtools is really cool &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/dD9FCVsy9f&quot;&gt;https://t.co/dD9FCVsy9f&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/lL9UFpRl11&quot;&gt;https://t.co/lL9UFpRl11&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1247399942731313154?ref_src=twsrc%5Etfw&quot;&gt;April 7, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 94: pointer-events&lt;br&gt;&lt;br&gt;- Sets under what circumstances (if any) a particular graphic element can become the target of pointer events.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/bh6e8MXnGr&quot;&gt;https://t.co/bh6e8MXnGr&lt;/a&gt;&lt;br&gt;&lt;br&gt; input[disabled],&lt;br&gt; button[disabled] {&lt;br&gt; pointer-events: none;&lt;br&gt; }&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1247774657882632198?ref_src=twsrc%5Etfw&quot;&gt;April 8, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 95: rotate&lt;br&gt;&lt;br&gt;- Allows you to specify rotation transforms individually and independently of the transform property.&lt;br&gt;&lt;br&gt;ℹ️ You can also set the name of the axis you want to rotate the affected element around, e.g. rotate: x 90deg;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/HlgcPw6CD0&quot;&gt;https://t.co/HlgcPw6CD0&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1248107172317315072?ref_src=twsrc%5Etfw&quot;&gt;April 9, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 96: shape-image-threshold&lt;br&gt;&lt;br&gt;- Sets the alpha channel threshold used to extract the shape using an image as the value for shape-outside.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/9L3vwVeWSG&quot;&gt;https://t.co/9L3vwVeWSG&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1248484909376614400?ref_src=twsrc%5Etfw&quot;&gt;April 10, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 97: touch-action&lt;br&gt;&lt;br&gt;- Sets how an element&amp;#39;s region can be manipulated by a touchscreen user&lt;br&gt;&lt;br&gt;ℹ️ After a gesture starts, changes to touch-action will not have any impact on the behavior of the current gesture.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/sgDTQSYCMQ&quot;&gt;https://t.co/sgDTQSYCMQ&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1248844132073832448?ref_src=twsrc%5Etfw&quot;&gt;April 11, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 98: perspective-origin&lt;br&gt;&lt;br&gt;- Determines the position at which the viewer is looking.&lt;br&gt;- It is used as the vanishing point by the perspective property.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/lM8w1wHeId&quot;&gt;https://t.co/lM8w1wHeId&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1249214751248449536?ref_src=twsrc%5Etfw&quot;&gt;April 12, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 99: font-optical-sizing&lt;br&gt;&lt;br&gt;- Sets whether text rendering is optimized for viewing at different sizes.&lt;br&gt;&lt;br&gt;ℹ️ The optical size variation axis is represented by opsz in font-variation-settings.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/COuqQob1iV&quot;&gt;https://t.co/COuqQob1iV&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1249574878199590912?ref_src=twsrc%5Etfw&quot;&gt;April 13, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Day 100: color-adjust&lt;br&gt;&lt;br&gt;- Sets what, if anything, the user agent may do to optimize the appearance of the element on the output device.&lt;br&gt;&lt;br&gt;ℹ️ With that the series is done.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://t.co/A4p89bomZG&quot;&gt;https://t.co/A4p89bomZG&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/hashtag/CSSPropertyInTweet?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CSSPropertyInTweet&lt;/a&gt;&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/1249943124702527488?ref_src=twsrc%5Etfw&quot;&gt;April 14, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;p&gt;Here is the &lt;a href=&quot;https://twitter.com/search?q=%23CSSPropertyInTweet%20%40justmarkup&amp;amp;src=typed_query&amp;amp;f=live&quot;&gt;full list on twitter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you looked closely you saw that I somehow missed Day 12 to tweet - I realized this just now when writing this article, even though I was 100% sure before I didn&#39;t miss a day. So, there are only 99 properties after all I tweeted.&lt;/p&gt;
&lt;p&gt;Oh, here is what would have been Day 12:&lt;/p&gt;
&lt;blockquote&gt;
Day 12: inset
&lt;ul&gt;
&lt;li&gt;Defines physical offsets, regardless of the element&#39;s writing mode, directionality, and text orientation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;ℹ️ Is still an Editor’s Draft and currently only supported in Firefox&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/inset&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/inset&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;#CSSPropertyInTweet&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I might repeat this some day, maybe 50 JavaScript keywords or something.&lt;/p&gt;
&lt;p&gt;&amp;lt;information&amp;gt;&lt;br&gt;
This article was written with &lt;a href=&quot;https://app.writerie.com/&quot;&gt;Writerie&lt;/a&gt; - The Writer for Internet People.&lt;br&gt;
&amp;lt;/information&amp;gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> A poll, third-party, assumptions, and some tips</title>
							<link>https://justmarkup.com/notes/2020-04-10-so-much-third-party/</link>
							<pubDate>2020-04-10T09:54:10+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-04-10-so-much-third-party/</guid>
							<description>&lt;p&gt;Last week I started a poll on twitter to find out how much we rely on third-party code in front end. I asked the people how much of their JavaScript and CSS code is third-party.&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;On average, how much of all the KB of JavaScript you ship, are written by yourself versus third-party code?&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1245333877012475904?ref_src=twsrc%5Etfw&quot;&gt;April 1, 2020&lt;/a&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Next round: CSS&lt;br&gt;&lt;br&gt;On average, how much of all the KB of CSS you ship, are written by yourself versus third-party code?&lt;/p&gt;&amp;mdash; Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/1246693972380209153?ref_src=twsrc%5Etfw&quot;&gt;April 5, 2020&lt;/a&gt;&lt;/blockquote&gt; 
&lt;p&gt;As is the tradition with every poll you post, you make assumptions, so here we go.&lt;/p&gt;
&lt;h2 id=&quot;more-third-party-javascript-than-third-party-css&quot;&gt;More third-party JavaScript than third-party CSS &lt;a class=&quot;permalink&quot; href=&quot;#more-third-party-javascript-than-third-party-css&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;More than 50% said that their JavaScript is mostly third-party code, while only 3% said the same for CSS. This isn&#39;t very surprising though, while there are various CSS frameworks like Foundation or Bootstrap, you still have to adjust and write your own CSS on top of it. This may be also the issue many have with CSS, you have to master it alone.&lt;/p&gt;
&lt;p&gt;For JavaScript it is quite different, first there are a lot of JavaScript frameworks and libraries which already comes with a lot of components and other stuff to build your UI. On top of that there is often a solution for a problem just one npm install away. Need to sort some data, search for &#39;sort&#39; in the npm registry and you most certainly will find a solution and a documentation along with it  - Boom, another third-party script added.&lt;/p&gt;
&lt;p&gt;Talking about npm, let&#39;s move on.&lt;/p&gt;
&lt;h2 id=&quot;what-does-fast-mean%3F&quot;&gt;What does fast mean? &lt;a class=&quot;permalink&quot; href=&quot;#what-does-fast-mean%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On the server it doesn&#39;t really matter how big a package is. Even the cheapest hosting packages offer some GB of space. What matters is execution time. If there are two packages offering the same functionality, say a function to sort numbers. If one package is 1 MB and another one is only 10 kB, but the one with 100 MB is twice as fast (say 10ms instead of 20ms) you would choose the 1 MB package, even though it requires 100x the space of the 10 kB package. If 1.000.000 people request your site and every time the sort function is executed, you only need the space once, but can deliver the result 1.000.000x twice as fast, or instead of in 20.000.000ms in 10.000.000ms.&lt;/p&gt;
&lt;p&gt;On the client it is a different story. While execution time is also important, it is also really important how many kB the user has to download before they can even make use of it. If we would have to decide if we would use the 1 MB package or the 10 kB package you should go with the 10 kB package, even if it takes twice as long. If 1.000.000 users need to download the file with the sort function, they would have to download 1.000.000 MB, but only 10.000 MB if we have chosen to ship the 10 kB package.&lt;/p&gt;
&lt;p&gt;npm was originally a package manager for Node.js (JavaScript running on the server), but lately it is also used a lot for JavaScript running on the client. The issue is that they are quite different as outlined above and while some package may be the best solution on the server, the same package may be the worst solution on the client.&lt;/p&gt;
&lt;p&gt;One example often cited is &lt;a href=&quot;https://www.npmjs.com/package/moment&quot;&gt;moment&lt;/a&gt; - &amp;quot;A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.&amp;quot; as they market it. Lightweight means in this case about 232 kB of JavaScript. On the server this is no problem at all, but on the client this is way too much.&lt;/p&gt;
&lt;h2 id=&quot;what-makes-a-good-third-party-package%3F&quot;&gt;What makes a good third-party package? &lt;a class=&quot;permalink&quot; href=&quot;#what-makes-a-good-third-party-package%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To finish this with something useful, here are some things you should consider before using a third-party script.&lt;/p&gt;
&lt;h3 id=&quot;1.-well-maintained&quot;&gt;1. Well maintained &lt;a class=&quot;permalink&quot; href=&quot;#1.-well-maintained&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before using a package you should check on npm/Github/Gitlab... if the package is still actively maintained. When was the last release? How many people work on this project? Are the open issues monitored, or was there no response for a longer time?&lt;/p&gt;
&lt;p&gt;All this questions give you a first good overview how well a package is maintained.&lt;/p&gt;
&lt;h3 id=&quot;2.-is-it-accessible&quot;&gt;2. Is it accessible &lt;a class=&quot;permalink&quot; href=&quot;#2.-is-it-accessible&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If the problem you try to solve involves any form of user interaction the JavaScript and CSS you need for it needs to be accessible. First, you may try adding the keywords &amp;quot;Accessibility&amp;quot; or &amp;quot;A11y&amp;quot; to your search. If a package is using these keywords it is a good first sign, but you should still not take this for granted. As a next step I usually open the code repository and search for &amp;quot;keyboard&amp;quot; - if there is a documentation/wiki explaining how well it works with keyboard-only it is fantastic, if there is only one issue found in the search complaining about keyboard issues, it is a bad sign. After &amp;quot;keyboard&amp;quot; I usually do the same search again with &amp;quot;screen reader&amp;quot; looking for the same patterns.&lt;/p&gt;
&lt;p&gt;This a good first steps to see if a package might be accessible. As a next step you should test a demo version of if, running some accessibility linters and do your own tests how well it works for keyboard users and users using a screen reader.&lt;/p&gt;
&lt;h3 id=&quot;3.-is-it-lightweight&quot;&gt;3. Is it lightweight &lt;a class=&quot;permalink&quot; href=&quot;#3.-is-it-lightweight&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sadly, most packages don&#39;t market their lightweight size anymore (maybe because they got heavier and heavier after the years) like years ago when every jQuery plugin wrote at the top of their description - Only 1.6 kB or something.&lt;/p&gt;
&lt;p&gt;Even if there are sizes mentioned, it is often unclear what they mean. Is this before/after minification, before/after gzip.&lt;/p&gt;
&lt;p&gt;So, do find out how lightweight or heavy a package is you mostly have to install it locally and see for yourself.&lt;/p&gt;
&lt;h3 id=&quot;4.-do-i-really-need-that&quot;&gt;4. Do I really need that &lt;a class=&quot;permalink&quot; href=&quot;#4.-do-i-really-need-that&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Coming back to the moment.js example - if you find that a package is probably not as lightweight as you want, there is often an alternative package or sometimes browser support got so got that you can use native solutions and no third-party at all.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Almost all websites ship with some third-party code. Yes, for mostly static sites you probably don&#39;t need any third-party code. But, the more complex the site is and the more features you have, you will probably use third-party code at some point. Often there are great solutions available for the problems you want to solve, but you should always question the solution. Is there a better one, a more accessible one, a more lightweight one and do I really need that third-party package or can I build it on my own now as browser support involved.&lt;/p&gt;
&lt;p&gt;&amp;lt;information&amp;gt;&lt;br&gt;
This article was written with &lt;a href=&quot;https://app.writerie.com/&quot;&gt;Writerie&lt;/a&gt; - The Writer for Internet People.&lt;br&gt;
&amp;lt;/information&amp;gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Basic tests for a frontend feature</title>
							<link>https://justmarkup.com/notes/2020-03-10-basic-tests-for-a-frontend-feature/</link>
							<pubDate>2020-03-10T19:24:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-03-10-basic-tests-for-a-frontend-feature/</guid>
							<description>&lt;p&gt;If you ever worked in an agile team and used SCRUM you probably heard of Definition of Done. While I am still skeptical that SCRUM is the best way to build a product, I find having a Definition of Done to be really helpful.&lt;/p&gt;
&lt;p&gt;Here are some things I find to be valuable to have in there when it comes to testing.&lt;/p&gt;
&lt;h2 id=&quot;1)-tests-on-devices%2Fbrowsers-listed-in-the-project-assumptions-passed&quot;&gt;1) Tests on devices/browsers listed in the project assumptions passed &lt;a class=&quot;permalink&quot; href=&quot;#1)-tests-on-devices%2Fbrowsers-listed-in-the-project-assumptions-passed&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;What devices and browsers you should test depends on your product, your market and many other factors. You should, however, have a least one low-end Android device in there, like the Moto G4 or the Alacatel 1X. Testing there gives you a good idea how efficient a feature really is.&lt;/p&gt;
&lt;h2 id=&quot;2)-can-be-used-with-keyboard-only&quot;&gt;2) Can be used with keyboard only &lt;a class=&quot;permalink&quot; href=&quot;#2)-can-be-used-with-keyboard-only&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;That&#39;s self-explanatory – all actions of the feature can be done by using only your keyboard.&lt;/p&gt;
&lt;h2 id=&quot;3)-automated-accessibility-tests-passed&quot;&gt;3) Automated accessibility tests passed &lt;a class=&quot;permalink&quot; href=&quot;#3)-automated-accessibility-tests-passed&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While you can&#39;t automatically test any accessibility issue, it is a good start. There are various tools available, like &lt;a href=&quot;https://wave.webaim.org/about&quot;&gt;WAVE&lt;/a&gt;, &lt;a href=&quot;https://www.deque.com/axe/&quot;&gt;axe&lt;/a&gt;, &lt;a href=&quot;https://pa11y.org/&quot;&gt;Pa11y&lt;/a&gt; and many others. Most tools show you contrast failures, missing alt attributes, missing labels and much more.&lt;/p&gt;
&lt;h2 id=&quot;4)-test-with-screen-reader-passed&quot;&gt;4) Test with screen reader passed &lt;a class=&quot;permalink&quot; href=&quot;#4)-test-with-screen-reader-passed&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You should at least test with one screen reader. You can use a free screen reader like VoiceOver (macOS, iOS), TalkBAck (Android), NVDA (Windows) to test. Note, there are differences between screen reader, how they support web features.&lt;/p&gt;
&lt;h2 id=&quot;5)-core-actions-are-usable-without-javascript&quot;&gt;5) Core actions are usable without JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#5)-core-actions-are-usable-without-javascript&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;No matter what happens, one thing will always be true - JavaScript can and will fail at some point. Therefore, make sure all the core features are usable without JavaScript, and more importantly, when JavaScript is available, but fails for whatever reason.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This list is by no means complete. Nothing will ever be perfect, but if all these tests pass you are most probably ready to ship.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The beauty of the Unknown</title>
							<link>https://justmarkup.com/notes/2020-02-28-the-beauty-of-the-unknown/</link>
							<pubDate>2020-02-28T12:42:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-02-28-the-beauty-of-the-unknown/</guid>
							<description>&lt;p&gt;Building for the frontend on the web comes with the challenge of many unknowns. Many seem to dislike this and want to build only for one environment. I really like the challenge and you should too if you are a Front-end developer.&lt;/p&gt;
&lt;h2 id=&quot;all-the-browser-and-devices&quot;&gt;All the browser and devices &lt;a class=&quot;permalink&quot; href=&quot;#all-the-browser-and-devices&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At the moment there are about &lt;a href=&quot;https://www.browserstack.com/blog/understanding-browser-os-and-device-fragmentation/&quot;&gt;63.000&lt;/a&gt; browser-platform-device combinations. That&#39;s a lot. And there will be even more in the future.&lt;/p&gt;
&lt;p&gt;It is impossible to test your site in all these combinations, so you have to find a way to make sure that your site works there without testing it everywhere. The way to do this is to learn to build for the unknown. To learn that every code may fail and be prepared.&lt;/p&gt;
&lt;h2 id=&quot;i-want-only-one-browser&quot;&gt;I want only one browser &lt;a class=&quot;permalink&quot; href=&quot;#i-want-only-one-browser&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I regularly hear from developers that they wish that there would only be one browser(engine). At the moment (beginning of 2020) we are in a situation where only three big browser/engines are active (Firefox, WebKit, Chromium). I really hope we don&#39;t end up with a monopoly. While it would be different from the »Internet Explorer monopoly« we had in the past, it would clearly not help the web.&lt;/p&gt;
&lt;p&gt;Even if there would be only one browser engine left, there would still be fragmentation. Different devices, different screen sizes, different CPU power, different input devices, different output devices, different operation systems – so many differences.&lt;/p&gt;
&lt;p&gt;So the bad news for everybody wishing that at some point they can build only for the known. It will never happen on the Front-end. If you dislike the challenge of the unknown that much, you may better work on the Back-end.&lt;/p&gt;
&lt;h2 id=&quot;progressive-enhancement&quot;&gt;Progressive enhancement &lt;a class=&quot;permalink&quot; href=&quot;#progressive-enhancement&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the end, it is all about Progressive Enhancement. There is a lot about wrong assumptions about Progressive Enhancement as it seems. Some think it means to not use JavaScript at all, some think it is useless because they can&#39;t imagine that their CSS/JavaScript can fail in some scenarios and some think it means that you can&#39;t use new web technologies.&lt;/p&gt;
&lt;p&gt;That&#39;s not really how I think about Progressive Enhancement. For me, Progressive Enhancement means »Preparing for the Worst and building for the Best«. It also means that I feel much more confident using new and even experimental web technologies, because I use them as an enhancement and I am still sure the basic stuff is there and works.&lt;/p&gt;
&lt;p&gt;You should learn to like the idea of Progressive Enhancement, whatever you call it.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Teaser with multiple links</title>
							<link>https://justmarkup.com/articles/2020-02-21-teaser-with-multiple-links/</link>
							<pubDate>2020-02-21T06:56:12+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2020-02-21-teaser-with-multiple-links/</guid>
							<description>&lt;p&gt;Cards, teaser, preview blocks – there are many different ways to name them – one thing they all have in common is that they usually consist of a headline, an image, some text and a read more link. The other similarity is that all these elements should link to the same goal. In theory, writing the HTML for this pattern seems pretty straightforward, but there are some accessibility concerns which may not be obvious at a first glance.&lt;/p&gt;
&lt;p&gt;In this article we will have a look at the possible options to make all the elements link-able and their advantages and disadvantages.&lt;/p&gt;
&lt;h2 id=&quot;extra-link-for-each-element&quot;&gt;Extra link for each element &lt;a class=&quot;permalink&quot; href=&quot;#extra-link-for-each-element&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One option to make all the elements (image, headline, ...) link-able, would be to define an extra link for each element.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/bestarticle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/bestarticle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;bestimage.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Best image&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/bestarticle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Read more &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you happen to use a mouse or touch device this sounds like a good way to define the HTML. If you use a screen reader or are a keyboard user this isn&#39;t. The problem with this approach is the redundancy – as a keyboard user you have to tab three times to get to the next teaser, as a screen reader user you will get announced the same link three times as well.&lt;/p&gt;
&lt;h3 id=&quot;advantages&quot;&gt;Advantages &lt;a class=&quot;permalink&quot; href=&quot;#advantages&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;You can define extra :hover/:focus states for each element&lt;/li&gt;
&lt;li&gt;Every text is selectable&lt;/li&gt;
&lt;li&gt;The context menu works as expected (e.g. option to open link in a new tab)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;disadvantages&quot;&gt;Disadvantages &lt;a class=&quot;permalink&quot; href=&quot;#disadvantages&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A lot of redundancy for many users, which makes it inaccessible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You may wonder now, we have three advantages and only on disadvantage – what&#39;s the problem? The problem is that this approach is not fully accessible and we never want to ship inaccessible code.&lt;/p&gt;
&lt;p&gt;Let&#39;s see what other options we have.&lt;/p&gt;
&lt;h2 id=&quot;one-block-link&quot;&gt;One block link &lt;a class=&quot;permalink&quot; href=&quot;#one-block-link&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since HTML5 you can create so-called &lt;a href=&quot;http://html5doctor.com/block-level-links-in-html-5/&quot;&gt;Block Level Links&lt;/a&gt;. This means, instead of a link for each element, we can use one link around all our elements.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/bestarticle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;      Headline&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;bestimage.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Best image&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Read more &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;advantages-1&quot;&gt;Advantages &lt;a class=&quot;permalink&quot; href=&quot;#advantages-1&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The context menu works as expected (e.g. option to open link in a new tab)&lt;/li&gt;
&lt;li&gt;No link redundancy&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;disadvantages-1&quot;&gt;Disadvantages &lt;a class=&quot;permalink&quot; href=&quot;#disadvantages-1&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;You can&#39;t define extra :hover/:focus states for each element&lt;/li&gt;
&lt;li&gt;Selecting individual text parts is pretty hard&lt;/li&gt;
&lt;li&gt;Screen readers may announce all the text, which can be annoying&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From an accessible point of view this is better than having the redundancy problem, but it comes with other disadvantages, so let&#39;s see at yet another approach.&lt;/p&gt;
&lt;h2 id=&quot;an-absolute-positioned-link&quot;&gt;An absolute positioned link &lt;a class=&quot;permalink&quot; href=&quot;#an-absolute-positioned-link&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Our next approach is to use an absolute positioned link. The idea is to have only one inline link in the HTML, and use ::before to stretch that link around the whole teaser.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;bestimage.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Best image&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;readmore&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/bestarticle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Read more &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this HTML alone only the Read More Link would be clickable, so let&#39;s add some CSS to expand the click area to the whole teaser.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;article&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.readmore::before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now with the CSS added you can click everywhere on the teaser.&lt;/p&gt;
&lt;h3 id=&quot;advantages-2&quot;&gt;Advantages &lt;a class=&quot;permalink&quot; href=&quot;#advantages-2&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The context menu works as expected (e.g. option to open link in a new tab)&lt;/li&gt;
&lt;li&gt;No link redundancy&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;disadvantages-2&quot;&gt;Disadvantages &lt;a class=&quot;permalink&quot; href=&quot;#disadvantages-2&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;You can&#39;t define extra :hover/:focus states for each element&lt;/li&gt;
&lt;li&gt;Selecting individual text parts is pretty hard&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;javascript-all-the-things&quot;&gt;JavaScript all the things &lt;a class=&quot;permalink&quot; href=&quot;#javascript-all-the-things&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;How could I forget about JavaScript? JavaScript is the best, it makes everything better. So let&#39;s see how to handle this with good old JavaScript.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;bestimage.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Best image&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;readmore&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/bestarticle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Read more &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We start with the same HTML as in the previous example, but instead of using CSS we will now &amp;quot;enhance&amp;quot; it with JavaScript.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; article &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;article&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;article&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; link &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  link&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, every time the user clicks on any part of our teaser we trigger a click on the Read More link. To avoid that a click is triggered when a user wants to select some text, we can use this &lt;a href=&quot;https://inclusive-components.design/cards/#theredundantclickevent&quot;&gt;method&lt;/a&gt; described by &lt;a href=&quot;https://twitter.com/heydonworks&quot;&gt;Heydon Pickering&lt;/a&gt; to only trigger the click after a 200 millisecond threshold.&lt;/p&gt;
&lt;h3 id=&quot;advantages-3&quot;&gt;Advantages &lt;a class=&quot;permalink&quot; href=&quot;#advantages-3&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Selecting text is possible with some extra effort&lt;/li&gt;
&lt;li&gt;No link redundancy&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;disadvantages-3&quot;&gt;Disadvantages &lt;a class=&quot;permalink&quot; href=&quot;#disadvantages-3&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The context menu doesn&#39;t work anymore (e.g. option to open link in a new tab)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All in all, this approach seems pretty good, but the non-working context menu is a big no-go for me and JavaScript is just too fragile to make this a great solution.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you can see, there is no real winner here. All the approaches have their disadvantages. Personally, I prefer to use the absolute positioned link approach, as I often don&#39;t need individual :hover/:focus styles and I am okay with the disadvantage of not being able to select text there, as on the full article the text will be select-able. And it offers the best experience for keyboard and screen reader users.&lt;/p&gt;
&lt;p&gt;If you came as far, go and read more about building cards elements on &lt;a href=&quot;https://inclusive-components.design/cards/&quot;&gt;Inclusive Components&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Share images to your website using the Web Share Target API</title>
							<link>https://justmarkup.com/articles/2020-02-11-share-images-to-your-website/</link>
							<pubDate>2020-02-11T10:46:43+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2020-02-11-share-images-to-your-website/</guid>
							<description>&lt;p&gt;Last year my daughter was born, and of course we wanted to be able to share pictures of her with family and friends. I could have used any of the available services to share photos/galleries with them, but I don&#39;t feel comfortable at all that pictures of here are saved somewhere I don&#39;t really have access to. So, I made a simple web app, where my partner and me can upload the images to my server and family and friends can see them if they have the credentials.&lt;/p&gt;
&lt;p&gt;To make it more convenient for us, I added the possibility to share photos directly from the phone gallery to the website. In this article, you will learn how to use the Web Share API to share images to your website and handle the data.&lt;/p&gt;
&lt;h2 id=&quot;manifest&quot;&gt;Manifest &lt;a class=&quot;permalink&quot; href=&quot;#manifest&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To be able to use the &lt;a href=&quot;https://wicg.github.io/web-share-target/&quot;&gt;Web Share Target API&lt;/a&gt; we first need to add a &lt;code&gt;share_target&lt;/code&gt; entry to our Web App Manifest (manifest.webmanifest).&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&quot;share_target&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;action&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./upload&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;method&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;enctype&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;multipart/form-data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;params&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;&quot;files&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token property&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;file&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token property&quot;&gt;&quot;accept&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;image/*&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;params&lt;/code&gt; keys will be used as query parameters when the target is launched, so you can access them from /upload just like an HTML form submission has happened.&lt;/p&gt;
&lt;p&gt;So, the same data will be send to /upload as if we used this form:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;form&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;./upload&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;enctype&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;multipart/form-data&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;POST&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Select images: &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;multiple&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Upload your images&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this in place, now let&#39;s see how to handle the data once a user shares them with our site.&lt;/p&gt;
&lt;h2 id=&quot;handling-the-data&quot;&gt;Handling the data &lt;a class=&quot;permalink&quot; href=&quot;#handling-the-data&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We can handle the data like any other POST request to our server. In Node.js this would look like this:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; multer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;multer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; upload &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;multer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  limits&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    fileSize&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1024&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/upload&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; upload&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;single&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; file &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// now you can do whatever you want with the file &lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The other option is to handle the request via an Service Worker. Here, we listen on the fetch event, check if the request method is POST and the URL is the one defined as action in our &lt;code&gt;share_target&lt;/code&gt; in the Manifest file.&lt;/p&gt;
&lt;p&gt;If this is the case, we redirect the user to our defined page and send the file data via &lt;code&gt;postMessage&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;fetch&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// ignore all requests with are not of method POST and which are not the URL we defined in in share_target as action&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;method &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;POST&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;startsWith&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;https://justmarkup.com/demos/web-share-target-image-to-grayscale/upload&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Code mostly from https://paul.kinlan.me/file-web-share-target/&lt;/span&gt;&lt;br&gt;    event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;respondWith&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Response&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;https://justmarkup.com/demos/web-share-target-image-to-grayscale/output.html&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitUntil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; data &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;formData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; client &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;resultingClientId &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;clientId&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; file &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// send the image data to the client&lt;/span&gt;&lt;br&gt;        client&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; action&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;load-image&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, on the client (output.html) we can listen to &lt;code&gt;onmessage&lt;/code&gt; event and do some stuff with the image data we received.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; imageBlob &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// we now have the file data and can for example use it as a source for an img with the id image on our page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; image &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;image&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createObjectURL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageBlob&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After all the code and explanation, let&#39;s look at a demo.&lt;/p&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo &lt;a class=&quot;permalink&quot; href=&quot;#demo&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Ever wanted to easily convert an image to an grayscale image on your phone? I do sometimes, and that&#39;s why I build a demo using the Web Share Target API to achieve exactly that.&lt;/p&gt;
&lt;p&gt;For this I used the Service Worker way to handle the data. Once the data is received on the client, I use drawImage from canvas to draw the image in canvas, use the grayscale filter to convert it to a grayscale image and output the final image.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; imageBlob &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; image &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;image&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createObjectURL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageBlob&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; canvas &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;canvas&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; img &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;img&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; ctx &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getContext&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;2d&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createObjectURL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageBlob&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;crossOrigin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;anonymous&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;width &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;width&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;height &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;height&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        ctx&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;filter &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;grayscale(100%)&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        ctx&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;drawImage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;img&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;width&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;height&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; data &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toDataURL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;image/jpeg&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the final &lt;a href=&quot;https://justmarkup.com/demos/web-share-target-image-to-grayscale/&quot;&gt;demo&lt;/a&gt; and you can find the code on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/web-share-target-image-to-grayscale&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;support&quot;&gt;Support &lt;a class=&quot;permalink&quot; href=&quot;#support&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Currently the Web Share Target API is only &lt;a href=&quot;https://www.chromestatus.com/feature/6124071381106688&quot;&gt;supported in Chrome&lt;/a&gt; and also only on Android. Nevertheless, this is a good progressive enhancement. If the browser supports if you can enhance the  upload experience and let users directly share images from their phone without opening the site first.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Eight years</title>
							<link>https://justmarkup.com/notes/2020-01-31-eight-years/</link>
							<pubDate>2020-01-31T10:13:20+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-01-31-eight-years/</guid>
							<description>&lt;p&gt;It&#39;s been eight years since I launched this site with my first article.&lt;/p&gt;
&lt;p&gt;Since then I published 130 more articles and notes and one even explains why this site is named &lt;a href=&quot;https://justmarkup.com/log/2018/11/just-markup/&quot;&gt;justmarkup&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/notes/2019-01-31-seven-years/&quot;&gt;Last year&lt;/a&gt; I wrote that I plan to switch from WordPress to a Static Site generator. This is done now, and this site is now using &lt;a href=&quot;https://www.11ty.dev/&quot;&gt;11ty&lt;/a&gt; and I am more than happy with it. If you are curious, the code behind this very site can be found on &lt;a href=&quot;https://github.com/justmarkup/blog&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I haven&#39;t written a lot last year for various reasons, but now I really enjoy it again and plan to write more frequently this year. There will be more tutorials again how to build accessible, progressive-enhanced stuff as well as my thoughts about web stuff and in general which you can all see in my &lt;a href=&quot;https://justmarkup.com/note/&quot;&gt;Notes section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Oh, and early this year I added an info box underneath each article, about ways to support me. Thanks to everybody reading, sharing and discussing my articles. Thank you.&lt;/p&gt;
&lt;p&gt;On to the next eight years!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Boring by default</title>
							<link>https://justmarkup.com/notes/2020-01-14-boring-by-default/</link>
							<pubDate>2020-01-14T19:42:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2020-01-14-boring-by-default/</guid>
							<description>&lt;p&gt;When starting a new web project one often reaches for new cutting-edge technologies to be up-to-date. However, why not start with the basics first and add stuff on top if you really need it. Boring by default.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I really like new and cutting-edge technology, but lately, I feel more and more that we&#39;re just over-engineering everything... 😢&lt;/p&gt;
&lt;p&gt;I spent the last hour solving problems that I wouldn&#39;t have had with a &amp;quot;traditional stack&amp;quot;, static HTML and some hand-written JavaScript.&lt;/p&gt;
&lt;p&gt;— Stefan Judis (@stefanjudis) &lt;a href=&quot;https://twitter.com/stefanjudis/status/1213906461543321602?ref_src=twsrc%5Etfw&quot;&gt;January 5, 2020&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As Stefan and many others, I also often see and experience over-engineered sites regularly. Let&#39;s see why starting with a traditional, or boring stack may not be the worst idea.&lt;/p&gt;
&lt;h2 id=&quot;start-with-the-basics&quot;&gt;Start with the basics &lt;a class=&quot;permalink&quot; href=&quot;#start-with-the-basics&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When starting a new website all you need to build it is a computer, an editor and a browser to view it. Yes, that&#39;s all – no need for a build script or task runners or for installing something via npm. Yet, nowadays we tend to over-complicate all of this. The arguments for this are that it makes it so much easier to build a site using all this tools, another is that you will clearly need all of this once several people work on the project and/or the project is getting large.&lt;/p&gt;
&lt;p&gt;These are all valid points, but to you really need this all from the beginning? What if you abandon the project (like the millions of half-finished side-projects out there), or find that a static HTML page is all you need.&lt;/p&gt;
&lt;h2 id=&quot;maintenance&quot;&gt;Maintenance &lt;a class=&quot;permalink&quot; href=&quot;#maintenance&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Ever needed to change &amp;quot;just a small thing&amp;quot; on an old page you build years ago? I recently had the pleasure and the simple task of changing some colors in CSS lead to a whole day of me wrangling with old deprecated Grunt tasks and trying to get the build task running.&lt;/p&gt;
&lt;p&gt;The same will happen to you as well some day, everybody used Grunt back then and almost nobody does today, the same will probably also happen to Babel or other tools – at least you would have to get an old version running which isn&#39;t supported anymore at the time you want to change some CSS in 2025.&lt;/p&gt;
&lt;p&gt;That&#39;s why starting with HTML, CSS and JavaScript without the need to ever compile anything on your local machine is a good idea. Changing some colors on such a page would indeed only take minutes and not a whole day.&lt;/p&gt;
&lt;h2 id=&quot;it-depends&quot;&gt;It depends &lt;a class=&quot;permalink&quot; href=&quot;#it-depends&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;That said, if your whole team is really into React or Vue or AnotherFrameworkDevelopedRightNow and you know for sure that using these tools is the perfect choice for you. Use that. But, don&#39;t tell others they also have to and that this is the only way to build things – it all depends.&lt;/p&gt;
&lt;p&gt;Your job as an developer is to decide, to decide what tools to use, to decide what frameworks to use, to decide what to prioritize, to decide what is the best way to maintain a project – a lot of questions only your team is able to answer.&lt;/p&gt;
&lt;p&gt;Again, it all depends.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Never feel ashamed to start with a traditional (boring) stack – you may be the one launching a great project, while others still set up there build scripts.&lt;/p&gt;
&lt;p&gt;Be boring by default and enhance on the way.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Do&#39;s and Don&#39;ts of implementing a hamburger menu</title>
							<link>https://justmarkup.com/articles/2019-12-04-hamburger-menu/</link>
							<pubDate>2019-12-04T08:20:43+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2019-12-04-hamburger-menu/</guid>
							<description>&lt;p&gt;The infamous hamburger menu is one of the examples where I see bad practice very often. Surf the web one day using a screen reader or using only your keyboard and you will most likely experience some of the problems as well. Let&#39;s have a look at the most common errors and how to avoid them.&lt;/p&gt;
&lt;h2 id=&quot;using-the-hamburger-menu&quot;&gt;Using the hamburger menu &lt;a class=&quot;permalink&quot; href=&quot;#using-the-hamburger-menu&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before even thinking about the best way to implement a hamburger menu, one should ask if it is even needed at all. There are various &lt;a href=&quot;https://bradfrost.com/blog/post/responsive-nav-patterns/&quot;&gt;Responsive&lt;/a&gt; &lt;a href=&quot;https://www.smashingmagazine.com/2017/04/overview-responsive-navigation-patterns/&quot;&gt;Navigation&lt;/a&gt; &lt;a href=&quot;https://responsivenavigation.net/&quot;&gt;Patterns&lt;/a&gt; to use instead. Lately, there is also the trend to use a hamburger menu on large screens – while this may look fancy – it means that users have to click two times to go to one of the listed pages. So, if there is space, it is better to directly show all navigation items and only hide them behind the hamburger toggle on small screens.&lt;/p&gt;
&lt;p&gt;Okay, so you still think a hamburger menu is the best choice for the site you are building? Let&#39;s see what to consider when implementing it.&lt;/p&gt;
&lt;h2 id=&quot;the-icon&quot;&gt;The icon &lt;a class=&quot;permalink&quot; href=&quot;#the-icon&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We start with the hamburger icon, also referred to as Navicon. Let&#39;s start with some bad examples and see what better alternatives there are available.&lt;/p&gt;
&lt;p&gt;Many use the Unicode sign for &lt;a href=&quot;http://www.fileformat.info/info/unicode/char/2261/browsertest.htm&quot;&gt;&#39;IDENTICAL TO&#39; (U+2261)&lt;/a&gt; or the one for &lt;a href=&quot;http://www.fileformat.info/info/unicode/char/2630/browsertest.htm&quot;&gt;&#39;TRIGRAM FOR HEAVEN&#39; (U+2630)&lt;/a&gt; to visually show the three lines. The first problem with this approach of showing the icon is, that not all browsers support these Unicode signs and also not all fonts do, which means these users will see a square  □ (also called tofu or &lt;a href=&quot;http://unicode.org/glossary/#replacement_glyph%5D&quot;&gt;replacement Glyph&lt;/a&gt; instead of the three lines.&lt;/p&gt;
&lt;p&gt;The bigger problem with this approach is that screen readers may announce the U+2630 sign as &lt;a href=&quot;https://www.htmhell.dev/11-the-trigram-for-heaven/&quot;&gt;&amp;quot;the trigram for heaven&amp;quot;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We could use something like:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;nav-toggle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-expanded&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;false&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-controls&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;menu&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-hidden&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;true&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;☰&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt; Menu&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to hide the glyph for screen readers, so only the word &amp;quot;Menu&amp;quot; would get announced, but we may still run into browser/font support problems. Another approach many used and sadly still use is using an icon font. Regarding this, I can only say –  &lt;a href=&quot;https://cloudfour.com/thinks/seriously-dont-use-icon-fonts/&quot;&gt;Seriously, Don’t Use Icon Fonts&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now that we know, what not to use, see some good examples to achieve this. The first way is to use an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;, with an empty alt attribute as it is purely decorative.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;nav-toggle&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-expanded&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;false&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-controls&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;menu&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;menu.svg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  Menu&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We could also rebuild the three lines with CSS using box-shadow, gradient or borders and a &lt;a href=&quot;https://css-tricks.com/three-line-menu-navicon/#article-header-id-1&quot;&gt;pseudo element&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Another approach would be to use an SVG directly in the HTML. In this case, you have to set &lt;code&gt;aria-hidden=&amp;quot;true&amp;quot;&lt;/code&gt; and &lt;code&gt;focusable=&amp;quot;false&lt;/code&gt; for the SVG element, as described here by &lt;a href=&quot;https://www.sarasoueidan.com/blog/accessible-icon-buttons/#icon-sitting-next-to-text&quot;&gt;Sara Soueidan&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Really bad&lt;/strong&gt;&lt;/em&gt;: Use Unicode without aria hidden. Use icon font.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Still not good&lt;/strong&gt;&lt;/em&gt;: Use Unicode icon with aria hidden&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/em&gt;: Use img, CSS or an SVG and not use the icon alone&lt;/p&gt;
&lt;h2 id=&quot;the-toggle-button&quot;&gt;The toggle button &lt;a class=&quot;permalink&quot; href=&quot;#the-toggle-button&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now let&#39;s move on to the toggle button. As you hopefully guessed right, it is called button because we should use a real &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;. Still, many people sadly use &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; for the toggle button. Many argue that a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; is hard to style with CSS, but this is not true and you can quite easily &lt;a href=&quot;https://hankchizljaw.com/wrote/introducing-the-button-element/#heading-oh-these-are-hard-to-style-though&quot;&gt;reset the styles&lt;/a&gt; so it looks like a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The same is true if you think using a &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; is the right choice here. It is not, a link is called a link because it is used to link to other pages or other parts of the pages and not to provide functionality.&lt;/p&gt;
&lt;p&gt;Great, now that we know we have to use a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, you may think that it is the best way to server-side render it because client-side rendering is all bad, right? As much this is true for content, it is not for interactive elements which are pretty much useless without JavaScript.&lt;/p&gt;
&lt;p&gt;First let&#39;s start with the fallback version which works completely without JavaScript and shows all navigation items directly.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-menu-button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;      Menu&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;menu&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-menu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Home&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/about&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;About&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/shop&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Shop&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/contact&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Contact&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See the div there, didn&#39;t I just say that we should never use a &lt;code&gt;div&lt;/code&gt; for a button? Yes, this is still right, but this is only a placeholder that we will later replace with a real &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;. We also use the hidden attribute here to hide it, so it won&#39;t be visible and also will not be announced by screen readers.&lt;/p&gt;
&lt;p&gt;Another alternative is to use a &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; with an anchor link to the navigation in the footer. In both ways the navigation is still accessible if JavaScript fails and no useless buttons are shown.&lt;/p&gt;
&lt;p&gt;Now, let&#39;s enhance that when JavaScript is available and ready.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fakeButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-menu-button]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; menu &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-menu]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; toggleMenuButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  toggleMenuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; fakeButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  toggleMenuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  toggleMenuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-controls&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;menu&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  toggleMenuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;nav__toggle&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  fakeButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentNode&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replaceChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;toggleMenuButton&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; fakeButton&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  toggleMenuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; expanded &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;true&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;expanded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;hidden &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;hidden &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we replace the fake button with a real &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, add &lt;code&gt;aria-expanded&lt;/code&gt; and &lt;code&gt;aria-controls&lt;/code&gt; attributes and add an EventListener which toggles the visibility of our menu and also updates the ARIA attributes accordingly. You can find an unstyled example of this on &lt;a href=&quot;https://output.jsbin.com/jagupinila&quot;&gt;JS Bin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We now have all the functionality we want and still make the navigation available if JavaScript fails.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Really bad&lt;/strong&gt;&lt;/em&gt;: Use anything else as a real button element&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Still not good&lt;/strong&gt;&lt;/em&gt;: Render the button server-side&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/em&gt;: Use a client-side generated button with appropriate ARIA&lt;/p&gt;
&lt;h2 id=&quot;the-checkbox-hack&quot;&gt;The checkbox hack &lt;a class=&quot;permalink&quot; href=&quot;#the-checkbox-hack&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At this point you may wonder – Isn&#39;t there a CSS-only way to achieve this? You may also remember hearing about a way to toggle content using the so-called Checkbox Hack and may consider using that. Please don&#39;t, as it involves some usability and accessibility concerns. So, forget that it even exists.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Really bad&lt;/strong&gt;&lt;/em&gt;: Even thinking about using it.&lt;/p&gt;
&lt;h2 id=&quot;styling-and-user-preferences&quot;&gt;Styling and user preferences &lt;a class=&quot;permalink&quot; href=&quot;#styling-and-user-preferences&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Okay, as a last step let&#39;s see what can go wrong with styling and why we should respect user preferences.&lt;/p&gt;
&lt;p&gt;First, you should, as always, check the contrast ratio, for example using this &lt;a href=&quot;https://whocanuse.com/&quot;&gt;tool&lt;/a&gt;. You should also check the navigation in high-contrast mode.&lt;br&gt;
Also, make sure that the click target of the links is big enough.&lt;/p&gt;
&lt;p&gt;Be also sure to test it with small screens. I have quite often seen navigation with lots of links, but only the half of it where reachable to the user, so make sure to use &lt;code&gt;overflow: auto&lt;/code&gt; if your navigation is fixed to make the list scrollable.&lt;/p&gt;
&lt;p&gt;Also, if you are applying animations and or transitions for the show/hide effect, make use of the &lt;a href=&quot;https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/&quot;&gt;reduced motion media query&lt;/a&gt; to minimize/avoid these effects for everyone who prefers reduced motion.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Really bad&lt;/strong&gt;&lt;/em&gt;: Low contrast, too small click areas&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/em&gt;: Tested in high-contrast mode, great contrast, large click area and respecting user preference&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First of all, think twice before hiding content at the first place – avoiding extra clicks for the users is always a good idea. If you need to hide the navigation behind a toggle button, only do it on smaller screens where there is not enough space available and not on large screens where they would perfectly fit.&lt;/p&gt;
&lt;p&gt;Use an image, a SVG or a CSS approach to show the hamburger icon, avoid using the Unicode character or an icon font. It is also a good idea to show real text next to the icon, a simple &amp;quot;Menu&amp;quot; will do the trick. While the hamburger icon may be used by a lot of sites and apps, many people still have no idea what it means.&lt;/p&gt;
&lt;p&gt;Provide a basic version in case JavaScript fails, so users could at least continue to your other pages.&lt;/p&gt;
&lt;p&gt;Use a client-side generated &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; to toggle the menu and always use the appropriate ARIA properties to make it accessible.&lt;/p&gt;
&lt;p&gt;Last but not least, be sure to test your implementation with screen readers, only your keyboard and in high-contrast mode – you know, the basic tests you should make for every component and page you are building.&lt;/p&gt;
&lt;p&gt;Happy coding!&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.sarasoueidan.com/blog/accessible-icon-buttons/&quot;&gt;Accessible Icon Buttons&lt;/a&gt; by Sara Soueidan&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/three-line-menu-navicon/&quot;&gt;Three Line Menu Navicon&lt;/a&gt; by Chris Coyier&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.fileformat.info/info/unicode/char/2261/browsertest.htm&quot;&gt;Browser Test Page for Unicode Character &#39;IDENTICAL TO&#39; (U+2261)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.fileformat.info/info/unicode/char/2630/browsertest.htm&quot;&gt;Browser Test Page for Unicode Character &#39;TRIGRAM FOR HEAVEN&#39; (U+2630)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.htmhell.dev/11-the-trigram-for-heaven/&quot;&gt;HTMHELL - #11 The trigram for heaven&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://cloudfour.com/thinks/seriously-dont-use-icon-fonts/&quot;&gt;Seriously, Don’t Use Icon Fonts&lt;/a&gt; by Tyler Sticka&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bradfrost.com/blog/post/responsive-nav-patterns/&quot;&gt;Responsive Navigation Patterns&lt;/a&gt; by Brad Frost&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.a11ymatters.com/pattern/mobile-nav/&quot;&gt;Accessible Mobile Navigation&lt;/a&gt; by Ahmad Shadeed&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.smashingmagazine.com/2017/04/overview-responsive-navigation-patterns/&quot;&gt;A Brief Overview On Responsive Navigation Patterns&lt;/a&gt; by Chris Poteet&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://responsivenavigation.net/&quot;&gt;Adventures in Responsive Navigation&lt;/a&gt; by Erick Arbé&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://hankchizljaw.com/wrote/introducing-the-button-element/&quot;&gt;Introducing the Button element&lt;/a&gt; by Andy Bell&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://justmarkup.com/articles/2019-01-21-the-link-to-button-enhancement/&quot;&gt;The link to button enhancement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://whocanuse.com/&quot;&gt;Who can use&lt;/a&gt; by Corey Ginnivan&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/&quot;&gt;Revisiting prefers-reduced-motion, the reduced motion media query&lt;/a&gt; by Eric Bailey&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> image orientation on the web</title>
							<link>https://justmarkup.com/articles/2019-10-21-image-orientation/</link>
							<pubDate>2019-10-21T08:18:43+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/articles/2019-10-21-image-orientation/</guid>
							<description>&lt;p&gt;I am currently working on a little side project, where I upload images to my server (using file input and additionally Web Share Target) to make them available to others. While I had a first working version ready pretty quickly there was one problem – when uploading a portrait image from my phone, the image was shown with the wrong orientation.&lt;/p&gt;
&lt;p&gt;In this article you will learn about the current status of image orientation on the web, how to correct orientation of images using Node.js, and how browsers will handle this in the future.&lt;/p&gt;
&lt;h2 id=&quot;current-status&quot;&gt;Current status &lt;a class=&quot;permalink&quot; href=&quot;#current-status&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/testimg/Portrait_6.jpg&quot; alt=&quot;Young person behind a waterfall. Text on the image is top, right, bottom, left clockwise and in the center it says six.&quot;&gt;&lt;/p&gt;
&lt;p&gt;If you view this image (I it got from the &lt;a href=&quot;https://github.com/recurser/exif-orientation-examples&quot;&gt;exif orientation examples&lt;/a&gt;) it may show correctly in portrait mode or it may incorrectly be shown 90deg rotated to the left.&lt;/p&gt;
&lt;p&gt;You are most probably a browser on iOS if you see the word top actually at the top and another browser if you see the word top on the left. The reason for this is that the EXIF data for this image has the info &lt;em&gt;Rotate 90 CW&lt;/em&gt; for orientation.&lt;/p&gt;
&lt;p&gt;When you embed the image using &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;, or &lt;code&gt;background-image&lt;/code&gt; the image will be shown wrong in all browsers, except from browsers on iOS. If you, however, open the &lt;a href=&quot;https://justmarkup.com/testimg/Portrait_6.jpg&quot;&gt;image&lt;/a&gt; directly it will be shown correctly in Firefox, Chrome and Safari, but will still be shown wrong rotated in Edge and Internet Explorer. What a great consistency!&lt;/p&gt;
&lt;h2 id=&quot;the-image-orientation-property&quot;&gt;The image-orientation property &lt;a class=&quot;permalink&quot; href=&quot;#the-image-orientation-property&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When looking for possible ways to fix orientation using CSS or JavaScript I found about the &lt;a href=&quot;https://drafts.csswg.org/css-images/#the-image-orientation&quot;&gt;image-orientation property&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;At the moment this property is only supported in Firefox and you can use it this way so browsers honor the EXIF data and &lt;em&gt;fix&lt;/em&gt; the orientation:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;image-orientation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; from-image&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When looking for more information I also found that this property is already &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/4164&quot;&gt;deprecated&lt;/a&gt; which was confusing to me at first, because this property would be an easy way for me to fix my issue with image orientation if it would be supported by all browsers.&lt;/p&gt;
&lt;p&gt;After reading some more through the Github issue, I learned that the plan is that all browsers will honor the EXIF orientation in the future, and therefore will use &lt;code&gt;image-orientation: from-image&lt;/code&gt; by default. Great, that&#39;s what I want!&lt;/p&gt;
&lt;h2 id=&quot;fixing-the-orientation-with-node.js&quot;&gt;Fixing the orientation with Node.js &lt;a class=&quot;permalink&quot; href=&quot;#fixing-the-orientation-with-node.js&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We learned so far that there is quite some disagreement among browsers how to deal with EXIF orientation and no cross-browser way to easily correct it on the front end. In short, it is quite a mess and as we don`t want that some users will see &lt;em&gt;broken&lt;/em&gt; images, let&#39;s see how we can &lt;em&gt;fix&lt;/em&gt; this using Node.js.&lt;/p&gt;
&lt;p&gt;First, we need a form to upload our images:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;form&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;./upload&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;enctype&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;multipart/form-data&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;POST&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Select image: &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;multiple&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;accept&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;image/*&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Upload your photos&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you select an image and submit the form a POST request will be made to /upload, so let&#39;s see the upload route next:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/upload&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; upload&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; res&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; images &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;files&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;image &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; images&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;correctOrientation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;image&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;./show&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We are using multer as a middleware here to process the images and for every image we call &lt;code&gt;correctOrientation&lt;/code&gt; to correct the orientation.&lt;/p&gt;
&lt;p&gt;Before we look into &lt;code&gt;correctOrientation&lt;/code&gt;, here is the multer configuration we are using to save images to our /uploads folder.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; storage &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; multer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;diskStorage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token function-variable function&quot;&gt;destination&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; cb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token function&quot;&gt;cb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; path&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;__dirname&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;uploads&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token function-variable function&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; cb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token function&quot;&gt;cb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Date&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;__&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;originalname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; upload &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;multer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; storage&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; storage &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, let&#39;s see the interesting part - the correction of the image orientation:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;readFileAsync&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;resolve&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;readFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            err &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;correctOrientation&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; imageOrientation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; rotateDeg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; buffer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;modifyExif&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;readFileAsync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;path&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;__dirname&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;uploads&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;filename&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        imageOrientation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; data &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0th&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0th&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;274&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0th&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;274&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageOrientation&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageOrientation &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                imageOrientation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                data&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0th&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;274&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// reset EXIF orientation value&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageOrientation&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;imageOrientation&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                rotateDeg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;180&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                rotateDeg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;270&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                rotateDeg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                reak&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                rotateDeg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;        Jimp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;buffer&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; lenna&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;err&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;            lenna&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rotateDeg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// correct orientation&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;path&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;__dirname&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;uploads&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;filename&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// save&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First we define &lt;code&gt;readFileAsync&lt;/code&gt; which turns the fs.readFile function in to a promise.&lt;/p&gt;
&lt;p&gt;Now, let&#39;s see what we have in the actual function. First, we are using the &lt;a href=&quot;https://www.npmjs.com/package/modify-exif&quot;&gt;modify-exif package&lt;/a&gt; to set the EXIF orientation value for every image to the value of &lt;em&gt;1&lt;/em&gt; (the default one) if it was not already &lt;em&gt;1&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;After we changed the EXIF information, we now use &lt;a href=&quot;https://www.npmjs.com/package/jimp&quot;&gt;jimp&lt;/a&gt; to rotate the image according to EXIF orientation value we got before and re-save the image.&lt;/p&gt;
&lt;p&gt;And that&#39;s it - all images are now correctly shown in every browser.&lt;/p&gt;
&lt;p&gt;You can find the &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/image-orientation&quot;&gt;full example&lt;/a&gt; on Github.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As of now, the only browser honoring the EXIF orientation is browsers on iOS, but there is hope that all other browsers will sooner or later also honor it and show the correct orientation. This way this issue would get solved automatically and we developers have one less issue to deal with.&lt;/p&gt;
&lt;p&gt;However, for the moment the only way to fix the orientation problem, is by removing the EXIF orientation data and rotating the image accordingly which can either be done manually or using your favorite back end. It would also be possible to correct it on the client-side using JavaScript, but I advise against it as we should outsource as less as possible of the heavy work to the front end and therefore the user.&lt;/p&gt;
&lt;p&gt;Happy coding and don`t forget to tell your favorite browser that they should honor EXIF orientation and fix this issue.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Closing feediary</title>
							<link>https://justmarkup.com/notes/2019-10-05-behind-closing-feediary/</link>
							<pubDate>2019-10-05T12:20:10+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2019-10-05-behind-closing-feediary/</guid>
							<description>&lt;p&gt;When I finally launched feediary last summer I was really excited. It was my first side project which I turned into a business. It was the first time I asked users to pay for my project. It was scary.&lt;/p&gt;
&lt;h3 id=&quot;from-fun-to-business&quot;&gt;From fun to business &lt;a class=&quot;permalink&quot; href=&quot;#from-fun-to-business&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;It all started when I was looking for a RSS reader. I wanted to use RSS again and wanted a tool which respects privacy, can be used on the web and is accessible. None of the available options offered all of these, so I started to build my own. Time went by, the project got bigger and bigger, I added more and more features. It was a great time and a lot of fun. I was looking forward to evenings and weekends where I could work on feediary.&lt;/p&gt;
&lt;p&gt;At some point I asked myself – This is really useful for me, so why not make it available for everyone. I had three options at this time. The first was to integrate lots of advertisement to be able to pay the recurring costs. The second one was to open-source it so everybody could install it on their server. The third one was to use a subscription model and offer a Free and a PRO plan. As using advertisement (which I already dislike) also means using tracking (which I hate) this was no option at all. So, I thought about open-sourcing it, which would mean that only people who know how to run a server and install everything would be able to use it. So, I decided to try the subscription model.&lt;/p&gt;
&lt;p&gt;This sounds easy at first, add a new user role, make some features only available to PRO users, add payment to the registration and done. It took me a lot of time and swearing to get this all running. One of my goals was to use as less third-party as possible and regarding payment this was a bad idea. As I am based in Europe I have to participate in VAT MOSS (collecting VAT based on country of user), which was/is not supported by stripe (the only third-party I decided to use because nobody wants/can directly integrate payment without a third-party), and which lead to a lot of work for me. I had to check which country the user is from, check if the user has a business (by checking their VAT identification number and if it is valid) and then calculate the correct VAT. I really should have used a service which helps with this, but was too narrow-minded to trust any of these third-party tools.&lt;/p&gt;
&lt;p&gt;Anyway, after some time I got it all running and feediary was ready for the public. The day of the launch came and it went really well. Within two hours after announcing it I already had my first PRO user – I was really enthusiastic and was looking forward to the fun again after all the hard work.&lt;/p&gt;
&lt;h3 id=&quot;money%2C-money%2C-money&quot;&gt;Money, Money, Money &lt;a class=&quot;permalink&quot; href=&quot;#money%2C-money%2C-money&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Time went by. Every day new users registered for feediary, I now spend a lot of time with support and at the same time fixing bugs and adding new features – still all in my free time after/before work. It was fun and exciting, besides that only very few (about 0.2% of all all users) decided to actually pay for feediary and upgrade to the PRO plan. From my rough estimates I knew that I need at least 3% PRO users to pay for all the recurring costs, so every month the ratio was below that I lost money. I am not counting all the money I invested by my work and time, but this was real money I had to pay so that others could use feediary. And every month it got a little more, because more users means more data, means more database and server cost.&lt;/p&gt;
&lt;p&gt;So, I tried to increase the free-to-pro ratio by adding more features for the PRO plan, by telling everyone how awesome it is to be a feediary PRO user. It didn&#39;t really help.&lt;/p&gt;
&lt;p&gt;It got frustrating to see a growing list of features and bugs I had to work on, and at the same time the certainty that I loose money every day if I can&#39;t find enough users to upgrade.&lt;/p&gt;
&lt;h3 id=&quot;the-end&quot;&gt;The end &lt;a class=&quot;permalink&quot; href=&quot;#the-end&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Fast forward to early summer of 2019 when I first heard about &lt;a href=&quot;https://stripe.com/de/guides/strong-customer-authentication&quot;&gt;Strong Customer Authentication (SCA)&lt;/a&gt; and that I need to completely change my custom payment methods. I had about two months to finish this, as by 14th of September this had to be done.&lt;/p&gt;
&lt;p&gt;At the beginning I was confident to finish it, but every week I worked on and couldn&#39;t finish I got more and more frustrated. At this point there was no fun left, it was all boring and frustrating work.&lt;/p&gt;
&lt;p&gt;I also felt less and less confident that I will reach the needed free-to-pro ratio any time soon. I thought about spending money on advertisement to make feediary more known, but I personally dislike ads, feediary was all against ads and honoured privacy - so investing in ads was a no-go. I thought about going PRO-only. I thought about many ways to make it work. To make it fun again for me.&lt;/p&gt;
&lt;p&gt;In the end I decided to let it go, to close feediary, to make it a fun project for me again and do not worry all the time about it.&lt;/p&gt;
&lt;h3 id=&quot;the-future&quot;&gt;The future &lt;a class=&quot;permalink&quot; href=&quot;#the-future&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;All in all it was a fantastic experience, from the beginning to the end. I really learned a ton and it was fun - most of the time. Ready for my next adventure now.&lt;/p&gt;
</description>
						</item>
				
			
			
			
				
							
						
						
						<item>
							<title> Version Eight</title>
							<link>https://justmarkup.com/notes/2019-05-06-version-eight/</link>
							<pubDate>2019-05-06T12:50:10+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/notes/2019-05-06-version-eight/</guid>
							<description>&lt;p&gt;I just released a new version of &lt;a href=&quot;http://justmarkup.com/&quot;&gt;justmarkup.com&lt;/a&gt;. 🎉 This is now the 8th version of this site and while it is still far from perfect, I decided it is about time to release it anyway.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/img/version-eight.png&quot; alt=&quot;The eight version of justmarkup.com&quot;&gt;&lt;/p&gt;
&lt;p&gt;In terms of layout there isn&#39;t much of a change since the last version, but I tried to make it more readable and also improved the design of the code examples and the embed data. I certainly will tweak the design more in the next weeks and also plan to make extra design for some pages - Whenever I find the time for that.&lt;/p&gt;
&lt;p&gt;I also decided to not use web fonts for now - mostly because I couldn&#39;t decide which one to use, but I definitely plan to use one for recurring visitors in the future.&lt;/p&gt;
&lt;p&gt;The biggest change in this version is that it is no longer using WordPress. Instead I now use &lt;a href=&quot;https://www.11ty.io/&quot;&gt;Eleventy&lt;/a&gt; and I am pretty happy about it so far. As I first step I transformed all my WordPress posts to Markdown using &lt;a href=&quot;https://justmarkup.com/articles/2019-01-04-using-puppeteer-to-crawl-pages-and-save-them-as-markdown-files/&quot;&gt;puppeteer&lt;/a&gt;, and from there I used the &lt;a href=&quot;https://github.com/11ty/eleventy-base-blog/&quot;&gt;Eleventy Base Blog&lt;/a&gt; as a starting point.&lt;/p&gt;
&lt;p&gt;The main benefits of the switch are that I now can use Markdown for writing (I already did this in the past, but now I don&#39;t need to convert to WordPress Posts anymore), and that the performance improved quite a bit.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/img/lighthouse-justmarkup-com.png&quot; alt=&quot;Lighthouse report for justmarkup.com showing 100 points for all sections&quot;&gt;.&lt;/p&gt;
&lt;p&gt;Some may miss the possibility to comment on an article. While I won&#39;t bring back regular comments I will implement &lt;a href=&quot;https://indieweb.org/Webmention&quot;&gt;Webmentions&lt;/a&gt; soon and will also show all old comments underneath the article.&lt;/p&gt;
&lt;p&gt;You can find the code on &lt;a href=&quot;https://github.com/justmarkup/blog/&quot;&gt;Github&lt;/a&gt; and if you find anything you want me to change, please open an issue there or let me know on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;Twitter&lt;/a&gt; or via &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
</description>
						</item>
				
			
			
			
			
			
			
				
				
			
			
			
			
			
			
				
							
						
						
						<item>
							<title> Adapting to user preferences</title>
							<link>https://justmarkup.com/log/2019/02/adapting-to-user-preferences/</link>
							<pubDate>2019-02-19T15:48:43+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2019/02/adapting-to-user-preferences/</guid>
							<description>&lt;p&gt;Over the last years, browsers implemented various features to react to user preferences on the web using CSS, JavaScript or by checking for preferences on the server-side. In this article, I would like to show which user preferences are currently exposed by browsers, the best way to handle them and a look in to the future to see what might be available soon.&lt;/p&gt;
&lt;h2 id=&quot;reduced-motion&quot;&gt;Reduced Motion &lt;a class=&quot;permalink&quot; href=&quot;#reduced-motion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s start with the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion&quot;&gt;prefers-reduced-motion media query&lt;/a&gt;. It was introduced in Safari 10.1 and is currently (February 2019) &lt;a href=&quot;https://caniuse.com/#feat=prefers-reduced-motion&quot;&gt;supported&lt;/a&gt; in the latest versions of Safari, iOS Safari, Firefox and Chrome.&lt;/p&gt;
&lt;p&gt;The prefers-reduced-motion media feature is used to detect if the user has requested the system minimize the amount of animation or motion it uses. You can either detect it using a CSS media query&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;prefers-reduced-motion&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; reduce&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* disable animations/transitions */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or you can also use JavaScript to check if the users prefers reduced motion:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; motionQuery &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;matchMedia&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;(prefers-reduced-motion)&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;handleReduceMotionChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;motionQuery&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;matches&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* disabled animations/transitions */&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* enable animations/transitions */&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;motionQuery&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;handleReduceMotionChanged&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token function&quot;&gt;handleReduceMotionChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The safest way to disable all CSS animations and transitions is to use:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;prefers-reduced-motion&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; reduce&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token selector&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would however also not trigger &lt;a href=&quot;https://twitter.com/scottjehl/status/1086287082031583232&quot;&gt;animation start/end events or keyframe states&lt;/a&gt;, so if your code relies on them you might use:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;@​media (prefers-reduced-motion: reduce)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token selector&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;animation-duration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.1s &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;transition-duration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.1s &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is the safest solution, but it might not be the best solution as you may still want to use animations/transitions for some parts even if the user prefers reduced motion. I recommend reading &lt;a href=&quot;https://alistapart.com/article/designing-safer-web-animation-for-motion-sensitivity&quot;&gt;Designing Safer Web Animation For Motion Sensitivity&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/vlh&quot;&gt;Val Head&lt;/a&gt; to learn more about when it is a good idea to use animations or transitions.&lt;/p&gt;
&lt;h2 id=&quot;prefers-color-scheme&quot;&gt;prefers-color-scheme &lt;a class=&quot;permalink&quot; href=&quot;#prefers-color-scheme&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The next user preference is the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme&quot;&gt;prefers-color-scheme media query&lt;/a&gt; which is currently (February 2019) only &lt;a href=&quot;https://caniuse.com/#feat=prefers-color-scheme&quot;&gt;supported in Safari 12.1&lt;/a&gt;. It will however also be supported by &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1494034#c20&quot;&gt;Firefox&lt;/a&gt; soon and &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=889087&quot;&gt;Chrome&lt;/a&gt; will also add support in the future.&lt;/p&gt;
&lt;p&gt;The prefers-color-scheme media query is probably better known by Dark/Light mode which you can enable on MacOs in preferences.&lt;/p&gt;
&lt;p&gt;In CSS you can use the following media query to check if a user prefers dark mode. For light mode the query would be prefers-color-scheme: light.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;prefers-color-scheme&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; dark&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* adust styles for dark mode */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As it is a media query you can also use JavaScript to check for it:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; colorSchemeQuery &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;matchMedia&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;(prefers-color-scheme: dark)&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;handleColorSchemeChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;colorSchemeQuery&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;matches&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* dark mode */&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* light mode */&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;colorSchemeQuery&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;handleColorSchemeChanged&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token function&quot;&gt;handleColorSchemeChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can read more about &lt;a href=&quot;https://stuffandnonsense.co.uk/blog/redesigning-your-product-and-website-for-dark-mode&quot;&gt;designing for dark mode&lt;/a&gt; in this article by &lt;a href=&quot;https://twitter.com/Malarkey&quot;&gt;Andy Clarke&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;save-data&quot;&gt;Save data &lt;a class=&quot;permalink&quot; href=&quot;#save-data&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On to the next one – the &lt;a href=&quot;https://wicg.github.io/netinfo/#dom-networkinformation-savedata&quot;&gt;SaveData request header&lt;/a&gt;. Users can activate the SaveData mode in their browser and we as developers can use that information to deliver a *light* version. This means we could serve system fonts instead of web fonts if save data is enabled or serve low-res images instead of high-res and much more.&lt;/p&gt;
&lt;p&gt;We can either detect it via JavaScript using:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;connection&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;saveData &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// saveData mode is enabled - don&#39;t load heavy assets like high-res images or webfonts&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or you can also detect it on the server-side, here is an example in PHP:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;HTTP_SAVE_DATA&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;strtolower&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;HTTP_SAVE_DATA&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;on&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// `Save-Data` detected!&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token variable&quot;&gt;$saveData&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is currently no media query for saveData and while we probably never get &lt;a href=&quot;https://www.smashingmagazine.com/2013/01/bandwidth-media-queries-we-dont-need-em/&quot;&gt;bandwith media query&lt;/a&gt; there is hope that there will be a save data media query in the future.&lt;/p&gt;
&lt;p&gt;Fore more infos on delivering fast and light applications with Save-Data I recommend &lt;a href=&quot;https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/save-data/&quot;&gt;this article&lt;/a&gt;:&lt;/p&gt;
&lt;h2 id=&quot;do-not-track&quot;&gt;Do Not Track &lt;a class=&quot;permalink&quot; href=&quot;#do-not-track&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next is the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT&quot;&gt;Do Not Track request header&lt;/a&gt;, which I &lt;a href=&quot;https://justmarkup.com/log/2018/03/do-not-track-user-preference/&quot;&gt;wrote about&lt;/a&gt; before as I am all against tracking and had great hopes in this feature. Unfortunately, &lt;a href=&quot;https://webkit.org/blog/8594/release-notes-for-safari-technology-preview-75/&quot;&gt;Safari Technoloy Preview 75&lt;/a&gt; disabled the feature recently, as it was used by some sites for – wait for it – tracking; Oh the irony.&lt;/p&gt;
&lt;p&gt;So while I am not sure if other browsers will also disable it, it is still great and gives you extra karma if you honour the Do Not Track setting. It can again be checked via JavaScript:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; doNotTrack &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;doNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;doNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;yes&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;msDoNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;doNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;doNotTrack&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* load analytics if you really need to */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can also check for Do Not Track on the server-side, again here an example in PHP:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$donottrack&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;HTTP_DNT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;HTTP_DNT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$donottrack&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;embed analytics script if you really need to&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;let-the-user-decide&quot;&gt;Let the user decide &lt;a class=&quot;permalink&quot; href=&quot;#let-the-user-decide&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While it is great if you honour user preferences you should also make sure that users can override it on your site. A user may prefer dark mode in general, but may prefer light mode on your site – so you should have a setting to change the theme and use that to override the general user setting exposed by the browser. And talking about settings – always make sure users can &lt;a href=&quot;https://twitter.com/simevidas/status/1096832706191728640&quot;&gt;find the setting&lt;/a&gt; easily.&lt;/p&gt;
&lt;h2 id=&quot;what%E2%80%99s-next%3F&quot;&gt;What’s next? &lt;a class=&quot;permalink&quot; href=&quot;#what%E2%80%99s-next%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s have a look at the &lt;a href=&quot;https://drafts.csswg.org/mediaqueries-5/#mf-user-preferences&quot;&gt;User Preference Media Features&lt;/a&gt; to see what we may see next in browsers.&lt;/p&gt;
&lt;p&gt;As you can see there are some new media queries defined, like “inverted-colors”, “prefers-reduced-transparency” and “prefers-contrast” which are currently (February 2019) not implemented in any browsers, but probably will be in the future.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you can see there are currently various ways to adapt your site to honour user preferences and there will be even more in the future. This features help to improve accessibility, performance and privacy and you can make your users happy when you adapt to them.&lt;/p&gt;
&lt;p&gt;Happy coding!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Seven years</title>
							<link>https://justmarkup.com/log/2019/01/seven-years/</link>
							<pubDate>2019-01-31T06:13:20+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2019/01/seven-years/</guid>
							<description>&lt;p&gt;On the 31th of January 2012 this site was launched with an article me saying Servus (Hello).&lt;/p&gt;
&lt;p&gt;Since then I published 120 more articles and notes and one even explains why this site is named &lt;a href=&quot;https://justmarkup.com/log/2018/11/just-markup/&quot;&gt;justmarkup&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I still enjoy writing articles about my experience and findings and I always have a big smile in my face when I search for a problem and find an old article I wrote with a solution. I also have the same big smile in my face every time someone shares my article or contacts me telling me they found an article interesting and learned something from it – Thank you!&lt;/p&gt;
&lt;p&gt;The site is still using WordPress like it did seven years ago, but this will change in the next months as I am currently switching to a Static Site generator. There will also be a new design (the 3th or 4th one I guess), once this is all ready. Stay tuned.&lt;/p&gt;
&lt;p&gt;On to the next seven years!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> A look at CSS hyphenation in 2019</title>
							<link>https://justmarkup.com/log/2019/01/a-look-at-css-hyphenation-in-2019/</link>
							<pubDate>2019-01-28T09:40:34+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2019/01/a-look-at-css-hyphenation-in-2019/</guid>
							<description>&lt;p&gt;I recently worked on a web site which used big headlines (as in font-size) and also is available in German. This means there are often rather long words and they often don’t fit in the surrounding container. Without doing anything this would »break« the layout as a horizontal scroll bar would appear. So, I reread an article I wrote almost four years ago about &lt;a href=&quot;https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/&quot;&gt;Dealing with long words&lt;/a&gt; and implemented the final solution.&lt;/p&gt;
&lt;p&gt;This seemed to still work great, but there were some issues with this approach. Let’s have a look at the browser support of CSS Hyphenation, how to use it today and which feature I would like to see in browsers.&lt;/p&gt;
&lt;h2 id=&quot;browser-support&quot;&gt;Browser support &lt;a class=&quot;permalink&quot; href=&quot;#browser-support&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Support for &lt;a href=&quot;https://caniuse.com/#feat=css-hyphens&quot;&gt;CSS Hyphenation&lt;/a&gt; is pretty good. You should keep in mind that while it works in Chromium-based browsers on Mac &amp;amp; Android platforms it doesn’t work at the moment (January 2019) on &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=652964&quot;&gt;Windows and Linux&lt;/a&gt;. It also doesn’t work in Opera Mini and some other mobile browsers (Blackberry browser, IE mobile, …), but overall the support is solid.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2021&lt;/strong&gt;: Hyphenation is now also supported in Chromium on Windows.&lt;/p&gt;
&lt;h2 id=&quot;using-css-hyphenation&quot;&gt;Using CSS Hyphenation &lt;a class=&quot;permalink&quot; href=&quot;#using-css-hyphenation&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To use hyphens today we still need to add prefixes for IE/Edge/Chromium, so it is best to use the following for every text which should use hyphens:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.hyphenate&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-webkit-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-ms-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you probably want to break words and not the layout in unsupported browsers I recommend the following. This way all words will be hyphenated in supported browsers and will break into new lines in unsupported browsers.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.hyphenate&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;overflow-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-webkit-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-ms-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, that we know how to use CSS Hyphenation today, let’s have a look at what’s missing to make it even better.&lt;/p&gt;
&lt;h2 id=&quot;too-much-hyphenation&quot;&gt;Too much Hyphenation &lt;a class=&quot;permalink&quot; href=&quot;#too-much-hyphenation&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The biggest problem we had with Hyphenation was that it simple hyphenates too often. What this means shows the following example, here it hyphenates the word Josef (Joseph), which doesn’t look great. It also makes the text harder to read and therefore a little bit less accessible.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2019/01/josef-hauser.png&quot; alt=&quot;Über Josef Hauser&quot;&gt;&lt;/p&gt;
&lt;p&gt;This is because, unless the UA (user agent) is able to calculate a better value, it is suggested that &lt;code&gt;hyphens: auto&lt;/code&gt; means two for before and after, and five for the word total. This means hyphens will be used for every word, which is at least five characters long and it will break after/before a minium of two words.&lt;/p&gt;
&lt;p&gt;I am not sure why they came up with this default values, but here we are now having them. There is a solution though already defined in the specification – The &lt;a href=&quot;https://www.w3.org/TR/css-text-4/#hyphenate-char-limits&quot;&gt;hyphenate-limit-chars property&lt;/a&gt;.&lt;br&gt;
It specifies the minimum number of characters in a hyphenated word and thus we can use it to override the default value of 5 (word length) 2 (before break) 2 (after break).&lt;/p&gt;
&lt;p&gt;So, in theory we could use the following to only use hyphens for words with 10 characters or more and only break before/after after four characters:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;hyphenate-limit-chars&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10 4 4&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In reality, this property is still only supported in Internet Explorer 10+ and in Edge with the -ms prefix. It would be really great to get better support for hyphenate-limit-chars – so please let your favorite browser(s) know that you want it – thanks! Here is the issue for &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=924069&quot;&gt;Chromium&lt;/a&gt; and here for &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1521723&quot;&gt;Firefox&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Additional note: Webkit-based browsers (Safari) support the -webkit-hyphenate-limit-before, -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-lines &lt;a href=&quot;https://github.com/WebKit/webkit/blob/master/LayoutTests/fast/text/hyphenate-limit-before-after.html&quot;&gt;properties&lt;/a&gt;, which lets you also define the minimum length and the minimum characters before/after a break.&lt;/p&gt;
&lt;p&gt;As you can see support for CSS Hyphenation is pretty solid in 2019. The only issue for me is the lack of support for the hyphenate-limit-chars property which will hopefully get better in the future when enough users/developers request it.&lt;/p&gt;
&lt;p&gt;Update from 28.01.2018: Added info about similiar properties for webkit-based browser as pointed out by &lt;a href=&quot;https://twitter.com/petitsanimaux/status/1089841643195383814&quot;&gt;Alexander Rutz&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/JiminyPan/status/1089841172040876032&quot;&gt;Jiminy Panoz&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The link to button enhancement</title>
							<link>https://justmarkup.com/log/2019/01/the-link-to-button-enhancement/</link>
							<pubDate>2019-01-21T16:21:01+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2019/01/the-link-to-button-enhancement/</guid>
							<description>&lt;p&gt;One of the enhancement patterns I use quite a lot is transforming a link to a button – a link to a new page becomes a button which opens a dialog with the content, an on-page link to the navigation becomes a button to toggle the visibility of the navigation. In this article, I would like to explain why it is often useful to transform a link to a button, how to enhance a login link and why a button not associated with a form is useless without JavaScript.&lt;/p&gt;
&lt;h2 id=&quot;the-button-element&quot;&gt;The button element &lt;a class=&quot;permalink&quot; href=&quot;#the-button-element&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before we start, some basics about the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button&quot;&gt;button element&lt;/a&gt;. To quote MDN here:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The HTML &amp;lt;button&amp;gt; element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;One thing I have to add here is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A &amp;lt;button&amp;gt; not associated with a form is useless without JavaScript.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means you should either create &amp;lt;button&amp;gt; outside forms with JavaScript or use the hidden attribute and remove it with JavaScript afterwards.&lt;/p&gt;
&lt;p&gt;And there is more, if you use a &amp;lt;button&amp;gt; in an &amp;lt;form&amp;gt; it will be treated as &amp;lt;button type=&amp;quot;submit&amp;gt; – so if you want a button inside a form not to send the form set type=”button” on it.&lt;/p&gt;
&lt;p&gt;After refreshing our knowledge about the &amp;lt;button&amp;gt; element, let’s see how we can transform a link to a button.&lt;/p&gt;
&lt;h2 id=&quot;transforming-a-link-to-a-button&quot;&gt;Transforming a link to a button &lt;a class=&quot;permalink&quot; href=&quot;#transforming-a-link-to-a-button&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It all starts with a link:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;anotherpage.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Link to another page&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once this is rendered in the browser, people can use it to navigate to a new page – no matter what input/output device they are using. The can disable CSS, something can break the JavaScript on the page – the link will still work.&lt;/p&gt;
&lt;p&gt;Now, let’s enhance the link to a button:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; wannabeButtons &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-button]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;prototype&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;wannabeButtons&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;wannabeButton&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    wannabeButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&lt;br&gt;        &amp;lt;button data-link=&quot;&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;wannabeButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&gt;&lt;br&gt;        &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;wannabeButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&lt;br&gt;        &amp;lt;/button&gt;&lt;br&gt;    &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; btn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-link=&quot;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; wannabeButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;br&gt;    btn&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onclick&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;clicked the button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we get all links on the page with the data-button (can be anything, but I like to give elements I want to enhance a data atttribute) attribute. We loop over all of them and replace the &lt;code&gt;outerHTML&lt;/code&gt;, so the link becomes and actual &amp;lt;button&amp;gt;. Next we save a reference to the new button by using the data-link attribute we set before on it. This way we can now add event listeners on it and so on.&lt;/p&gt;
&lt;p&gt;This basic example is useless this way as you may notice, all we did was replacing the link with a button without defining what action should happen after activating the button. So, let’s move on to a real example to show how to enhance a basic link to a page to a button opening an dialog with the main content of the page.&lt;/p&gt;
&lt;h2 id=&quot;an-example%3A-a-login-dialog&quot;&gt;An example: A login dialog &lt;a class=&quot;permalink&quot; href=&quot;#an-example%3A-a-login-dialog&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It all starts again with a link to our login page, which is probably defined inside our main navigation on the page:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;login.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-open-overlay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Login&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once a user visits the link, they can login to the site – all good. Now enhance this to show an overlay/dialog with the login form. We will use &lt;a href=&quot;https://github.com/edenspiekermann/a11y-dialog&quot;&gt;A11y Dialog&lt;/a&gt; here to create an accessible dialog window.&lt;/p&gt;
&lt;p&gt;First, we include the CSS, JavaScript and HTML for the A11y Dialog on our site. We will also include a JavaScript file called script.js with our custom JavaScript.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token doctype&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token name&quot;&gt;doctype&lt;/span&gt; &lt;span class=&quot;token name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;utf-8&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;X-UA-Compatible&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;IE=edge&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;viewport&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;width=device-width, initial-scale=1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Login Link to Login Overlay&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;stylesheet&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;./style.css&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;header&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;./&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-current&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;page&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Home&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;login.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-open-overlay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Login&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;anotherpage.html&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Another page&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;header&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Login Link to Login Overlay example&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some Content here&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;footer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;The footer of the page&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;footer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dialog&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dialog&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dialog&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dialog-content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;button&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dialog-close&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-a11y-dialog-hide&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-label&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Close this dialog window&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token entity named-entity&quot; title=&quot;&amp;times;&quot;&gt;&amp;amp;times;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-dialog-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;module&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;a11y-dialog.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;module&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;script.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You may have noticed that we use type=”module” for the scripts here, this way the JavaScript will be loaded and run as expected in modern browsers and ignored in older browser not &lt;a href=&quot;https://caniuse.com/#feat=es6-module&quot;&gt;supporting&lt;/a&gt; it. This also means we can use modern JavaScript features in our script.js.&lt;/p&gt;
&lt;p&gt;Now move on to the script.js and the actual enhancement.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; dialogOpeners &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-open-overlay]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;dialogOpeners &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; dialogOpeners&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;prototype&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;dialogOpeners&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;dialogOpener&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; dialogContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-dialog-content]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dialog &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dialog&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; dialogElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;dialog&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; mainEl &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;#content&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dialog &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;A11yDialog&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;dialogElement&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; mainEl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                dialogElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dialog&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hide&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;dialogEl&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    dialogContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;            dialogOpener&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&lt;br&gt;                &amp;lt;button data-link=&quot;&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;dialogOpener&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot; &gt;&lt;br&gt;                    &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;dialogOpener&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&lt;br&gt;                &amp;lt;/button&gt;&lt;br&gt;            &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            dialogOpener &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-link=&quot;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; dialogOpener&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            dialogOpener&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; link &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataset&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;link &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataset&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;link &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;link&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;                    &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;link&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                            &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; response&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; parser &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;DOMParser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; doc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; parser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;parseFromString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;html&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;text/html&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; pageContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; doc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;#main&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                            dialogContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;dialogContent &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; pageContent&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                                dialogContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; pageContent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                                window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dialog&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                                document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;location &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; link&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;                        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Failed to fetch page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                            document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;location &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; link&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s go through it. We get all links with the attribute data-open-overlay and loop over them. Next, we reference the element with the attribute data-dialog-content where we will later insert the login form and the dialog itself. After that, we transform the link to a button, as already shown above.&lt;/p&gt;
&lt;p&gt;Now the event listener for our button. There we check if the link has the data-link attribute set (we filled this with the href of the original link before). If it does, we use fetch to get the text content of the page. Once we get it, we use &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/DOMParser&quot;&gt;DOMParser&lt;/a&gt; to get only the HTML inside &lt;code&gt;&amp;lt;main id=&amp;quot;main&amp;quot;&amp;gt;&lt;/code&gt; of login.html. Now that we have the HTML, we insert it into our dialog content element defined above and show the dialog.&lt;/p&gt;
&lt;p&gt;So, now if the user clicks on Login an Overlay with the Login form will open. If the user is using an older browser or if anything goes wrong with the fetch of the login form they will be redirected to login.html and can still login.&lt;/p&gt;
&lt;p&gt;If you want to see it in action, here is a &lt;a href=&quot;https://justmarkup.github.io/demos/link-to-button/&quot;&gt;demo&lt;/a&gt; and you can also view the code on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/link-to-button&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Happy enhancing!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Using Puppeteer to crawl pages and save them as Markdown files</title>
							<link>https://justmarkup.com/log/2019/01/using-puppeteer-to-crawl-pages-and-save-them-as-markdown-files/</link>
							<pubDate>2019-01-04T07:55:11+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2019/01/using-puppeteer-to-crawl-pages-and-save-them-as-markdown-files/</guid>
							<description>&lt;p&gt;One of my goals for 2019 is to finally launch a redesign of this site and more importantly switch from WordPress to a Static Site. To get this rolling, I first need to have all my posts saved as Markdown. I first looked for some existing WordPress plugins to achieve this, but this wasn’t really working for me. I also could have used the WordPress REST API or even the RSS feed to get the data – again this didn’t feel like the right tools. Then, I read this &lt;a href=&quot;https://24ways.org/2018/dynamic-social-sharing-images/&quot;&gt;article&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/drewm&quot;&gt;Drew McLellan&lt;/a&gt;, where he writes about using Puppeteer to take screenshots of a page and use them for social sharing and I had a plan.&lt;/p&gt;
&lt;p&gt;In this article I will describe how to use Puppeteer to find all articles of a page, open them one after another, extract the content, convert it to markdown and save them as separate files.&lt;/p&gt;
&lt;h2 id=&quot;get-puppeteer-running&quot;&gt;Get Puppeteer running &lt;a class=&quot;permalink&quot; href=&quot;#get-puppeteer-running&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/GoogleChrome/puppeteer&quot;&gt;Puppeteer&lt;/a&gt; is built on Node.js and provides a clean API to control headless Chrome. This means you can start a Chrome browser from the command line without ever drawing anything to a user interface window. You can open pages, it renders CSS, it runs JavaScript – so you can do everything Chrome on Desktop does, just without an user interface.&lt;/p&gt;
&lt;p&gt;Before continuing you should already have Node.js &lt;a href=&quot;https://nodejs.org/en/download/package-manager/&quot;&gt;installed&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To install Puppeteer run&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; i puppeteer&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in your command line.&lt;/p&gt;
&lt;p&gt;This will install the API as well as a Chromium version (~200MB). On my Windows Subsystem for Linux I had some problems installing it, as dependencies were missing, so I had to install some more libraries, but after this extra installs all worked. If you have any problems installing Puppeteer, have a look at the &lt;a href=&quot;https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md&quot;&gt;Troubleshooting page&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;get-the-data&quot;&gt;Get the data &lt;a class=&quot;permalink&quot; href=&quot;#get-the-data&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First we launch a new browser with Puppeteer and go to a new page. To do this create a new file called index.js and insert the following:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; puppeteer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;puppeteer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// start the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; browser &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; puppeteer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; args&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--no-sandbox&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// open a new page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageURL &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;https://justmarkup.com&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// try to go to URL&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pageURL&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;opened the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;failed to open the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; with the error: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;error&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// all done, close the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we require the Puppeteer library. Next we use &lt;code&gt;puppeteer.launch()&lt;/code&gt; to create a new browser and &lt;code&gt;browser.newPage()&lt;/code&gt; to define a new page/tab. Last we use &lt;code&gt;page.goto(URL)&lt;/code&gt; to open an URL.&lt;/p&gt;
&lt;p&gt;If we run &lt;code&gt;node index.js&lt;/code&gt;, it should log “opened the page &lt;a href=&quot;https://justmarkup.com/&quot;&gt;https://justmarkup.com&lt;/a&gt;” in the command line. There may also be an error (invalid URL, SSL error, timeout, resource failed to load) opening the URL, so we use a try/catch statement here to catch the possible &lt;a href=&quot;https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagegotourl-options&quot;&gt;errors&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now, that we know how to launch a browser and open an URL, let’s see how we can get data from the DOM of the page.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; puppeteer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;puppeteer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// start the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; browser &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; puppeteer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; args&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--no-sandbox&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// open a new page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageURL &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;https://justmarkup.com&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// try to go to URL&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pageURL&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;opened the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;failed to open the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; with the error: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;error&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Find all links to articles&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postsSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.main .article h2 a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postUrls &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;postLinks&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; postLinks&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; link&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Visit each page one by one&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; postUrl &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; postUrls&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// open the page&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;opened the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;failed to open the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the pathname&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pathname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; pagePathname&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;got the pathname:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pagePathname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the title of the post&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; titleSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article h1&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageTitle &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;titleSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; titleSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;found the title&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageTitle&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the content of the page&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; contentSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article .entry-content&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;contentSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; contentSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;found the content: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageContent&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// all done, close the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we get all links to our posts we find in the entry page, in my case they can be targeted with the selector ‘.main .article h2 a’.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Find all links to articles&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postsSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.main .article h2 a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postUrls &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;postLinks&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; postLinks&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; link&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We define the selector and use &lt;code&gt;waitForSelector()&lt;/code&gt; to be sure the DOM nodes are visible. Next, we use &lt;a href=&quot;https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevalselector-pagefunction-args&quot;&gt;page.$$eval(selector, pageFunction[, …args])&lt;/a&gt;, which runs &lt;code&gt;Array.from(document.querySelectorAll(selector))&lt;/code&gt; within the page and passes it as the first argument to &lt;code&gt;pageFunction&lt;/code&gt;. Lastly we use the &lt;code&gt;map()&lt;/code&gt; method to get the links to the pages defined in the &lt;code&gt;href&lt;/code&gt; attribute. Great, we now have an &lt;code&gt;Array&lt;/code&gt; with all our links.&lt;/p&gt;
&lt;p&gt;Now, it is time to open all links, one after another and get the data (headline, content, pathname) we need.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; postUrl &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; postUrls&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// open the page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;opened the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;failed to open the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// get the pathname&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pathname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; pagePathname&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;got the pathname:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pagePathname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// get the title of the post&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; titleSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article h1&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageTitle &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;titleSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; titleSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;found the title&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageTitle&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// get the content of the page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; contentSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article .entry-content&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;contentSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; contentSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;found the content: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageContent&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We loop through the above defined &lt;code&gt;postUrls&lt;/code&gt; and use &lt;code&gt;page.goto()&lt;/code&gt; to open each URL. Now we get the pathname, which we will later use as our filename. Here we use &lt;code&gt;page.evaluate()&lt;/code&gt; to get the &lt;code&gt;pathname&lt;/code&gt; defined in &lt;code&gt;window.location&lt;/code&gt;. We also replace all “/” with “-” to get a valid filename.&lt;/p&gt;
&lt;p&gt;Next up is the main headline of the article. Here we define a selector (in my case ‘.article h1’), use &lt;code&gt;page.waitForSelector()&lt;/code&gt; again to make sure it is visible, and use &lt;code&gt;page.$eval()&lt;/code&gt; to get the &lt;code&gt;outerHTML&lt;/code&gt; of the headline. We are using &lt;code&gt;outerHTML&lt;/code&gt; so we can pass that to the HTML-to-markdown API later.&lt;/p&gt;
&lt;p&gt;Lastly, we get the main content of the article. We define another selector (in my case ‘.article .entry-content’), use &lt;code&gt;page.waitForSelector()&lt;/code&gt; again to make sure it is visible, and use &lt;code&gt;page.$eval()&lt;/code&gt; to get the &lt;code&gt;innerHTML&lt;/code&gt; of the content.&lt;/p&gt;
&lt;p&gt;Great, we now know how to find URLs, how to open each URL and how to get data from a page.&lt;/p&gt;
&lt;h2 id=&quot;convert-to-markdown&quot;&gt;Convert to markdown &lt;a class=&quot;permalink&quot; href=&quot;#convert-to-markdown&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So, we now have all the needed data. As the next step we will use &lt;a href=&quot;https://github.com/domchristie/turndown&quot;&gt;Turndown&lt;/a&gt; to convert the HTML to Markdown.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; puppeteer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;puppeteer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; TurndownService &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;turndown&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; turndownService &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;TurndownService&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// start the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; browser &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; puppeteer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; args&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--no-sandbox&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// open a new page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageURL &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;https://justmarkup.com&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// try to go to URL&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pageURL&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;opened the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;failed to open the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; with the error: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;error&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Find all links to articles&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postsSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.main .article h2 a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postUrls &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;postLinks&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; postLinks&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; link&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Visit each page one by one&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; postUrl &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; postUrls&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// open the page&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;opened the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;failed to open the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the pathname&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pathname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; pagePathname&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the title of the post&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; titleSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article h1&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageTitle &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;titleSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; titleSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the content of the page&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; contentSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article .entry-content&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;contentSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; contentSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// convert the html to markdown&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; pageContentMarkdown &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; turndownService&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;turndown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pageTitle &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; pageContent&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Yes, this is the headline and content as markdown&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageContentMarkdown&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// all done, close the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we need to install Turndown by running &lt;code&gt;npm install turndown&lt;/code&gt; in our command line. After that, we require turndown at the top of our index.js, and define the service with &lt;code&gt;const turndownService = new TurndownService();&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now, we only need to add &lt;code&gt;let pageContentMarkdown = turndownService.turndown(pageTitle + pageContent);&lt;/code&gt; after the part where we defined our &lt;code&gt;pageTitle&lt;/code&gt; and &lt;code&gt;pageContent&lt;/code&gt; before and voilà, we have our HTML converted to Markdown.&lt;/p&gt;
&lt;h2 id=&quot;save-markdown-files&quot;&gt;Save markdown files &lt;a class=&quot;permalink&quot; href=&quot;#save-markdown-files&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To finish the plan, we now need to save the converted Markdown in files (one for each article).&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; puppeteer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;puppeteer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; TurndownService &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;turndown&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fs &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;fs&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; turndownService &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;TurndownService&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// start the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; browser &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; puppeteer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; args&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--no-sandbox&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// open a new page&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageURL &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;https://justmarkup.com&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// try to go to URL&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pageURL&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;opened the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;failed to open the page: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;pageURL&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; with the error: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;error&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Find all links to articles&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postsSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.main .article h2 a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postUrls &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;postLinks&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; postLinks&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; link&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Visit each page one by one&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; postUrl &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; postUrls&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// open the page&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;opened the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;failed to open the page: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postUrl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the pathname&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pathname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        pagePathname &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; pagePathname&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the title of the post&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; titleSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article h1&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageTitle &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;titleSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;titleSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; titleSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// get the content of the page&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; contentSelector &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.article .entry-content&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitForSelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; timeout&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pageContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;contentSelector&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;contentSelector&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; contentSelector&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// convert the html to markdown&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; pageContentMarkdown &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; turndownService&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;turndown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pageTitle &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; pageContent&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;// Check if folder exists before writing files there&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postsDirectory &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/posts/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;existsSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsDirectory&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mkdirSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsDirectory&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// save the file as ${pathname}.md&lt;/span&gt;&lt;br&gt;        fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;writeFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsDirectory &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; pagePathname &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.md&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageContentMarkdown&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;// success case, the file was saved&lt;/span&gt;&lt;br&gt;            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Page saved!&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// all done, close the browser&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; browser&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We are using the &lt;a href=&quot;https://nodejs.org/api/fs.html&quot;&gt;File System API (fs) from Node.js&lt;/a&gt; here, so as a first step we require it at the the top of our index.js. I wanted to save all posts in a folder called ‘posts’. So, we first check if the folder already exists, and if not we will create the folder using:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Check if folder exists before writing files there&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postsDirectory &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/posts/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;existsSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsDirectory&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mkdirSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsDirectory&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now on to the final part to save a Markdown file for each article.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// save the file as ${pathname}.md&lt;/span&gt;&lt;br&gt;fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;writeFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;postsDirectory &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; pagePathname &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.md&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pageContentMarkdown&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// success case, the file was saved&lt;/span&gt;&lt;br&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Page saved!&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we use &lt;code&gt;fs.writeFile()&lt;/code&gt;. We want to save our files in ‘/posts/’, using our &lt;code&gt;pagePathname&lt;/code&gt; as the filename and use the file extension “.md” so we pass that as the first argument. As the second argument we will pass &lt;code&gt;pageContentMarkdown&lt;/code&gt; which contains the converted Markdown as a &lt;code&gt;String&lt;/code&gt;. If all goes well, the articles now get saved one after another as Markdown files. Yes, goal achieved!&lt;/p&gt;
&lt;p&gt;I hope you learned something from this article and maybe your next plan also includes using Puppeteer to achieve something.&lt;/p&gt;
&lt;p&gt;I also put the final code on &lt;a href=&quot;https://github.com/justmarkup/html-posts-to-markdown/blob/master/index.js&quot;&gt;Github&lt;/a&gt; if you are curious.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Just markup</title>
							<link>https://justmarkup.com/log/2018/11/just-markup/</link>
							<pubDate>2018-11-27T07:01:10+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/11/just-markup/</guid>
							<description>&lt;p&gt;When I started working as a Front-end Developer (or rather Web designer, as people doing HTML, CSS and a bit of JavaScript were usually called back then), all the Back-end people working at the company *laughed* at me because I was »just« doing HTML and CSS and not »real programming«. They thought all you need to know in HTML are &lt;code&gt;&amp;lt;font&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; and some form elements (including &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; without labels of course).&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;FONT&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;black&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;face&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;Arial&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;I am a real programmer.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;FONT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;CSS was only used inline and only to change font-size and color and if they needed to align something they build some terrible tables (at a time where using tables for layout were already &lt;a href=&quot;http://alistapart.com/article/practicalcss&quot;&gt;bad practice&lt;/a&gt; for several &lt;a href=&quot;http://www.pixy.cz/blogg/clanky/css-3col-layout/&quot;&gt;years&lt;/a&gt;). They didn’t think a second about accessibility, maintainability or semantics.&lt;/p&gt;
&lt;p&gt;At that time I also used the username “justmarkup” for the first time and stuck to it when I started blogging 2012. So, if you ever wondered about my username, now you know.&lt;/p&gt;
&lt;h2 id=&quot;on-to-the-now&quot;&gt;On to the now &lt;a class=&quot;permalink&quot; href=&quot;#on-to-the-now&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;10 years later, this hasn’t really changed. Yes, there are many Back-end/JavaScript developers now realizing that HTML and CSS is really important, that it takes a long time to master it and that a website is useless without proper HTML and CSS. At the same time, many Back-end/JavaScript developers still say that doing HTML/CSS is not »real programming«, that you more or less only need to know about &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; and that CSS is annoying.&lt;/p&gt;
&lt;p&gt;Telling other people working on the web and doing a great job building web sites that they are useless because they focus on HTML and CSS is very wrong.&lt;/p&gt;
&lt;h2 id=&quot;javascript-!%3D%3D-front-end&quot;&gt;JavaScript !== Front-end &lt;a class=&quot;permalink&quot; href=&quot;#javascript-!%3D%3D-front-end&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;What I am seeing is that many developers focus entirely on JavaScript nowadays and I see companies where they replace Back-end Developers with JavaScript Developers. What some don’t understand is that a JavaScript Developer is not per se a Front-end Developer. A JavaScript Developer may not like to write CSS or does not really care about semantics. That’s the same way I prefer not to work directly with Databases or configure a Server. That’s okay. What is not okay is if you don’t want to use something and at the same time tell others what they do is easy or useless. Even worse is if you try to tell experts in their field that they are doing it all wrong and that they should do it »your way«.&lt;/p&gt;
&lt;p&gt;I had this article in my drafts for over three years and sadly the bashing even got worse in my experience. Let’s stop this madness, respect and value what others do and never think »Bla bla FIRST«.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> On using tracking scripts</title>
							<link>https://justmarkup.com/log/2018/09/on-using-tracking-scripts/</link>
							<pubDate>2018-09-13T15:06:37+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/09/on-using-tracking-scripts/</guid>
							<description>&lt;p&gt;Today, I saw a tweet from &lt;a href=&quot;https://twitter.com/adactio/status/1040189418445914113&quot;&gt;Jeremy Keith (@adactio)&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Too many businesses treat analytics and tracking scripts as victimless technologies — they only see the benefits (in data acquisation) without understanding the costs (in performance).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;which inspired me to write about the benefits and the costs for a business and for the user when using tracking scripts.&lt;/p&gt;
&lt;h2 id=&quot;on-the-business-side&quot;&gt;On the business side &lt;a class=&quot;permalink&quot; href=&quot;#on-the-business-side&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;benefits&quot;&gt;Benefits &lt;a class=&quot;permalink&quot; href=&quot;#benefits&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1) Free data acquisition&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When using tracking scripts you can get a lot of free data from your users. You can identify a user, check what sites they visited, see the sources where they came from, check where they clicked on your site, check every mouse move and much more depending on what tracking script(s) you are using.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2) Make more money&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One of the main benefits I often hear when companys want to use tracking software is that they are sure they can make more money if they know everything about their user. In theory this may be the case, but if even Amazon is unable to provide great recommendations (just ask everyone selling a book on Amazon how often they saw a recommendation to buy their own book :-)), I am unsure your company can improve sales by evaluating all the collected data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3) Be sure that the user experience is bad&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With all the collected data you may find out that a lot of user leave the registration form before finishing it. You may find many more issues after studying all the data. While this may be a benefit, most of this issues could be found without tracking, eg. by user testing. If you actually improve the user experience based on data, good, from my experience as a user and as a developer this rarely happens.&lt;/p&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs &lt;a class=&quot;permalink&quot; href=&quot;#costs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1) Implement the script(s)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When using a tracking script, someone needs to implement it, so there are development costs. The cost may be low, if you only add a third-party script to the site, but may cost quite a lot if you want to track custom events or use more advanced features.&lt;/p&gt;
&lt;h2 id=&quot;from-a-user-perspective&quot;&gt;From a user perspective &lt;a class=&quot;permalink&quot; href=&quot;#from-a-user-perspective&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;benefits-1&quot;&gt;Benefits &lt;a class=&quot;permalink&quot; href=&quot;#benefits-1&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1) Better user experience&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As said before a site could improve the user experience based on the data they collected. So, this is a potential benefit for you as a user.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2) ???&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I am really not sure if there is any other benefit from a user perspective. If you know one please let me know &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;hallo@justmarkup.com&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;costs-1&quot;&gt;Costs &lt;a class=&quot;permalink&quot; href=&quot;#costs-1&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1) Performance&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When using tracking scripts the performance of a site will automatically decrease. When a user is using a fast network they may not notice this, but on 3G or 2G this tracking scripts may increase the load time by several seconds. Many sites even load this scripts in the head (without async or defer) and will block other resources. When loading a tracking script is your first priority, I can’t trust your business.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2) Privacy&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Depending on what tracking scripts you are using you can get a lot of information about a user (often without the knowledge of the user). Many sites also happily share this data with other companies. If you include Google Analytics they also get all the data and they can combine this with data from other sites easily (not saying they are doing this). Again, most users are not aware that their data is collected and shared and are shocked when they discover this.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3) Real money loss&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I have seen sites using no more than seven different tracking scripts, together about 700kb in ~40 requests. For a user in Canada on a postpaid data plan this &lt;a href=&quot;https://whatdoesmysitecost.com/&quot;&gt;costs ~0.09 $&lt;/a&gt;. Yes, this is an extreme case and most tracking scripts are below 50kb, but if you think about it that users actually have to buy money so they can get tracked is really crazy.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4) Potential errors&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When loading an external resource on a site, the JavaScript which gets executed may cause an error on a site. In the worst case the whole site may be unusable because of a third-party script. Developers of third-party scripts of course test their scripts, but I am sure they don’t test in every browser and no matter how big the company is, there is always the potential that JavaScript with an error gets shipped.&lt;/p&gt;
&lt;p&gt;This is also not only a cost for users, but also a cost for a business – if a user can’t finish a registration or a checkout you won’t make any money from this user.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5) Vulnerability&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Imagine someone manages to hack Google Analytics. Yes, this is very unlikely, but it can be done. Once an attacker is able to change the content of the script, they would be able to manipulate all sites using the script, would be able to steal data and much more. Including a third-party script is like Russian roulette – you can be never sure the third-party script is doing any harm.&lt;/p&gt;
&lt;h2 id=&quot;best-way-to-handle-tracking-scripts&quot;&gt;Best way to handle tracking scripts &lt;a class=&quot;permalink&quot; href=&quot;#best-way-to-handle-tracking-scripts&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here is a list, how a business can handle tracking scripts, from best to worst.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Don’t use any tracking at all&lt;/li&gt;
&lt;li&gt;Only track on the server-side&lt;/li&gt;
&lt;li&gt;Only use self-hosted tracking scripts&lt;/li&gt;
&lt;li&gt;Load third-party tracking scripts&lt;/li&gt;
&lt;li&gt;Load several third-party tracking scripts&lt;/li&gt;
&lt;li&gt;Load all the third-party tracking scripts&lt;/li&gt;
&lt;li&gt;Load all the third-party tracking scripts before anything else&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When looking at the costs versus the benefits it is hard to believe that almost every website is using tracking scripts. It is like trying to sell a fridge on the south pole and nearly everyone you ask if they want one would say yes even they know that there are no real benefits but quite some costs.&lt;/p&gt;
&lt;p&gt;The next time, you implement a tracking script it would be great if you could rethink it and ask yourself if it is really worth. When building &lt;a href=&quot;https://feediary.com/&quot;&gt;feediary&lt;/a&gt; it was clear from the beginning that we don’t want to use any tracking at all and I am really happy about this decision.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Hey there feediary.com</title>
							<link>https://justmarkup.com/log/2018/07/hey-there-feediary-com/</link>
							<pubDate>2018-07-31T05:49:56+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/07/hey-there-feediary-com/</guid>
							<description>&lt;p&gt;This past week has been really exciting with the launch of &lt;a href=&quot;https://feediary.com/&quot;&gt;feediary.com&lt;/a&gt; on the 24th of July and all the awesome feedback I got afterwards. In the official &lt;a href=&quot;https://blog.feediary.com/posts/2018-07-24-wearelive/&quot;&gt;announcement&lt;/a&gt; I already wrote about what &lt;a href=&quot;https://feediary.com/&quot;&gt;feediary&lt;/a&gt; is and why you should try it. In this article I would like to talk about the Why – Why did I build the RSS reader feediary?&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/07/screenshot_reader.png&quot; alt=&quot;The reader interface, once as shown on an desktop browser and once as shown on an mobile browser&quot;&gt;&lt;/p&gt;
&lt;p&gt;It all started in the middle of January 2018 – at this point I was not actively using an RSS reader and got most of the information through twitter. This mostly worked for me, but there were some problems: twitter doesn’t show feeds in chronological order anymore – which means I would often miss an interesting article. And a big issue for me, I was spending way too much time on twitter to keep up-to-date and do not miss anything. I knew I had to stop this and use it less. About at the same time people in my timeline started sharing their RSS feeds after a &lt;a href=&quot;https://twitter.com/laurakalbag/status/953235974888271872&quot;&gt;tweet from Laura Kalbag&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This was the perfect timing, and some days later I started working on a first prototype. Why was I not using one of the existing RSS reader you may ask now. I tried several at this time, but wasn’t really happy with any of them – some were clustered with ads, some didn’t care about my privacy, some were not really developed actively anymore and many required me to download an App for every OS I want to use it on or only worked on Desktop. So, that’s why I stared working on feediary. At first I developed it solely for me, but after some time I thought “Maybe this could be useful for many others”, and so I started again with version 0.1.&lt;/p&gt;
&lt;p&gt;Over the next month I spent many hours beside my freelance jobs on it. I often reached a point where I wanted to give up, but after some days I always came back and started working on it again. You probably heard this before, but if you are stuck with a problem – stop trying to find a solution right away – I spend too many hours sitting there and trying to find a solution, only to find the solution in like 5 minutes the next day after a good sleep. Now, if I can’t get something to work in ~1hour I will switch to another task and come back to it the next day.&lt;/p&gt;
&lt;p&gt;About 6 months after the first version, the site was finally ready for the public and with your support it will be here for a long time.&lt;/p&gt;
&lt;p&gt;I will write about the technical backgrounds of feediary, the problems I faced along the way and other development stories in the future – now I need to go back and work on new features (something with offline I heard). If you want to keep up-to-date with feediary, why not subscribe to the &lt;a href=&quot;https://blog.feediary.com/feed/feed.xml&quot;&gt;RSS feed of our blog&lt;/a&gt; or follow &lt;a href=&quot;https://twitter.com/feediary&quot;&gt;@feediary&lt;/a&gt; on twitter.&lt;/p&gt;
&lt;p&gt;I would like to thank my partner Johanna for all her great work and support, Laura for her help with the design, and Bryony for her help with copywriting. Without your fantastic work feediary would still be a prototype.&lt;/p&gt;
&lt;p&gt;If you also 💜 RSS, do me the favour and &lt;a href=&quot;https://feediary.com/&quot;&gt;try feediary and spread the word about it&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Progressive Enhancement and Marketing</title>
							<link>https://justmarkup.com/log/2018/07/progressive-enhancement-and-marketing/</link>
							<pubDate>2018-07-03T12:30:24+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/07/progressive-enhancement-and-marketing/</guid>
							<description>&lt;p&gt;I am currently building a RSS reader (&lt;a href=&quot;https://blog.feediary.com/posts/hellofeediary/&quot;&gt;intro blog article about feediary&lt;/a&gt;) and like always it is progressive enhanced. In short this means the main features of the site will all work in older browsers, but there are several enhancements only available for supported browsers. This strategy worked great until I started working on a new feature – Themes. It is a feature only available for paid subscriptions and I wanted to make the feature available to as many different browsers and users as possible.&lt;/p&gt;
&lt;p&gt;This got me thinking. I could build this using CSS Custom Properties, &lt;a href=&quot;https://caniuse.com/#feat=css-variables&quot;&gt;browser support is ~88% at the moment (July 2018)&lt;/a&gt;. Still, ~10% of potential users may not be able to use the feature. I could build a fallback version for them, but this would take quite some time I have to spend on top of building it with Custom Properties. So, in the end I decided to not use Custom Properties for themes. In this article I will explain why I decided against using a new web platform feature in this case and options to list a feature not available in all browsers.&lt;/p&gt;
&lt;h2 id=&quot;using-new-web-platform-features&quot;&gt;Using new web platform features &lt;a class=&quot;permalink&quot; href=&quot;#using-new-web-platform-features&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;More than two years ago I wrote about building a &lt;a href=&quot;https://justmarkup.com/log/2016/02/theme-switcher-using-css-custom-properties/&quot;&gt;theme switcher using Custom Properties&lt;/a&gt;. Back then I finished the article by saying that you can use Custom Properties as an enhancement today. The today is now two years ago and browser support got far better and I still decided to build the theme feature without Custom Properties in this case.&lt;/p&gt;
&lt;p&gt;As said, I wanted to offer themes to as many users as possible. To achieve this there are two ways. Build it using Custom Properties and build a fallback version for non-supported browsers. Build only the fallback version and use it for all users. The second version is faster to build. So, I went with the fallback-only version. Custom Properties are awesome and I already used them in production for themes, but there it was not a main feature – there it was an enhancement. As always – It depends.&lt;/p&gt;
&lt;h2 id=&quot;list-progressive-enhanced-features&quot;&gt;List progressive enhanced features &lt;a class=&quot;permalink&quot; href=&quot;#list-progressive-enhanced-features&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some features can only be build using modern platform features. One example is push notifications. &lt;a href=&quot;https://caniuse.com/#feat=push-api&quot;&gt;Support for push notifications&lt;/a&gt; is getting better and better, but there are still many users using a non-supported browsers. They can still use the website, but won’t get this extra feature. Others can be build using new features, but could also be build using widely supported HTML, CSS and JavaScript.&lt;/p&gt;
&lt;p&gt;I often said and still believe that websites not only don’t have to look the same in all browsers, but that also some non-essential features don’t have to work in every browser. When I started building feediary and thought about listing the features, there was one problem with this approach – should I list features only available to some browsers, not list them at all, only list them in supported browsers or add a remark about browser support.&lt;/p&gt;
&lt;h3 id=&quot;don%E2%80%99t-list-the-feature&quot;&gt;Don’t list the feature &lt;a class=&quot;permalink&quot; href=&quot;#don%E2%80%99t-list-the-feature&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;From a marketing point of view this is less than ideal. Your website offers a great feature, which may be available to most of your audience, but not for all. To not confuse users using non-supported users the best approach may be to not promote the feature at all. It is still available in supported browsers, but you don’t advertise it.&lt;/p&gt;
&lt;h3 id=&quot;list-the-feature-only-in-supported-browsers&quot;&gt;List the feature only in supported browsers &lt;a class=&quot;permalink&quot; href=&quot;#list-the-feature-only-in-supported-browsers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Another approach might be to make a feature test and if the feature is supported, list the feature. If the feature is not supported you don’t list it in your features list. This way a user knows about all the features they can use in the browser they are using right now. There is one problem. If a user starts using your service in a supported browser and later switches to a non-supported browsers, they may be really confused. Even more so if they regularly switch between different browsers.&lt;/p&gt;
&lt;h3 id=&quot;list-feature-with-explanation-to-browser-support&quot;&gt;List feature with explanation to browser support &lt;a class=&quot;permalink&quot; href=&quot;#list-feature-with-explanation-to-browser-support&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There is another way to list a feature in all browsers. List the feature, but add an explanation next to it. A link named “in supported browsers only” which links to a page where all supported browsers are listed. This way all users know about the feature, and also know if it is supported in their browsers. The main disadvantage of this is that you have to keep the list of supported browsers up-to-date as non-supported browsers could become supported browsers any time.&lt;/p&gt;
&lt;p&gt;I am still not sure about the best way to handle marketing for progressive enhanced features. Is it again – It depends? How are you handling this? Please let me know, you can contact me on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;Twitter (DM open)&lt;/a&gt; or by writing me an &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;email&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Setting up https with a valid certificate for a local domain – and use it with Node.js</title>
							<link>https://justmarkup.com/log/2018/05/https-valid-certificate-local-domain/</link>
							<pubDate>2018-05-31T04:36:19+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/05/https-valid-certificate-local-domain/</guid>
							<description>&lt;p&gt;Many new web platform features require a connection via https nowadays. So if you want to use and test Service Worker, you need a domain which runs on https and has a valid SSL certificate. If you have a public domain (like .com or .party), your hosting company most likely offers SSL certificates (often free now thanks to &lt;a href=&quot;https://letsencrypt.org/&quot;&gt;Let’s Encrypt&lt;/a&gt;), which are also easy to install in most cases. But, if you develop, you don’t use a public domain. You can either use &lt;a href=&quot;http://localhost/&quot;&gt;http://localhost&lt;/a&gt; or you can use a local domain (e.g. justmarkup.localhost). If you use localhost you can still test Service Worker, as browsers have whitelisted this, but if you use &lt;a href=&quot;http://justmarkup.localhost/&quot;&gt;http://justmarkup.localhost&lt;/a&gt; it won’t work.&lt;/p&gt;
&lt;p&gt;You should use .localhost, .test, .example or .invalid for your local domain as they are save to use. Others like .dev used to work fine until some &lt;a href=&quot;https://medium.engineering/use-a-dev-domain-not-anymore-95219778e6fd&quot;&gt;time ago&lt;/a&gt; and this may happen to others too, so you should stick to the &lt;a href=&quot;https://tools.ietf.org/html/rfc2606&quot;&gt;Reserved Top Level DNS Names&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Often localhost is fine for developing, but if you need a subdomain or if your CMS requires you to use a top-level domain‚ you need to set up a valid SSL certificate for this domain. In this article, I will explain how to set up a local domain, how to set up Node.js and a https server, how to configure an OpenSSL certificate and how to ensure browsers consider it as a valid cerfificate.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/05/https.png&quot; alt=&quot;Screenshot showing justmarkup.localhost running on https with the green secure mark&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;setting-up-the-domain&quot;&gt;Setting up the domain &lt;a class=&quot;permalink&quot; href=&quot;#setting-up-the-domain&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you already know how to do this, jump straight to &lt;a href=&quot;#setupcertificate&quot;&gt;Setting up a certificate&lt;/a&gt;. If not, you first have to edit your hosts file. On MacOS and Linux you can find this file at /etc/hosts and on Windows it can be found at [SystemRoot]\system32\drivers\etc\hosts (if you are using the Linux subsystem it is here: /mnt/c/Windows/System32/drivers/etc/hosts). Open the hosts file and add the following at the end.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token number&quot;&gt;127.0&lt;/span&gt;.0.1 justmarkup.localhost&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace justmarkup.localhost with your domain of choice.&lt;/p&gt;
&lt;p&gt;With this in place we can move on and get our SSL certificate.&lt;/p&gt;
&lt;h2 id=&quot;setting-up-and-installing-a-certificate&quot;&gt;Setting up and installing a certificate &lt;a class=&quot;permalink&quot; href=&quot;#setting-up-and-installing-a-certificate&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First create a new folder called cert in your project folder. This is where we will save our certificates and keys. If you plan to use git for the project, I recommend adding the cert folder to your &lt;a href=&quot;https://git-scm.com/docs/gitignore&quot;&gt;.gitignore&lt;/a&gt; file.&lt;/p&gt;
&lt;h3 id=&quot;create-the-root.cnf&quot;&gt;Create the root.cnf &lt;a class=&quot;permalink&quot; href=&quot;#create-the-root.cnf&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Okay, so first create the file root.cnf with the following content and save it in the cert folder.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# OpenSSL configuration for Root CA&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; req &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;&lt;br&gt;prompt             &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; no&lt;br&gt;string_mask        &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; default&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;# The size of the keys in bits:&lt;/span&gt;&lt;br&gt;default_bits       &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2048&lt;/span&gt;&lt;br&gt;distinguished_name &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; req_distinguished_name&lt;br&gt;x509_extensions    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; x509_ext&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; req_distinguished_name &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;# Note that the following are in &#39;reverse order&#39; to what you&#39;d expect to see.&lt;/span&gt;&lt;br&gt;&lt;br&gt;countryName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; gb&lt;br&gt;organizationName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Test&lt;br&gt;commonName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Test Root CA&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; x509_ext &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;basicConstraints&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;critical,CA:true,pathlen:0&lt;br&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;keyUsage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;critical,keyCertSign,cRLSign&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should replace organizationName and commonName with something related to your project and something you will remember lately.&lt;/p&gt;
&lt;p&gt;Next switch to the command line and go into your cert folder you created before and run:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;openssl req -x509 -new -keyout root.key -out root.cer -config root.cnf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The script will ask for a PEM pass phrase – enter something – it should be secure and you should remember it.&lt;/p&gt;
&lt;h3 id=&quot;create-the-server.cnf&quot;&gt;Create the server.cnf &lt;a class=&quot;permalink&quot; href=&quot;#create-the-server.cnf&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Next, create a file called server.cnf with the following content in the certs folder:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# OpenSSL configuration for end-entity cert&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; req &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;&lt;br&gt;prompt             &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; no&lt;br&gt;string_mask        &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; default&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;# The size of the keys in bits:&lt;/span&gt;&lt;br&gt;default_bits       &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2048&lt;/span&gt;&lt;br&gt;distinguished_name &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; req_distinguished_name&lt;br&gt;&lt;br&gt;x509_extensions    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; x509_ext&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; req_distinguished_name &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;# Note that the following are in &#39;reverse order&#39; to what you&#39;d expect to see.&lt;/span&gt;&lt;br&gt;&lt;br&gt;countryName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; gb&lt;br&gt;organizationName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Test&lt;br&gt;commonName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; localhost&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; x509_ext &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;keyUsage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;critical,digitalSignature,keyAgreement&lt;br&gt;&lt;br&gt;subjectAltName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; @alt_names&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;# Multiple Alternate Names are possible&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;alt_names&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;DNS.1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; justmarkup.localhost&lt;br&gt;DNS.2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; justmarkup.test&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You have to change the following things here. First, change organizationName to the same name you have set in your root.cnf. Next, change DNS.1 to your local domain name. You can also use multiple here by using DNS.2, DNS.3 and so on.&lt;/p&gt;
&lt;p&gt;After saving the file, open your command line again and run the following:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;openssl req -nodes -new -keyout server.key -out server.csr -config server.cnf&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;generate-the-certificate&quot;&gt;Generate the certificate &lt;a class=&quot;permalink&quot; href=&quot;#generate-the-certificate&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Stay in the command line and run the following next:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;openssl x509 -days &lt;span class=&quot;token number&quot;&gt;3650&lt;/span&gt; -req -in server.csr -CA root.cer -CAkey root.key -set_serial &lt;span class=&quot;token number&quot;&gt;123&lt;/span&gt; -out server.cer -extfile server.cnf -extensions x509_ext&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here you are required to enter the pass phrase you entered before, I hope you still remember it. Otherwise, you sadly have to start again.&lt;/p&gt;
&lt;p&gt;Great, we now have an SSL certificate valid for ten years.&lt;/p&gt;
&lt;h2 id=&quot;setting-up-node.js-and-a-https-server&quot;&gt;Setting up Node.js and a HTTPS server &lt;a class=&quot;permalink&quot; href=&quot;#setting-up-node.js-and-a-https-server&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you haven’t installed npm and node yet, you should do now to follow along. Here are instructions for &lt;a href=&quot;https://nodesource.com/blog/installing-nodejs-tutorial-mac-os-x/&quot;&gt;MacOS&lt;/a&gt;, &lt;a href=&quot;https://www.ostechnix.com/install-node-js-linux/&quot;&gt;Linux&lt;/a&gt;, &lt;a href=&quot;http://blog.teamtreehouse.com/install-node-js-npm-windows&quot;&gt;Windows&lt;/a&gt; and &lt;a href=&quot;https://daverupert.com/2018/04/developing-on-windows-with-wsl-and-visual-studio-code/#installing-node&quot;&gt;Linux subystem on Windows&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, now we have npm and node installed we first have to init the project. Open your command line and move to your projects folder and init npm with:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; init&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will create a package.json file. Next, we need to install express.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; i express -g --save&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will add express as a dependency to our project. Now open your index.js (The entry point you selected before when using npm init – it is index.js by default if you didn’t select another one before) and add the following:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; express &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;express&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; app &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fs &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;fs&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; https &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;https&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; sslOptions &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    key&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;readFileSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;./cert/server.key&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    cert&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;readFileSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;./cert/server.cer&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;https&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createServer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;sslOptions&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; app&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3001&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Hello SSL!&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now go back to your command line and run:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;node index.js&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you now open &lt;a href=&quot;https://justmarkup.localhost:3001/&quot;&gt;https://justmarkup.localhost:3001&lt;/a&gt; (replace justmarkup.localhost with the name of your local domain) in your browser you should see “Hello SSL!”. There is still one problem, while we can serve the local domain now via https it is still considered invalid by browsers, so let’s change this.&lt;/p&gt;
&lt;h2 id=&quot;install-the-certificate-authority&quot;&gt;Install the Certificate Authority &lt;a class=&quot;permalink&quot; href=&quot;#install-the-certificate-authority&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On every OS there are different ways, how to install the Certificate Authority. Please see this &lt;a href=&quot;https://www.dionysopoulos.me/255-forge-your-own-ssl-certificates-for-local-development.html#Install_the_Certificate_Authority_529&quot;&gt;post&lt;/a&gt; to find out how to install it on your OS. Note that for Firefox you need an additional installation as they use their own certificate authority store.&lt;/p&gt;
&lt;p&gt;In all cases you need to install the root.cer and not the server.cer – took me some time to figure this out.&lt;/p&gt;
&lt;p&gt;After installing it and restarting the browser, the ceritificate is now valid and you can test everything related to https on your local machine. 🎉&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/05/https.png&quot; alt=&quot;Screenshot showing justmarkup.localhost running on https with the green secure mark&quot;&gt;&lt;/p&gt;
&lt;p&gt;Note: I got most of the information from &lt;a href=&quot;https://unix.stackexchange.com/questions/382786/the-correct-way-of-implementing-ssl-on-localhost/382811#382811&quot;&gt;this post on stackexchange&lt;/a&gt; and this &lt;a href=&quot;https://www.dionysopoulos.me/255-forge-your-own-ssl-certificates-for-local-development.html#Install_the_Certificate_Authority_529&quot;&gt;post&lt;/a&gt;. Thanks a lot for providing the information and giving me the starting point for this article.&lt;/p&gt;
&lt;p&gt;Update 07.02.2018: Updated the example and included the -days option as mentioned by &lt;a href=&quot;https://twitter.com/josh_walcher&quot;&gt;Josh Walcher&lt;/a&gt;. Using this with a value of 3650 means you don’t have to renew the certificate every month as it will be valid for 10 years.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Collection of CSS snippets</title>
							<link>https://justmarkup.com/log/2018/03/collection-of-css-snippets/</link>
							<pubDate>2018-03-27T02:45:05+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/03/collection-of-css-snippets/</guid>
							<description>&lt;p&gt;Some time ago I asked on twitter about the favorite CSS snippets people use regularly.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;What’s you favorite CSS snippets which you use again and again?&lt;/p&gt;
&lt;p&gt;Rules:&lt;br&gt;
– Has to fit in one tweet&lt;br&gt;
– Has to be vanilla CSS (not Sass, Less…)&lt;br&gt;
– You don’t have to include vendor prefixes&lt;/p&gt;
&lt;p&gt;Go!&lt;/p&gt;
&lt;p&gt;— Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/974573989497593856?ref_src=twsrc%5Etfw&quot;&gt;16. März 2018&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A lot of people replied with great snippets. So, without further ado, here are the most mentioned ones:&lt;/p&gt;
&lt;h2 id=&quot;%E2%80%9Cresponsive%E2%80%9D-media&quot;&gt;“Responsive” media &lt;a class=&quot;permalink&quot; href=&quot;#%E2%80%9Cresponsive%E2%80%9D-media&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;img,&lt;br&gt;video,&lt;br&gt;audio&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using this all the img, video and audio elements won’t be larger than 100% of the container width. This prevents a common issue where an image is larger than the width of the container and therefore causes an overflow. This is the easiest way to implement responsive images, but we have great support for &lt;code&gt;picture&lt;/code&gt; and &lt;code&gt;srcset&lt;/code&gt; now and should make use of them. Read more about it in this &lt;a href=&quot;https://cloudfour.com/thinks/responsive-images-101-definitions/&quot;&gt;great series&lt;/a&gt; where responsive images are explained in great detail.&lt;/p&gt;
&lt;h2 id=&quot;text-selection&quot;&gt;Text selection &lt;a class=&quot;permalink&quot; href=&quot;#text-selection&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;::selection&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #000&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fbd404&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to change the default browser style how a text looks when selected you can use the ::selection pseudo-element. Support is &lt;a href=&quot;https://caniuse.com/#feat=css-selection&quot;&gt;pretty good&lt;/a&gt;. Read more about it on &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/::selection&quot;&gt;MDN&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;clearfix&quot;&gt;Clearfix &lt;a class=&quot;permalink&quot; href=&quot;#clearfix&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.clearfix::after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; table&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; both&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That’s one I have used in one or another form for many years. For older browsers we &lt;a href=&quot;https://css-tricks.com/snippets/css/clear-fix/&quot;&gt;used some hacks&lt;/a&gt;, but nowadays we don’t need them anymore and can use this version. Some noted in the thread that clear is not needed anymore, as we have Flexbox and Grid now, but I have to disagree on this as float and clear still has its place and may ever have. In the future we may use &lt;a href=&quot;https://www.rachelandrew.co.uk/archives/2017/01/24/the-end-of-the-clearfix-hack/&quot;&gt;display: flow-root;&lt;/a&gt; instead of clear though.&lt;/p&gt;
&lt;h2 id=&quot;box-sizing&quot;&gt;Box sizing &lt;a class=&quot;permalink&quot; href=&quot;#box-sizing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;box-sizing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; border-box&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;*,&lt;br&gt;*::before,&lt;br&gt;*::after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;box-sizing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; inherit&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;a href=&quot;https://css-tricks.com/box-sizing/&quot;&gt;box-sizing property&lt;/a&gt; can make building CSS layouts easier and a lot more intuitive. There is even an &lt;a href=&quot;https://css-tricks.com/international-box-sizing-awareness-day/&quot;&gt;International box-sizing Awareness Day&lt;/a&gt;. Setting the value to &lt;code&gt;border-box&lt;/code&gt; for &lt;code&gt;box-sizing&lt;/code&gt; tells the browser to account for any border and padding in the values you specify for an element’s width and height. This means if you set an element’s width to 20em, it’s padding to 1em and it’s border-width to 10px, the element will still be 20em width in total.&lt;/p&gt;
&lt;h2 id=&quot;flexbox%2Fgrid&quot;&gt;Flexbox/Grid &lt;a class=&quot;permalink&quot; href=&quot;#flexbox%2Fgrid&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There were some answers mentioning Flexbox or Grid, like this ones:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.fukol-grid&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; wrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; -0.5em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.fukol-grid &gt; *&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1 0 5em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.5em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.class&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; space-between&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;::root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--min-col-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 250px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.overview&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; grid&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;grid-template-columns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;auto-fit&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;minmax&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--min-col-width&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1fr&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We have come a long way with defining layout using CSS. If you want to learn more about Flexbox and Grid I recommend &lt;a href=&quot;https://gridbyexample.com/&quot;&gt;Grid by Example&lt;/a&gt;, the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox&quot;&gt;Flexbox Guide on MDN&lt;/a&gt;, the &lt;a href=&quot;https://css-tricks.com/snippets/css/complete-guide-grid/&quot;&gt;Grid&lt;/a&gt; and &lt;a href=&quot;https://css-tricks.com/snippets/css/a-guide-to-flexbox/&quot;&gt;Flexbox&lt;/a&gt; guides on CSS-Tricks and everything &lt;a href=&quot;https://rachelandrew.co.uk/&quot;&gt;Rachel Andrew&lt;/a&gt; and &lt;a href=&quot;http://jensimmons.com/&quot;&gt;Jen Simmons&lt;/a&gt; have ever written and said about Grid and Flexbox.&lt;/p&gt;
&lt;h2 id=&quot;center-elements&quot;&gt;Center elements &lt;a class=&quot;permalink&quot; href=&quot;#center-elements&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Another one, many mentioned was some form of centering an element. When you look at all the stupid jokes made about CSS, it seems it is impossible to center elements in CSS. It may have been hard 10 years ago, but today there are many ways to center element vertically and horizontally.&lt;/p&gt;
&lt;p&gt;Here are some of the replies mentioning centering.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.🦄&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; grid&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;place-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100vh&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.foo&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; translate &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;-50%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; -50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are even more ways to center elements as you can read in this &lt;a href=&quot;https://css-tricks.com/centering-css-complete-guide/&quot;&gt;guide&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;aspect-ratio&quot;&gt;Aspect ratio &lt;a class=&quot;permalink&quot; href=&quot;#aspect-ratio&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.video-wrapper&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;padding-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 56.25%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* 16:9 */&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;padding-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 25px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.video-wrapper iframe&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.wrapper&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;/* 16:9 */&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--ratio-h&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 16&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--ratio-v&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 9&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;padding-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--ratio-v&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; / &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--ratio-h&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; * 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.wrapper &gt; .element&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--ratio-x&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 16&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;--ratio-y&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 9&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div::before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;padding-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--ratio-y&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; / &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--ratio-x&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; * 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The padding-bottom hack (also called Instrinsic Ratios or &lt;a href=&quot;https://css-tricks.com/aspect-ratio-boxes/&quot;&gt;Aspect Ratio Boxes&lt;/a&gt;) has been used for &lt;a href=&quot;https://alistapart.com/article/creating-intrinsic-ratios-for-video&quot;&gt;many years&lt;/a&gt; now and even now and then people also come up with new ways like &lt;a href=&quot;https://codeburst.io/keeping-aspect-ratio-with-html-and-no-padding-tricks-40705656808b&quot;&gt;this one using CSS Grid and SVG&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;cursor%3Apointer&quot;&gt;cursor:pointer &lt;a class=&quot;permalink&quot; href=&quot;#cursor%3Apointer&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;label, &lt;br&gt;button, &lt;br&gt;input, &lt;br&gt;select&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; pointer&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;label[for]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; pointer&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I first replied to this that it may not be a good idea to change the default cursor styles for form elements, but I am not sure anymore as many people mentioned that most people expect the pointer cursor for all interactive elements and not only for links.&lt;/p&gt;
&lt;h2 id=&quot;truncation&quot;&gt;Truncation &lt;a class=&quot;permalink&quot; href=&quot;#truncation&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.ellipsis&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;text-overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; ellipsis&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.truncated&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;text-overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; ellipsis&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 15rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At first this looks like a smart way, but truncating text with CSS can have many side-effects, as you may end up with unwanted words. I know that this is used often, but you should try to find another way if possible. I wrote about how to deal with long words &lt;a href=&quot;https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;max-width&quot;&gt;Max-width &lt;a class=&quot;permalink&quot; href=&quot;#max-width&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100% - 40px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 75ch&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 38em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Max-width and max-height are as their name says for defining the maximal width/height an element should be. I use this a lot for containers and also for text to keep line length at around 50 to 75 characerts. Here, the ch unit comes in handy.&lt;/p&gt;
&lt;h2 id=&quot;reduced-motion&quot;&gt;Reduced motion &lt;a class=&quot;permalink&quot; href=&quot;#reduced-motion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;prefers-reduced-motion&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; reduce&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On iOS and MacOS user can reduce motion via settings and we can and should react to this preference in our CSS and JavaScript Code. You can read more about it in this &lt;a href=&quot;http://valhead.com/2017/06/23/reduced-motion-query/&quot;&gt;article by Val Head&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;responsive-font-size&quot;&gt;Responsive font-size &lt;a class=&quot;permalink&quot; href=&quot;#responsive-font-size&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 12px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 768px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 14px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 992px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 16px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1200px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 18px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.class&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1em + 1vw&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A combination of vw and em is great here as it will scale the text and at the same time won’t disable browser zoom.&lt;/p&gt;
&lt;h2 id=&quot;print-external-urls&quot;&gt;Print external URLs &lt;a class=&quot;permalink&quot; href=&quot;#print-external-urls&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; print&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token selector&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;text-decoration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; underline&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token selector&quot;&gt;[href]:not([href^=&quot;#&quot;]):after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;        &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39; (&#39;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;) &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Web pages are still printed sometimes and with this snippet you can make the URL of Links visible.&lt;/p&gt;
&lt;h2 id=&quot;visually-hidden&quot;&gt;Visually hidden &lt;a class=&quot;permalink&quot; href=&quot;#visually-hidden&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.visually-hidden&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;clip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is another one I have used since the very beginning of me using CSS. This way you can make text available to screen readers while hiding it visually.&lt;/p&gt;
&lt;h2 id=&quot;normalize&quot;&gt;Normalize &lt;a class=&quot;permalink&quot; href=&quot;#normalize&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;abbr[title],&lt;br&gt;acronym[title],&lt;br&gt;dfn&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; help&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;font-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; italic&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;textarea&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;resize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; vertical&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;[disabled]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; default&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;[aria-disabled=&quot;true&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; default&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;pointer-events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.no-js button[type=&quot;button&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;svg&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;fill&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; currentColor&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;sub,&lt;br&gt;sup&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;vertical-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; middle&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;overscroll-behavior&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I mostly use &lt;a href=&quot;https://github.com/necolas/normalize.css/blob/master/normalize.css&quot;&gt;normalize.css&lt;/a&gt; as a starting point and copy all needed code from there. There is also &lt;a href=&quot;https://github.com/sindresorhus/modern-normalize&quot;&gt;modern normalize&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;debugging&quot;&gt;Debugging &lt;a class=&quot;permalink&quot; href=&quot;#debugging&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px solid &lt;span class=&quot;token property&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;img:not([alt]),&lt;br&gt;img[alt=&quot;&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;outline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5px solid red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Setting a red outline/border is the console.log of CSS debugging. If you want to find accessibility issues, there is &lt;a href=&quot;https://ffoodd.github.io/a11y.css/index.html&quot;&gt;a11y.css&lt;/a&gt; and if you want to find bad HTML there is &lt;a href=&quot;https://github.com/Heydon/REVENGE.CSS&quot;&gt;revenge.css&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;box-shadow&quot;&gt;Box shadow &lt;a class=&quot;permalink&quot; href=&quot;#box-shadow&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.classname&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 10px 20px &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0.19&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 6px 6px &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0.23&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Seems like people really like the box shadows defined in Material Design.&lt;/p&gt;
&lt;h2 id=&quot;outline&quot;&gt;Outline &lt;a class=&quot;permalink&quot; href=&quot;#outline&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Various people also mentioned that they reset the outline property for all elements. This is a &lt;a href=&quot;http://outlinenone.com/&quot;&gt;bad idea&lt;/a&gt; if you don’t have other focus styles for all elements in place; Please never do this and always test the site using only your keyboard to find issues with &lt;code&gt;:focus&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;tel%3A-links&quot;&gt;tel: Links &lt;a class=&quot;permalink&quot; href=&quot;#tel%3A-links&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;a[href^=&quot;tel&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;pointer-events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;text-decoration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; inherit&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 30em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;a[href^=&quot;tel&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;pointer-events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;text-decoration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; underline&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I wish there would be a way to detect if an OS or and App installed there offers the option to make use of tel: links. Assuming bigger screens means that they can’t handle tel: links is not always true.&lt;/p&gt;
&lt;h2 id=&quot;html-for-emails&quot;&gt;HTML for Emails &lt;a class=&quot;permalink&quot; href=&quot;#html-for-emails&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.★:not(#★)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* for targeting AOL */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; yahoo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* for targeting Yahoo */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;u+ .body .foo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* for targeting Gmail */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;#MessageWebViewDiv .foo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* for targeting Samsung mail */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;[OWA] .foo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* for targeting http://Outlook.com  */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I didn’t need to write any HTML for emails for year, but looks like this is still a mess and requires lots of hacks for different clients; Crazy stuff.&lt;/p&gt;
&lt;h2 id=&quot;all-snippets&quot;&gt;All snippets &lt;a class=&quot;permalink&quot; href=&quot;#all-snippets&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I haven’t mentioned all snippets here. If you want to see all snippets have a look at the &lt;a href=&quot;https://twitter.com/justmarkup/status/974573989497593856&quot;&gt;twitter thread&lt;/a&gt; or you can read also most of them in a curated &lt;a href=&quot;https://blog.wb.gy/css-snippest/&quot;&gt;summary article&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/geeksamu&quot;&gt;Ahmed Abdelsalam&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Do Not Track user preference</title>
							<link>https://justmarkup.com/log/2018/03/do-not-track-user-preference/</link>
							<pubDate>2018-03-01T14:09:26+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/03/do-not-track-user-preference/</guid>
							<description>&lt;p&gt;Recently, I got reminded about the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT&quot;&gt;Do Not Track (DNT) request header&lt;/a&gt;. As a user, you can enable DNT in various &lt;a href=&quot;http://donottrack.us/&quot;&gt;browsers&lt;/a&gt; and as a website this setting should be respected. In reality very few websites honor DNT as there are no legal or technological requirements to do so and sadly most prefer to collect as much data as possible instead of respecting privacy.&lt;/p&gt;
&lt;p&gt;What many of these websites may not realize is that they are already not able to track most of the users which have DNT enabled, as many of them also use Ad blocker or other extensions to block tracking scripts. So, why not honor the DNT and don’t load the analytics script if it is enabled by a user.&lt;/p&gt;
&lt;p&gt;You can check if a user has DNT enabled either on the server-side or on the client-side.&lt;/p&gt;
&lt;h2 id=&quot;client-side&quot;&gt;Client-side &lt;a class=&quot;permalink&quot; href=&quot;#client-side&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We can use JavaScript to check for DNT on the client-side. Here is an example, which only loads Google Analytics if DNT is not enabled.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; doNotTrack &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;doNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;doNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;yes&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;msDoNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;doNotTrack &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;doNotTrack&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; _gaq &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;_setAccount&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;UA-XXXXX-X&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;_trackPageview&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;d&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; t&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; g &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; d&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;t&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;            s &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; d&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementsByTagName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;t&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        g&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;https://ssl.google-analytics.com/ga.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentNode&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;insertBefore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;script&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The standard way to test for DNT is using &lt;code&gt;navigator.doNotTrack&lt;/code&gt;, which either returns “1” if DNT is enabled or “0” if not. However, some browsers use &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Navigator/doNotTrack#Browser_compatibility&quot;&gt;non-standard properties and values&lt;/a&gt;, that’s why we have to extend the test to cover all of them.&lt;/p&gt;
&lt;h2 id=&quot;server-side&quot;&gt;Server-side &lt;a class=&quot;permalink&quot; href=&quot;#server-side&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Even better than checking it on the client-side is checking it directly on the server-side, as there are &lt;a href=&quot;https://kryogenix.org/code/browser/everyonehasjs.html&quot;&gt;many ways&lt;/a&gt; JavaScript could fail to execute.&lt;/p&gt;
&lt;h3 id=&quot;php&quot;&gt;PHP &lt;a class=&quot;permalink&quot; href=&quot;#php&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you are using PHP, the information is available in the $_SERVER array:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$donottrack&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;HTTP_DNT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;HTTP_DNT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$donottrack&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;embed analytics script&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;node.js&quot;&gt;Node.js &lt;a class=&quot;permalink&quot; href=&quot;#node.js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Node.js it is available via &lt;code&gt;req.header.dnt&lt;/code&gt;. Here is an example using Express.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; donottrack &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;header&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dnt &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;header&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dnt &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &#39;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;index&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        dnt&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; donottrack&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And now you can check for the dnt variable in the template.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;dnt&lt;br&gt;    &lt;span class=&quot;token function&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;src&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;analytics.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Implementing a solution to honor DNT is a relatively small effort (it took less than five minutes for me to implement it here, to only load analytics/ads if DNT is not enabled). Many websites will fear to implement this, as they want to track all users. However, for most websites the numbers won’t really change after implementing DNT as they are already not able to track most of them.&lt;/p&gt;
&lt;p&gt;Update 19.02.2019: Safari removed support for DNT in &lt;a href=&quot;https://webkit.org/blog/8594/release-notes-for-safari-technology-preview-75/&quot;&gt;Technology Preview 75&lt;/a&gt;, because some sites used it for tracking users – oh the irony.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Gifhancement – convert GIF to video and embed responsible</title>
							<link>https://justmarkup.com/log/2018/02/gifhancement/</link>
							<pubDate>2018-02-26T07:21:26+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/02/gifhancement/</guid>
							<description>&lt;p&gt;In 2017, the average transfer size for websites was &lt;a href=&quot;https://www.pingdom.com/2017&quot;&gt;3,4 MB&lt;/a&gt;. A big part of it (on average 1.8 MB) are images. Especially on article sites, many of these images may be GIFs. Some of these GIFs are multiple MBs and while looking at GIFs can be really funny, it is less so if you watch them on a slow device or when exceeding your available data by reading only one article. In this article, I will show how to convert GIF to MP4 to save data, how to embed the video responsible, how to react to the Save-Data header, how to enhance it using the IntersectionObserver and how to use MP4 as source for an image in supported browsers.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/Download.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;converting-gif-to-mp4&quot;&gt;Converting GIF to MP4 &lt;a class=&quot;permalink&quot; href=&quot;#converting-gif-to-mp4&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First we have to convert our existing GIF files to MP4. There are multiple options available.&lt;/p&gt;
&lt;h3 id=&quot;use-ffmpeg-and-the-command-line&quot;&gt;Use FFmpeg and the command line &lt;a class=&quot;permalink&quot; href=&quot;#use-ffmpeg-and-the-command-line&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First you have to &lt;a href=&quot;https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg&quot;&gt;download and install FFmpeg&lt;/a&gt;, and after that, you can run &lt;code&gt;ffmpeg -i source.gif output.mp4&lt;/code&gt; in your terminal to convert a GIF with the name source to a MP4 with the name output to the same folder. You can also &lt;a href=&quot;https://gist.github.com/shazow/dcb5c6744d1837bed6d2&quot;&gt;batch convert a directory of GIFs&lt;/a&gt;. Installing FFmpeg can be a challenge, so let’s see what other options we have.&lt;/p&gt;
&lt;h3 id=&quot;online-converter&quot;&gt;Online converter &lt;a class=&quot;permalink&quot; href=&quot;#online-converter&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are &lt;a href=&quot;https://cloudconvert.com/gif-to-mp4&quot;&gt;multiple&lt;/a&gt; &lt;a href=&quot;https://ezgif.com/gif-to-mp4&quot;&gt;Services&lt;/a&gt; available online to convert GIF to MP4 and many also allow you to convert multiple at once.&lt;/p&gt;
&lt;h3 id=&quot;cloudinary&quot;&gt;Cloudinary &lt;a class=&quot;permalink&quot; href=&quot;#cloudinary&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you are already using Cloudinary, you can &lt;a href=&quot;https://cloudinary.com/blog/reduce_size_of_animated_gifs_automatically_convert_to_webm_and_mp4&quot;&gt;replace .gif with .mp4 and they will dynamically convert it&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;giphy&quot;&gt;Giphy &lt;a class=&quot;permalink&quot; href=&quot;#giphy&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When using a GIF from Giphy you can download a GIF and a MP4 version directly there.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/giphy_download.png&quot; alt=&quot;Download modal from giphy showing download buttons for GIF, social and video&quot;&gt;&lt;/p&gt;
&lt;p&gt;There are other options available, but let’s move on to embedding the video on a site.&lt;/p&gt;
&lt;h2 id=&quot;use-%3Cvideo%3E-as-default&quot;&gt;Use &amp;lt;video&amp;gt; as default &lt;a class=&quot;permalink&quot; href=&quot;#use-%3Cvideo%3E-as-default&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We start with using the video element:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;video&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;muted&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;controls&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;playsinline&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-gif&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;preload&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;metadata&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;video/mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    Your browser doesn&#39;t support playing videos, but you can download it  instead. &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.gif&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Download as GIF (1000kB)&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Download as Video(100kB)&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I added &lt;code&gt;preload=&amp;quot;metadata&amp;quot;&lt;/code&gt; to avoid that the browser will preload the whole video, and also the &lt;code&gt;controls&lt;/code&gt; attribute to show the video controls and &lt;code&gt;playsinline&lt;/code&gt; so the video will play inline and not fullscreen on iOS. This way the user can decide if they want to view the video or not. In addition, I added a fallback text for unsupported browsers and links to download the file as GIF or MP4. This is, however, not really a replacement for a GIF, so let`s move on.&lt;/p&gt;
&lt;h2 id=&quot;autoplay-video-if-supported&quot;&gt;Autoplay video if supported &lt;a class=&quot;permalink&quot; href=&quot;#autoplay-video-if-supported&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;GIFs are autoplaying and to make our video react like a GIF we want the video to start immediately and also loop. First we check if the browser is capable of autoplaying videos:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// https://git.io/vH4Ek&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;supports_video_autoplay&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; v &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;video&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    v&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;paused &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; p &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        p &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;play&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; v &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; v&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;play&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;typeof&lt;/span&gt; callback &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;function&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;v&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;paused &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Promise&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; p &lt;span class=&quot;token keyword&quot;&gt;instanceof&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token function&quot;&gt;supports_video_autoplay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;supportsAutoplay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// supports video autoplay and querySelector&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;supportsAutoplay &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; videos &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-gif]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;videos&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;controls&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;autoplay&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;loop&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// no video autoplay support :(&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I found this test after looking at the Modernizr repository and seeing this solution by &lt;a href=&quot;https://github.com/paulorely&quot;&gt;Paul O’Rely&lt;/a&gt;. If the browser supports autoplay we get all our “GIF videos”, remove the &lt;code&gt;controls&lt;/code&gt; attribute and add the &lt;code&gt;autoplay&lt;/code&gt; and &lt;code&gt;loop&lt;/code&gt; attributes. This way the videos will now autoplay and loop like a GIF.&lt;/p&gt;
&lt;h2 id=&quot;use-intersectionobserver&quot;&gt;Use IntersectionObserver &lt;a class=&quot;permalink&quot; href=&quot;#use-intersectionobserver&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So, now all our GIF videos start automatically if autoplay is supported. We may use several of these videos on a page and playing them all at once means the browser has to download them all and this may also make the site unresponsive. So, as a next step we only play videos if they are actually in the Viewport using the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API&quot;&gt;Intersection Observer API&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;supportsAutoplay &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;IntersectionObserver&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; videos &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-gif]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    observer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;IntersectionObserver&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;entries&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        entries&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;entry&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; video &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; entry&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;intersectionRatio &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token comment&quot;&gt;// video is in the viewport - start it&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;autoplay&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;autoplay&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;loop&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;                video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;play&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token comment&quot;&gt;// video is outside the viewport - pause it&lt;/span&gt;&lt;br&gt;                video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pause&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;videos&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;controls&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        observer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;observe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;video&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First we change our feature test and check if &lt;code&gt;IntersectionObserver&lt;/code&gt; is supported. Next we define a new IntersectionObserver. If &lt;code&gt;entry.intersectionRatio&lt;/code&gt; is bigger than 0, the video is in the viewport. In this case we add the &lt;code&gt;autoplay&lt;/code&gt; and &lt;code&gt;loop&lt;/code&gt; attributes if they were not already added and play the video. Otherwise, we will pause the video.&lt;/p&gt;
&lt;p&gt;You may have noticed that by changing our feature test, now only browsers which support &lt;code&gt;IntersectionObserver&lt;/code&gt; will get the autoplay feature. Support for &lt;a href=&quot;https://caniuse.com/#feat=intersectionobserver&quot;&gt;IntersectionObserver&lt;/a&gt; is pretty good, and as people using older browsers also often use slower hardware I prefer to not play all videos at once for them and instead giving them a choice.&lt;/p&gt;
&lt;h2 id=&quot;save-data-header&quot;&gt;Save-data header &lt;a class=&quot;permalink&quot; href=&quot;#save-data-header&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There is another case where we shouldn’t autoplay any video, when the Save-data header is present.&lt;/p&gt;
&lt;p&gt;We should use the &lt;a href=&quot;https://developers.google.com/web/updates/2016/02/save-data&quot;&gt;Save-Data client hint request header&lt;/a&gt; to reduce the initial transfer size for users who have opted-in to “data savings” mode in their browser.&lt;/p&gt;
&lt;p&gt;We can either get the info if a user has turned on Save-data on the server-side. Here is an example using PHP, which will set the &lt;code&gt;data-save-data&lt;/code&gt; attribute on the html element if the header returns true.&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;$saveData = (isset($_SERVER[&quot;HTTP_SAVE_DATA&quot;]) &amp;amp;&amp;amp; stristr($_SERVER[&quot;HTTP_SAVE_DATA&quot;], &quot;on&quot;) !== false) ? true : false;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$saveData&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;data-save-data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;endif&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token delimiter important&quot;&gt;?&gt;&lt;/span&gt;&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can also check for Save-data on the client-side.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; saveData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;  navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;saveData&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, we extend our test and check for saveData. If a user opt-in to saveData we will not autoplay the videos.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; saveData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;  navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;saveData&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;supported &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;IntersectionObserver&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;saveData&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// autoplay videos&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;enhance-with-serving-mp4-via-%3Cimg%3E&quot;&gt;Enhance with serving MP4 via &amp;lt;img&amp;gt; &lt;a class=&quot;permalink&quot; href=&quot;#enhance-with-serving-mp4-via-%3Cimg%3E&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The latest Safari Technology Preview now has support for using MP4 as the source for an img &lt;code&gt;&amp;lt;img src=&amp;quot;file.mp4&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;&lt;/code&gt;. Early &lt;a href=&quot;https://calendar.perfplanet.com/2017/animated-gif-without-the-gif/&quot;&gt;tests&lt;/a&gt; show that using img instead of video to deliver MP4 files result in 20x faster display and 7x faster decoding time. Let’s see how we can improve our code to use img instead of video to show the video file.&lt;/p&gt;
&lt;p&gt;First we need a feature test to check if the MP4 format is supported for img:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;supports_mp4_in_img&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; image &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; isSupported &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;width &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;height &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token function&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;isSupported&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onerror&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token function&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    image&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAs1tZGF0AAACrgYF//+q3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0OCByMjYwMSBhMGNkN2QzIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNSAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MzoweDExMyBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MSBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTEgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0zIGJfcHlyYW1pZD0yIGJfYWRhcHQ9MSBiX2JpYXM9MCBkaXJlY3Q9MSB3ZWlnaHRiPTEgb3Blbl9nb3A9MCB3ZWlnaHRwPTIga2V5aW50PTI1MCBrZXlpbnRfbWluPTEwIHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAD2WIhAA3//728P4FNjuZQQAAAu5tb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAZAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACGHRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAZAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAgAAAAIAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAGQAAAAAAAEAAAAAAZBtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAACgAAAAEAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAE7bWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAA+3N0YmwAAACXc3RzZAAAAAAAAAABAAAAh2F2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAgACAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAxYXZjQwFkAAr/4QAYZ2QACqzZX4iIhAAAAwAEAAADAFA8SJZYAQAGaOvjyyLAAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAQAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAsUAAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU2LjQwLjEwMQ==&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For our test we define a &lt;code&gt;new Image()&lt;/code&gt;, use a small base64 encoded mp4 file and check onload if the width and height are bigger than 0. If yes the browser supports mp4 files for images. If not or if there was an error it doesn’t support it.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;supports_mp4_in_img&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;supportsMP4InImg&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;supportsMP4InImg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; videos &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-gif]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;videos&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; img &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;source&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;alt&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;decode&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;decode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentNode&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replaceChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;img&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; video&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    video&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentNode&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replaceChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;img&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; video&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;  &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// use as described before&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we call the test function and if the callback returns true we can change our videos to images. We loop over all our videos and for every video found create a new img and replace the video with it. We also add the alt attribute for the img here. As the latest Safari version also supports &lt;a href=&quot;https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode&quot;&gt;the decode method for img&lt;/a&gt;, I added a test here to use this instead of onload when supported. The decode method is great because it ensures that the image can be appended to the DOM without causing a decoding delay on the next frame.&lt;/p&gt;
&lt;h2 id=&quot;last-fallback&quot;&gt;Last fallback &lt;a class=&quot;permalink&quot; href=&quot;#last-fallback&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;According to &lt;a href=&quot;https://caniuse.com/#feat=video&quot;&gt;Can I use&lt;/a&gt; about 94% of all actively used browsers support the &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; element. My first idea was to use &lt;code&gt;&amp;lt;img src=&amp;quot;cat.gif&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;&lt;/code&gt; as a fallback inside the &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; element, but after some testing I found that modern browser, with support for the video element will download the img defined inside. So this is a no-go as our goal is to decrease transferred file size and not increasing it even more.&lt;/p&gt;
&lt;h3 id=&quot;use-%3Cobject%3E&quot;&gt;Use &amp;lt;object&amp;gt; &lt;a class=&quot;permalink&quot; href=&quot;#use-%3Cobject%3E&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; is not a solution, I next tried with &lt;code&gt;&amp;lt;object&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;video&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;muted&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;autoplay&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;loop&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;playsinline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;video/mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;object&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.gif&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;image/gif&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Alternative text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;object&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.gif&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Download as GIF (1000kB)&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;file.mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Download as Video(100kB)&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using &lt;code&gt;&amp;lt;object&amp;gt;&lt;/code&gt; only browsers not supporting &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; will request the file. That’s at least what my test confirmed, but as there are many more browsers and I can`t test in all I am not 100% sure this will always be the case. This way all browsers not supporting the video element will use the object and show the GIF as a fallback. I also added alternative text inside the object and two links after it to be able to easily download the GIF or video.&lt;/p&gt;
&lt;p&gt;The advantage of this is that all users will immediately see the GIF/video, but it also feels hacky and as users using old browsers often also use slow hardware and slow connections, forcing them to download and parse all this data may be too much for their browser. So, I would say using the links to download should be enough. If the user want to see the GIF, they can always download it.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Using &lt;code&gt;&amp;lt;img src=&amp;quot;file.gif&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;&lt;/code&gt; is sure the easiest way to embed a GIF, but by doing so we force the user to download lots o unneeded data and slow down their device. In the future we may use &lt;code&gt;&amp;lt;img src=&amp;quot;file.mp4&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;&lt;/code&gt; in all browsers, but it will take time until all browsers support this and until old browsers without support are not used anymore. Until, we can use an approach like shown here. This takes time to implement and I know this is not possible for everybody, but if you can do it consider doing it; Your users will thank you.&lt;/p&gt;
&lt;p&gt;You can find &lt;a href=&quot;https://justmarkup.github.io/demos/gifhancement/&quot;&gt;the final demo here&lt;/a&gt; and you can also have a look at the &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/gifhancement&quot;&gt;final code on Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://calendar.perfplanet.com/2017/animated-gif-without-the-gif/&quot;&gt;Evolution of &amp;lt;img&amp;gt;: Gif without the GIF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.brucelawson.co.uk/2018/video-as-the-new-gif-in-safari/&quot;&gt;Video as the new GIF in Safari&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://codepen.io/simevidas/pen/PJMENp?editors=1010&quot;&gt;Muted video autoplay by Šime Vidas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.pingdom.com/2017&quot;&gt;Web Performance Year in Review 2017&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API&quot;&gt;IntersectionObserver&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developers.google.com/web/updates/2016/02/save-data&quot;&gt;Save-data header&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode&quot;&gt;img decode method&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Enhancing a login form – from basic to validation to reveal password</title>
							<link>https://justmarkup.com/log/2018/02/enhancing-a-login-form/</link>
							<pubDate>2018-02-13T08:09:39+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/02/enhancing-a-login-form/</guid>
							<description>&lt;p&gt;Over the years I have implemented dozens of login forms and used thousands of them on the web. A login form mostly consists of a user/email field and a password field. It seems really basic, but there are many ways to make a login form unusable and as many ways to enhance it. In this article, I will share an approach of building and enhancing a login form.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/6.png&quot; alt=&quot;The final login form example&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;https&quot;&gt;HTTPS &lt;a class=&quot;permalink&quot; href=&quot;#https&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before we start implementing, we should ensure that our site uses HTTPS and redirects every HTTP request to HTTPS. This is especially important for a site with a login form, but every website should use HTTPS for security. Using HTTP will also decrease SEO and &lt;a href=&quot;https://hacks.mozilla.org/2016/01/login-forms-over-https-please/&quot;&gt;some browsers&lt;/a&gt; also show a warning in the address bar if a login form is used and the site is not using HTTPS. If security, privacy and SEO are not enough to convince a client to use HTTPS, I don’t know.&lt;/p&gt;
&lt;p&gt;Fun (not at all fun) fact: Some sites try to get around the warning by using &lt;a href=&quot;https://boingboing.net/2017/11/03/shady-websites-using-fake-pass.html&quot;&gt;a font-family only consisting of asterisk (*)&lt;/a&gt; now. If you count all the effort that went into implementing this, they could probably spend the same on moving completely to HTTPS and a SSL certificate for the next 10 years. Use HTTPS everywhere please and don’t try to play games with users.&lt;/p&gt;
&lt;h2 id=&quot;the-basic-version&quot;&gt;The basic version &lt;a class=&quot;permalink&quot; href=&quot;#the-basic-version&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s start with the front-end implementation and our basic version, a HTML form with an email field, a password field and a submit button:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;form&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/login&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Email&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Password&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Login&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will work in every browser, if the back-end is also implemented. Yes, also in &lt;a href=&quot;http://lynx.browser.org/&quot;&gt;Lynx&lt;/a&gt;. From here we start adding enhancements without breaking the basic version.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/01/1.png&quot; alt=&quot;An email field, a password field and a submit button labelled with Login&quot;&gt;&lt;br&gt;
Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/enhance-login-form/v1/&quot;&gt;demo of the basic version&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v1/index.html&quot;&gt;source code on Github.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;enhance-with-html&quot;&gt;Enhance with HTML &lt;a class=&quot;permalink&quot; href=&quot;#enhance-with-html&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While the basic HTML form works fine, we should enhance it by providing validation and hints.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;form&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/login&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__element&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__label&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            Email&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__required&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;required&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__input&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;[^]+@[^]+[.][a-z]{2,63}$&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;autocomplete&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__element&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__label&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;            Password&lt;br&gt;            &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__required&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;required&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__input&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;minlength&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;8&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-describedby&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;passwordHint&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;autocomplete&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;current-password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__hint&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;passwordHint&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;The password must be at least 8 characters long.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/forgotPassword&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Forgot password?&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Login&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s go through this step-by-step.&lt;/p&gt;
&lt;p&gt;First I added &lt;code&gt;&amp;lt;span&amp;gt;required&amp;lt;/span&amp;gt;&lt;/code&gt; inside the label elements, to make it clear that the input fields are required. Additionally, I added the &lt;a href=&quot;https://w3c.github.io/html/sec-forms.html#the-required-attribute&quot;&gt;required attribute&lt;/a&gt; to the input fields. This way, a user won’t be able to submit the form in &lt;a href=&quot;https://caniuse.com/#feat=form-validation&quot;&gt;supported browsers&lt;/a&gt; if the value of an input is empty.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/01/3.png&quot; alt=&quot;Showing the native validation message from Chrome &amp;quot;Please fill out this field&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;For the password field I also added an extra hint, so the users knows that the password must be at least 8 characters long. To make this &lt;a href=&quot;https://developer.paciellogroup.com/blog/2014/12/using-aria-describedby-to-provide-helpful-form-hints/&quot;&gt;accessible&lt;/a&gt; I use the &lt;code&gt;aria-describedby&lt;/code&gt; attribute on the input and set the value to the &lt;code&gt;id&lt;/code&gt; of our hint. To improve validation, I also added the &lt;code&gt;minlength&lt;/code&gt; attribute to the password.&lt;/p&gt;
&lt;p&gt;You may notice that I added a &lt;code&gt;pattern&lt;/code&gt; attribute for the email field and may wonder why I didn’t use &lt;code&gt;type=&amp;quot;email&amp;quot;&lt;/code&gt;. The reason is that &lt;code&gt;type=&amp;quot;email&amp;quot;&lt;/code&gt; works great in theory, but has some issues I want to avoid. The biggest problems I have with &lt;code&gt;type=&amp;quot;email&amp;quot;&lt;/code&gt; is that international email addresses are &lt;a href=&quot;https://justmarkup.com/log/2015/02/input-type-email-better-dont-use-it/&quot;&gt;not working as you may expect&lt;/a&gt; and that email addresses like foo@bar are considered valid. While this is technically true, all back-end validations I ever used don’t validate such an address which means you end up with different validation on the front-end and the back-end. So, that’s the reason that I use a pattern here. I know that this regular expression is far from bulletproof, but it more or less matches my back-end validation and I am happy with it.&lt;/p&gt;
&lt;p&gt;I also added the &lt;code&gt;autocomplete&lt;/code&gt; attribute for both fields, so password manager will offer autocomplete. By naming the input email and password they would probably already handle this correctly, but with the autocomplete attribute we are on the safe side.&lt;/p&gt;
&lt;p&gt;Last, I added a link to request a new password.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/2.png&quot; alt=&quot;An email field marked as required, a password field marked as required and a hint associated with it saying: The password must be at least 8 characters long and a submit button labelled with Login&quot;&gt;&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/enhance-login-form/v2/&quot;&gt;demo of the enhanced HTML version&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v2/index.html&quot;&gt;source code on Github.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;enhance-with-css&quot;&gt;Enhance with CSS &lt;a class=&quot;permalink&quot; href=&quot;#enhance-with-css&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While our form now has form validation and uses proper HTML it doesn’t look appealing. So, let’s add some CSS.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.form__element&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 0 1em 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.form__label&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 0 0.4em 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.form__input&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.6em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.3em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.form__required&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; right&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.8em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #ddd&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.3em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.form__hint&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.form__hint:before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;\1F6C8&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 0.2em 0 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.form__submit&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #326f10&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fff&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.6em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.4em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; right&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, I added some space between the label/input groups wrapped by &lt;code&gt;.form__element&lt;/code&gt; to make clear what groups belong together. Next, I set the label to &lt;code&gt;display: block&lt;/code&gt; so it will be above the input. I also increased the font-size and added some spacing between it and the following input. For the input itself, I set it’s width to 100% of the width of the container and also increased font-size there and added some padding.&lt;/p&gt;
&lt;p&gt;Next, I moved the required text to the right and gave it a light background. For the form hint about the password length I added an info icon using :before and aligned it directly under the input. Finally, I styled the submit button by giving it a remarkable background color, some padding and a big font size.&lt;/p&gt;
&lt;p&gt;Note: I could also use Flexbox or Grid here instead of floating, but in this case it doesn’t make much sense, as it would mean more code as I would have to provide the fallback anyway.&lt;/p&gt;
&lt;p&gt;With that in place our form now looks rather nice.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/4.png&quot; alt=&quot;An email field marked as required, a password field marked as required and a hint associated with it saying: The password must be at least 8 characters long and a submit button labelled with Login. All styled with CSS.&quot;&gt;&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/enhance-login-form/v3/&quot;&gt;demo of the enhanced CSS version&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v3/index.html&quot;&gt;source code on Github.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;feedback-messages&quot;&gt;Feedback messages &lt;a class=&quot;permalink&quot; href=&quot;#feedback-messages&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Our form now has native validation, looks good and is accessible. Let’s improve this even more with feedback messages.&lt;br&gt;
The first case is that a user enters all data correctly and gets logged in. In this case, a redirect happens on the server-side to a page only accessible by logged-in users. I prefer to add a success message on top of the page so the user knows immediately that the login was successful.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message message--success&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message__text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;You have successfully logged in. Welcome back!&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message__close&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-closenotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message__closetext&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Close message&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s go through the HTML used for the feedback message. On the wrapper I set a data attribute, which I will later us in JavaScript, and some classes for styling it.&lt;/p&gt;
&lt;p&gt;Next, we have the text, followed by a button. This button has the &lt;code&gt;hidden&lt;/code&gt; attribute initially set, as the button only works when JavaScript is available and should therefore be hidden until we are sure JavaScript can be used. &lt;a href=&quot;https://caniuse.com/#search=hidden&quot;&gt;Browser support&lt;/a&gt; for the &lt;code&gt;hidden&lt;/code&gt; attribute is pretty good, but you should add &lt;code&gt;[hidden] {display: none}&lt;/code&gt; in CSS, so it will also be hidden in unsupported browsers.&lt;/p&gt;
&lt;p&gt;Let’s move to the JavaScript part:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// cut the mustard&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// get all messages&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; messageComponents &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;[data-message]&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// if at least one message is in the DOM&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;messageComponents&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// loop over each message&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;messageComponents&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; messageButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; message&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;[data-closenotification]&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;// show the close button &lt;/span&gt;&lt;br&gt;            messageButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;// on click hide the message&lt;/span&gt;&lt;br&gt;            messageButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;hidden &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, I added a simple &lt;a href=&quot;http://responsivenews.co.uk/post/18948466399/cutting-the-mustard&quot;&gt;Cut the mustard test&lt;/a&gt; to ensure browsers not knowing about &lt;code&gt;querySelector&lt;/code&gt; won’t execute the JavaScript inside. Next, I used &lt;code&gt;querySelectorAll&lt;/code&gt; to get all messages, followed by a check to ensure at least one message is present on the site. After that, I used a loop to go through every message one by one. Therein the &lt;code&gt;hidden&lt;/code&gt; attribute gets removed to show it to the user. The following &lt;code&gt;eventListener&lt;/code&gt; makes sure to hide the complete message after clicking the close button.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/5.png&quot; alt=&quot;Success message saying &amp;quot;Hello. You are now successfully logged in. Welcome back!&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;There can also be an authentication error, in which case we can also use the same markup as for the success message, but add &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_alertdialog_role&quot;&gt;role=”alertdialog”&lt;/a&gt; and &lt;code&gt;aria-labelledby&lt;/code&gt; to give the dialog an accessible name.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;alertdialog&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-labelledby&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;passwordError&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message message--error&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message__text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;passwordError&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;The provided password doesn&#39;t match!&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message__close&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-closenotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message__closetext&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Close message&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The next case is showing inline validation errors. While we already use native validation, it all happens on the client-side and can therefore easily be altered by a user. So, we should plan for this and handle validation errors if the back-end catches them.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__element has-error&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__label&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        Email&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__required&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;required&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__input&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-describedby&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;errorEmail&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;[^]+@[^]+[.][a-z]{2,63}$&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;autocomplete&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;email&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;alert&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__error&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;errorEmail&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Please use a valid email address.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the server-side I check if there is a validation error and if yes, then show the alert message in the HTML. If you are curious, here is how this &lt;a href=&quot;https://glitch.com/edit/#!/enhance-login-form?path=views/login.pug:1:0&quot;&gt;can be done using Node.js and Pug&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the error message we set &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_alert_role&quot;&gt;role=”alert”&lt;/a&gt;, and on the input we use &lt;code&gt;aria-describedby&lt;/code&gt; with the id of the error message to connect them.&lt;/p&gt;
&lt;p&gt;With this in place, a user will always get notified when an error occurs, no matter what browser they are using or what way they find to change the client-side code.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/enhance-login-form/v4/&quot;&gt;demo showing a simulated validation message from the back-end&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v4/index.html&quot;&gt;source code on Github.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;enhance-client-side-validation&quot;&gt;Enhance client-side validation &lt;a class=&quot;permalink&quot; href=&quot;#enhance-client-side-validation&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So far we have a nice looking form, have ensured that validation is in place on the back-end and front-end and that all is accessible and usable. However, there is always a way to enhance something. So, let’s use some JavaScript to validate inputs immediately after moving on.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// cut the mustard&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; form &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;form&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;checkValidity&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; form &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;classList&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// get all inputs&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; inputs &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;[data-error]&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;inputs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;toggleErrorMessage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;input&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; hasError&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataset&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;empty &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataset&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; oldMessage &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;alert-&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; newMessage&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hasError&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;oldMessage&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    newMessage &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    newMessage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;role&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;alert&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    newMessage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;form__error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    newMessage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;alert-&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    newMessage &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; oldMessage&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;                newMessage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; message&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-describedby&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;alert-&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newMessage&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;has-error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;oldMessage&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;oldMessage&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-describedby&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;has-error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// loop over each input&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;inputs&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;// check validation on blur&lt;/span&gt;&lt;br&gt;            input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;blur&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;checkValidity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;checkValidity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;error&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;aria-invalid&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;false&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token function&quot;&gt;toggleErrorMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;input&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;error&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;aria-invalid&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token function&quot;&gt;toggleErrorMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;input&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s go through this step-by-step.&lt;/p&gt;
&lt;p&gt;First we have a future test to check if all needed features are supported in the browser. Next we get all input elements with the attribute &lt;code&gt;data-error&lt;/code&gt; and add a check to ensure at least one input is present. Next is the &lt;code&gt;toggleErrorMessage&lt;/code&gt; function we will later execute on the blur event.&lt;/p&gt;
&lt;p&gt;In this function, I first check which message we want to show – if the value is empty we show the message defined in &lt;code&gt;data-empty&lt;/code&gt;, else the one defined in &lt;code&gt;data-error&lt;/code&gt;. Next, I added a reference for the oldMessage and newMessage. After that, we check if the form has an error or not by checking the hasError parameter. If there is an error, we first check if there is already an old message added. If it is not we create a new element, otherwise we will use the existing one. If it as a new message, we set &lt;code&gt;role=&amp;quot;alert&amp;quot;&lt;/code&gt;, &lt;code&gt;class=&amp;quot;form__error&amp;quot;&lt;/code&gt; and the id attribute. After that, we set the text for the message element and set &lt;code&gt;aria-describedby&lt;/code&gt; for the input field with the same value or the id of the message.&lt;/p&gt;
&lt;p&gt;If there is no error and a message was added before, we remove the message from the DOM and also remove the &lt;code&gt;aria-describedby&lt;/code&gt; from the input field.&lt;/p&gt;
&lt;p&gt;Next, we loop over all inputs on the form. There we first define an eventListener for the blur event. Therein we first use &lt;code&gt;checkValidity()&lt;/code&gt; to check validation. If no validation error is found, we remove the error class and aria-invalid attribute on the input and call toggleErrorMessage to hide the error message as described above. If there is an error, we set the error class and aria-invalid attribute and show the message.&lt;/p&gt;
&lt;p&gt;![The password field after entered ](&lt;a href=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/7.png&quot;&gt;https://justmarkup.com/log/wp-content/uploads/2018/02/7.png&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;You can read more about &lt;a href=&quot;https://daverupert.com/2017/11/happier-html5-forms/&quot;&gt;happier form validation&lt;/a&gt; from Dave Rupert. I also got the inspiration for my example above from there, so thanks Dave for writing this.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/enhance-login-form/v5/&quot;&gt;demo of the enhanced validation version&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v5/index.html&quot;&gt;source code on Github.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;show%2Fhide-password&quot;&gt;Show/Hide password &lt;a class=&quot;permalink&quot; href=&quot;#show%2Fhide-password&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We enhanced the validation now all the way, while still ensuring that it is still usable for everyone. As the final step of our enhancements we will integrate a pattern to show or hide the entered password.&lt;/p&gt;
&lt;p&gt;First we modify the HTML of our login form and add a &lt;code&gt;&amp;lt;button&amp;gt;&amp;lt;/button&amp;gt;&lt;/code&gt; to switch the password field between &lt;code&gt;type=&amp;quot;password&amp;quot;&lt;/code&gt; and &lt;code&gt;type=&amp;quot;text&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__elment-inner&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-toggle-password-field&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__input&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;minlength&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;8&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-describedby&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;passwordHint&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;autocomplete&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;current-password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-error&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Please use a password with at least 8 characters.&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token attr-name&quot;&gt;data-empty&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Please fill out this field&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;button&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-pressed&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;false&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;form__toggle-password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-toggle-password&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Show password&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the button I set the &lt;code&gt;hidden&lt;/code&gt; attribute to hide it initially and set &lt;code&gt;aria-pressed&lt;/code&gt; to false. As before I also set a data attribute for a reference in JavaScript and a span element containing the text »Show password«.&lt;/p&gt;
&lt;p&gt;Let’s move on to Javascript.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; togglePasswordButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-toggle-password]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;togglePasswordButton&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; togglePasswordButtonText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; togglePasswordButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;span&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; passwordField &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-toggle-password-field]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    togglePasswordButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;    togglePasswordButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; isPressed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-pressed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;isPressed&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            passwordField&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;type&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;password&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-pressed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            togglePasswordButtonText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Show password&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            passwordField&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;type&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;text&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-pressed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            togglePasswordButtonText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Hide password&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we add a reference for our button. If there is a button, we define a variable for the span element with the text and the password input. Next, we show the button by removing the &lt;code&gt;hidden&lt;/code&gt; attribute.&lt;/p&gt;
&lt;p&gt;After that, we define an eventListener for the button triggered on click. There we define a variable called &lt;code&gt;isPressed&lt;/code&gt;, which will either be true or false depending on the &lt;code&gt;aria-pressed&lt;/code&gt; attribute. I used &lt;code&gt;JSON.parse&lt;/code&gt; here as we need a Boolean here, while the &lt;code&gt;aria-pressed&lt;/code&gt; attribute is a String.&lt;/p&gt;
&lt;p&gt;If it is true (meaning the password is visually shown), we set the &lt;code&gt;type&lt;/code&gt; attribute back to password, &lt;code&gt;aria-pressed&lt;/code&gt; to false and change the text to »Show password«. Otherwise, we set the &lt;code&gt;type&lt;/code&gt; attribute to text, &lt;code&gt;aria-pressed&lt;/code&gt; to true and change the text to »Hide password«.&lt;/p&gt;
&lt;p&gt;With that in place, the user now can visually show and hide the password value.&lt;/p&gt;
&lt;p&gt;![The password field with the password ](&lt;a href=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/8.png&quot;&gt;https://justmarkup.com/log/wp-content/uploads/2018/02/8.png&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/enhance-login-form/v6/&quot;&gt;demo of the show/hide password version&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v6/index.html&quot;&gt;source code on Github.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;server-side&quot;&gt;Server-side &lt;a class=&quot;permalink&quot; href=&quot;#server-side&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Until now we mostly covered the client-side. You should always remember that a user can change everything on the client-side. So, while we have client-side validation it doesn’t mean that it will prevent a user from sending invalid data. That’s why you should add the same validation we added on the client-side also on the server-side. You can find a working &lt;a href=&quot;https://glitch.com/edit/#!/enhance-login-form&quot;&gt;demo with the server-side part&lt;/a&gt; on Glitch.&lt;/p&gt;
&lt;h2 id=&quot;the-final-login-form&quot;&gt;The final login form &lt;a class=&quot;permalink&quot; href=&quot;#the-final-login-form&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/6.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;As you can see there are many ways to enhance a login form, making it more accessible and more convenient to use. While I covered many things here, this is not the »best login form ever«. There are always ways to improve it and make things differently. You should however, always think about potential errors, keep it accessible, be prepared for unexpected problems and never trust client-side only.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://enhance-login-form.glitch.me/login&quot;&gt;demo of the final version&lt;/a&gt; and you can find the &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/enhance-login-form/v6/index.html&quot;&gt;source code including the client-side Github&lt;/a&gt; and &lt;a href=&quot;https://glitch.com/edit/#!/enhance-login-form&quot;&gt;all code including the server-side on Glitch&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://caniuse.com/#feat=form-validation&quot;&gt;Browser support for native form validation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.paciellogroup.com/blog/2014/12/using-aria-describedby-to-provide-helpful-form-hints/&quot;&gt;Using aria-describedby to provide helpful form hints&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://justmarkup.com/log/2015/02/input-type-email-better-dont-use-it/&quot;&gt;Input type email and internationalization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://hiddedevries.nl/en/blog/2018-01-13-making-password-managers-play-ball-with-your-login-form&quot;&gt;Making password managers play ball with your login form&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.smashingmagazine.com/2017/06/designing-efficient-web-forms/&quot;&gt;Designing efficient web forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://thestyleofelements.org/the-art-of-the-error-message-9f878d0bff80&quot;&gt;The art of the error message&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://daverupert.com/2017/11/happier-html5-forms/&quot;&gt;Happier HTML5 Form Validation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> PWA on desktop</title>
							<link>https://justmarkup.com/log/2018/02/pwa-on-desktop/</link>
							<pubDate>2018-02-05T06:54:49+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/02/pwa-on-desktop/</guid>
							<description>&lt;p&gt;Last week I twittered a poll asking which browser will be the first to bring full support for Progressive Web Apps (PWA) to desktop. Here are the results:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Wonder which browser will be the first* to bring full support for PWA to desktop.&lt;/p&gt;
&lt;p&gt;*Yes, Samsung Internet for DeX already does, but would say it is not traditional desktop.&lt;/p&gt;
&lt;p&gt;— Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/958628132663300097?ref_src=twsrc%5Etfw&quot;&gt;31. Januar 2018&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;54% think Chrome will be the first, 27% see Firefox as the leader, 18% bet on Edge and only 1% think Safari will be the first one to ship.&lt;/p&gt;
&lt;p&gt;Personally, I think that either Edge or Chrome will be the first to ship this spring and that Firefox will probably follow later the year. I am not sure about Safari, I was already surprised that they shipped &lt;a href=&quot;https://medium.com/@firt/pwas-are-coming-to-ios-11-3-cupertino-we-have-a-problem-2ff49fd7d6ea&quot;&gt;Service Worker and other PWA features&lt;/a&gt; some time ago, so maybe we will see PWA support on desktop soon too.&lt;/p&gt;
&lt;p&gt;The term PWA is a marketing term for me. When a browser says it fully supports PWA, what does this even mean? Does it mean that a prompt is showing to install a site, does it mean that technical features like Service Worker (including BackgroundSync, Push Notification…) are fully supported, does it mean that the Web App Manifest is fully supported, does it mean that the site will work offline or all of it?&lt;/p&gt;
&lt;p&gt;As various people asked what I mean by full support, I would like to use this post to share what full support means for me and how I would like to experience PWA on desktop.&lt;/p&gt;
&lt;h2 id=&quot;installable&quot;&gt;Installable &lt;a class=&quot;permalink&quot; href=&quot;#installable&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To turn a website into a PWA it has to be installable. This can mean many things. Firstly, the browser should offer a menu item to install a website to the desktop. In addition to this the browser should offer some sort of prompting or ambient badging. On desktop I think ambient badging may work best. Browsers could show a PWA icon in the URL bar if the website meets all the requirements. A prompt can get annoying pretty soon (It already annoys me on Android sometimes), but I also think that browsers are still trying to find the best way when to show a prompt and when not, so maybe this can also work.&lt;/p&gt;
&lt;h3 id=&quot;app-stores-and-marketplaces&quot;&gt;App Stores and Marketplaces &lt;a class=&quot;permalink&quot; href=&quot;#app-stores-and-marketplaces&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I hear many people saying that there is no need for App Stores, because a PWA lives on the web and can be installed directly from there. While this is certainly true, I personally think that PWA should show up in the App Stores of the systems in addition to showing up in extra PWA app stores. I know a lot of websites, who used PhoneGap or Cordova to transform their existing site to an App, for the only reason to show up in the App Store. If it would be possible to index a PWA in the store, they wouldn’t need to do this and would have more/time to improve their acctual site. I am, however, not for automatic indexing – I think every website should choose on their one if they want to be listed in a store or not.&lt;/p&gt;
&lt;p&gt;There is one open question with the default App Stores though. If I want to list my PWA there what browser engine will it use, will it use Webkit on MacOs and EdgeHTML on Windows or can the user choose, or will it be the engine of the default browser the user set?&lt;/p&gt;
&lt;p&gt;I also wonder what the requirements will be, so a site can be listed in a Store. Does it have to work offline? Does it need a Ligthouse Score of &amp;gt; 80?&lt;/p&gt;
&lt;h2 id=&quot;integrated-in-the-system&quot;&gt;Integrated in the system &lt;a class=&quot;permalink&quot; href=&quot;#integrated-in-the-system&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once an PWA is installed it should be easily findable on the system. Like a native app, it could have an icon on the desktop and should be findable via Search and Explorer. There should be no difference from a Electron App for example. The icon should be on its own and not with a small browser logo attached to it. It should also respect the display property defined in the Manifest. If the value is standalone it should open as a standalone window, while if the value is browser it should open a new browser window with the URL bar and all other browser UI visible.&lt;/p&gt;
&lt;h2 id=&quot;current-state&quot;&gt;Current state &lt;a class=&quot;permalink&quot; href=&quot;#current-state&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As of today (05.02.2018), Chrome has experimental support for PWA on desktop (Linux, Windows, Mac and Chrome OS).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/Screenshot_111.png&quot; alt=&quot;pokedx.org running as a standalone PWA on desktop&quot;&gt;&lt;/p&gt;
&lt;p&gt;You can enable it by visiting &lt;a href=&quot;chrome://flags/#enable-desktop-pwas&quot;&gt;chrome://flags/#enable-desktop-pwas&lt;/a&gt; and enabling it there. After a restart you will see “Add to desktop…” in the menu. After clicking there, the app will be added to the desktop and will be discoverable like a native App. There is no prompt or ambient badging at the moment, so not sure if it will be added once this makes this into stable.&lt;/p&gt;
&lt;p&gt;The icon on the desktop already looks like a native app icon though and doesn’t have a reference that it was added via Chrome.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/Screenshot_asdhas.png&quot; alt=&quot;justmarkup icon on windows desktop&quot;&gt;&lt;/p&gt;
&lt;p&gt;If the site has a display value of “desktop” defined in the Manifest it does open a new browser window, but there is one empty tab and one with the actual site. As it is all experimental I am sure they will fix this though.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/02/Screenshot_11.png&quot; alt=&quot;justmarkup opened vom desktop showing the normal chrome ui&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I think PWA could replace many Electron Apps in the future, the same as many Cordova/PhoneGap Apps are currently replaced by Progressive Web Apps, as they are often only used as a wrapper. I also think that PWA will make it into App Stores, whereas Edge and Microsoft will probably be the first one to do so.&lt;/p&gt;
&lt;p&gt;That all said, PWA are certainly not always the best option. There will always be the need for native apps. PWA’s will find their place on the desktop, but there are still a lot of open questions browsers need to think of to make this a great experience for users.&lt;/p&gt;
&lt;p&gt;Update from 06.02.2018: Microsoft just &lt;a href=&quot;https://blogs.windows.com/msedgedev/2018/02/06/welcoming-progressive-web-apps-edge-windows-10/&quot;&gt;announced their plan to bring PWA to Microsoft Edge and Windows 10&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Quick fix</title>
							<link>https://justmarkup.com/log/2018/01/quick-fix/</link>
							<pubDate>2018-01-22T05:47:34+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2018/01/quick-fix/</guid>
							<description>&lt;p&gt;When viewing code you will most likely come around a note along the lines of &lt;code&gt;// Quick fix. Todo: Cleanup later&lt;/code&gt; at some point. There are many reasons developers went for a quick fix instead of a proper fix.&lt;/p&gt;
&lt;p&gt;A critical bug was detected after a new release which needs to be fixed immediately, and there is no option to revert to an older version. Or a feature needs to be released tomorrow and you found a bug last minute and there is simple no way to postpone the feature and not enough time to do a proper fix.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2018/01/quick-fix.jpg&quot; alt=&quot;A comic showing two persons talking about quick fix. First image: First person says &amp;quot;Can you just do a quick fix? It&#39;s really urgent...&amp;quot;, second person responds with &amp;quot;Yeah... well... there are two options...&amp;quot;. Next image: Person two continues saying &amp;quot;I can do a quick fix right now, but it won&#39;t handle all cases and someone will have to redo it and fix it properly at some point. It&#39;ll be difficult to debug and in the end it&#39;ll take twice as long. Next image: person two continues saying &amp;quot;Or we can do things by the book, and write a real fix. But it won&#39;t be ready before tomorrow because there are a few dependencies to handle. But when it&#39;s done it&#39;ll be clean, good code. Fourth image: person one says &amp;quot;Let&#39;s go for the quick fix option. Quick fixes are good&amp;quot;. Second person says &amp;quot;Of course, what was I thinking...&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Web comic by CommitStrip. &lt;a href=&quot;http://www.commitstrip.com/en/2016/04/13/quick-fix/&quot;&gt;Original comic can be found here&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;avoiding-quick-fixes&quot;&gt;Avoiding quick fixes &lt;a class=&quot;permalink&quot; href=&quot;#avoiding-quick-fixes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are many ways to avoid quick fixes at the first place. As I mostly do Front-end development I will focus on CSS, HTML and JavaScript here.&lt;/p&gt;
&lt;h3 id=&quot;html&quot;&gt;HTML &lt;a class=&quot;permalink&quot; href=&quot;#html&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Browsers try everything to fix HTML errors, but it is of course still possible to mess it up. You could forget to close an HTML element, or you could use wrong attributes or you could use a different closing tag as intended. The first thing you can do is &lt;a href=&quot;https://html5.validator.nu/&quot;&gt;validating your HTML&lt;/a&gt;. While the validator does give you good idea what is wrong and should be fixed it can’t handle everything.&lt;/p&gt;
&lt;p&gt;Some HTML problems may only appear after interacting with the site, so manual testing is still required for checking HTML errors.&lt;/p&gt;
&lt;h3 id=&quot;css&quot;&gt;CSS &lt;a class=&quot;permalink&quot; href=&quot;#css&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;All CSS features have different browser support, there are still features which require a Prefix in certain browsers and there are also features which need a different syntax in different browsers. On top of that browsers will handle certain CSS differently. There are different ways to handle this:&lt;/p&gt;
&lt;p&gt;First, we can make use of the fact that browsers will ignore CSS properties and values they are not aware of.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;hsl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All browsers not aware of hsl() will use the value red here for color, while all other will use the hsl() value.&lt;/p&gt;
&lt;p&gt;To handle Prefixes we can use &lt;a href=&quot;https://github.com/postcss/autoprefixer&quot;&gt;autoprefixer&lt;/a&gt; in our build process so we don’t have to write all the Prefixes by ourselves.&lt;/p&gt;
&lt;p&gt;Next, we can use &lt;a href=&quot;https://hacks.mozilla.org/2016/08/using-feature-queries-in-css/&quot;&gt;feature queries&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    // code that will run in every browsers&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; define the fallback for CSS Grid here&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@supports&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; grid&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    // code that will only run if CSS Grid is supported by the browser &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This way we can use new CSS features for supported browsers and still ensure that older browsers look okay, by providing the fallback before defining the new CSS inside @supports.&lt;/p&gt;
&lt;p&gt;Finally, we should use &lt;code&gt;min-width/max-width&lt;/code&gt; instead of an explicit &lt;code&gt;width&lt;/code&gt; to ensure it doesn’t break for long words or content. We should also build mobile first so in the worst case a user will see the mobile styling.&lt;/p&gt;
&lt;p&gt;Automatic testing of CSS is possible, but in my opinion not practical. There are some tools to compare screenshots before/after a deploy, but there are hundreds of browsers out there used on thousands of different devices with lots of different screen sizes. The web is not print, we cannot exactly say how a website will look in any browser, but we can use feature detection and robust CSS to ensure that the site doesn’t look broken in a browser.&lt;/p&gt;
&lt;p&gt;So, for CSS, manual testing is still the way to go. You should test early and in various browsers on various screen sizes. If you already have statistics you could check there the top 10 browsers and screen sizes and ensure that your tests at least cover these.&lt;/p&gt;
&lt;h3 id=&quot;javascript&quot;&gt;JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#javascript&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Same time ago a client reported a bug, which made some parts of the site unusable for them. They were using Safari on an iPhone 6 in this case. I first tried to reproduce the error in an emulator, next on an iPhone 5 with the same Safari version, but it worked fine for me in both cases. Eventually I met the client and tested directly on their device. There I could finally reproduce it, but still had no idea why this would only fail on this device on not on another one using the same browser. To make a long story short, they were using Safari in incognito mode and our &lt;code&gt;localStorage&lt;/code&gt; detection failed in this case.&lt;/p&gt;
&lt;p&gt;So before using &lt;code&gt;localStorage&lt;/code&gt;, we used this check:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;localStorage&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// localStorage is supported, run the code&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At first this looks like it will work. The problem is that by using the incognito mode in Safari, ‘localStorage’ was available, but once you use &lt;code&gt;localStorage.setItem()&lt;/code&gt; it will throw an ecxeption because of security reasons.&lt;/p&gt;
&lt;p&gt;After changing our feature detection to:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;isLocalStorageSupported&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; mod &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;test&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mod&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; mod&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mod&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it worked fine again. You can find more details about this in the &lt;a href=&quot;https://github.com/Modernizr/Modernizr/blob/5eea7e2a213edc9e83a47b6414d0250468d83471/feature-detects/storage/localstorage.js&quot;&gt;Modernizr feature detection script&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, before using a JavaScript feature you should always add a check to ensure the browser actually knows how to handle it. I don’t use Modernizr, but I often check the code for feature detects there. Often there are browser bugs or other issues and the Modernizr detect mostly handles these correctly to ensure the check will only be successful if the browser really supports the feature.&lt;/p&gt;
&lt;p&gt;Furthermore, you should write robust JavaScript. Mat​hia⁠s S​chäf⁠er wrote a fantastic &lt;a href=&quot;https://molily.de/robust-javascript/&quot;&gt;developer guide about robust Client-Side JavaScript&lt;/a&gt;, where he writes about Progressive enhancement, How JavaScript might fail and How to prevent failure. You should read it and came back later to continue reading here.&lt;/p&gt;
&lt;h3 id=&quot;automatic-testing&quot;&gt;Automatic testing &lt;a class=&quot;permalink&quot; href=&quot;#automatic-testing&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are various solutions available to automatically test code. There are test libraries for &lt;a href=&quot;https://www.24a11y.com/2017/writing-automated-tests-accessibility/&quot;&gt;Accessibility&lt;/a&gt; , &lt;a href=&quot;https://medium.com/powtoon-engineering/a-complete-guide-to-testing-javascript-in-2017-a217b4cd5a2a&quot;&gt;JavaScript&lt;/a&gt; and many more.&lt;/p&gt;
&lt;p&gt;I won’t go in to details here, but you should always add tests to find errors before a user will find them. Personally, I don’t do enough testing at the moment, but it is on top of my priority list to change it this year and get better at it.&lt;/p&gt;
&lt;p&gt;It should be noted that even the best automatic testing solution will not catch all errors, so be sure to always test manually in as many browsers and on as many devices as possible.&lt;/p&gt;
&lt;h2 id=&quot;refactoring-quick-fixes&quot;&gt;Refactoring quick fixes &lt;a class=&quot;permalink&quot; href=&quot;#refactoring-quick-fixes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Tests help to prevent a lot of potential bugs, but even with the best test setup and lots of manual testing it is still possible that bugs make it into production. Bugs occurring in production happens to everyone.&lt;/p&gt;
&lt;p&gt;I remember some years ago, Google shipped the landing page for the Chrome browser with a JavaScript error, which made the &lt;a href=&quot;https://thenextweb.com/google/2013/02/04/weird-right-now-no-one-can-download-and-install-google-chrome-from-the-official-site/&quot;&gt;download button unusable for all users&lt;/a&gt;. When something like this happens you don’t want to waste time and get a fix out as soon as possible.&lt;/p&gt;
&lt;p&gt;Once the fix is done, the first thing you should do is open a new issue/ticket to refactor it and find the real issue behind it. This ticket has to get the highest priority and you should start working on it immediately the next day even if you have other things planned.&lt;br&gt;
Some project manager might not see the value of doing a proper fix at first – “It works now, why should we invest more time in it…”. After explaing to them that a quick fix will sooner or later result in more bugs, which will cost a lot of time and money, they mostly understand and will give you time to do the proper fix now.&lt;/p&gt;
&lt;p&gt;Writing a comment that it should be properly refactored is not enough. Go search your current project for »Quick fix« or »Fix later« and you will probably find some and will also notice that some of these comments were added a long time ago and that there is no open issue about it.&lt;/p&gt;
&lt;p&gt;A quick fix has to be done sometimes, but you should always react immediately after the fix is out and do a proper rewrite. You should also find the real issue why the problem occured and add a new test so this won’t happen again. And you should always use future-friendly and robust HTML, CSS and JavaScript.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Keeping track</title>
							<link>https://justmarkup.com/log/2017/12/keeping-track/</link>
							<pubDate>2017-12-12T07:03:45+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/12/keeping-track/</guid>
							<description>&lt;p&gt;I wrote about how I keep track of my working time for &lt;a href=&quot;https://twitter.com/humanthemachine&quot;&gt;@humanthemachine&lt;/a&gt;. You can read the &lt;a href=&quot;https://superyesmore.com/keeping-track-71baaad4d52bfbf17ecd9fd5e0c8d271&quot;&gt;full article on superyesmore.com&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Writing for the web</title>
							<link>https://justmarkup.com/log/2017/11/writing-for-the-web/</link>
							<pubDate>2017-11-16T06:34:53+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/11/writing-for-the-web/</guid>
							<description>&lt;p&gt;&lt;strong&gt;tl;dr: Don’t share bad practise. Be responsible. Be nice. Thanks.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Some time ago I sent a tweet which got quite a lot of interactions:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you publish articles/demos/experiments, please make them accessible.&lt;/p&gt;
&lt;p&gt;– Use &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; -&amp;gt; add alt text&lt;br&gt;
– Use &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; -&amp;gt; use associated label&lt;br&gt;
– Use &lt;code&gt;&amp;lt;span class=&amp;quot;.btn&amp;quot;&amp;gt;&lt;/code&gt; – use &lt;code&gt;&amp;lt;button&amp;gt; &lt;/code&gt;&lt;br&gt;
…&lt;/p&gt;
&lt;p&gt;Many will use/copy these. Don&#39;t share bad practise. Be responsible. Be nice. Thanks.&lt;/p&gt;
&lt;p&gt;— Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/925671964085227520?ref_src=twsrc%5Etfw&quot;&gt;1. November 2017&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I read a lot of articles related to web development (HTML, CSS, JavaScript), which I discover via twitter, RSS or one of the many newsletters I am subscribed to; I enjoy reading them and I learn a lot from them.&lt;/p&gt;
&lt;p&gt;Many of these articles include code examples and this is the point where I get sad sometimes. I am sad because these examples use bad practice: Inaccessible patterns, non-semantic HTML, –prefix-only CSS or JavaScript without feature tests.&lt;/p&gt;
&lt;h2 id=&quot;responsibility&quot;&gt;Responsibility &lt;a class=&quot;permalink&quot; href=&quot;#responsibility&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When publishing articles for the web we have a responsibility. Many developers will read them, many will copy the examples and many will use the code you shared. If the example demonstrates bad practise, people will adopt them, people will think it is okay to use an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; without an &lt;code&gt;alt&lt;/code&gt; attribute.&lt;/p&gt;
&lt;p&gt;Sometimes, there is a note before or after the example:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Normally, we wouldn’t do this, but to keep it simple for this demo…&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is even worse; Knowing that you are sharing bad practice, but still sharing it instead of showing how it can be done better.&lt;/p&gt;
&lt;p&gt;Nobody knows everything, that’s good. But, if you know how to do something correctly, why not share this instead of a bad example which may be shorter or simpler.&lt;/p&gt;
&lt;p&gt;Be responsible when you share content.&lt;/p&gt;
&lt;h2 id=&quot;awareness&quot;&gt;Awareness &lt;a class=&quot;permalink&quot; href=&quot;#awareness&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Quite often when I see an inaccessible code example or any other bad practice I am aware of, I try to reach out to the author. I know many other developers doing the same and this is really useful. Useful for the author who isn’t aware the issue and learned something new and useful for all readers reading the corrected example because they won’t copy bad practise.&lt;/p&gt;
&lt;h2 id=&quot;proofreading&quot;&gt;Proofreading &lt;a class=&quot;permalink&quot; href=&quot;#proofreading&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When writing about new APIs or Code I am unfamiliar with I often try to reach out to other developers and ask them if they can proofread an article. This often helped me sharing bad practise because they told me how to do something better. And often they also will learn something new when reading your article. Again, nobody knows everything.&lt;/p&gt;
&lt;p&gt;It is often hard to find someone to proofread, so I thought about setting up a slack channel or something for proofreading. If you think this would be helpful for you too, please let me &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;know&lt;/a&gt; and we will try to figure it out.&lt;/p&gt;
&lt;h2 id=&quot;catch-insensitive%2C-inconsiderate-writing&quot;&gt;Catch insensitive, inconsiderate writing &lt;a class=&quot;permalink&quot; href=&quot;#catch-insensitive%2C-inconsiderate-writing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most people will run grammar checks on their content before publishing, but there can be other issues with text, most tools don’t catch: insensitive, inconsiderate writing. When I write, I mostly use my code editor (VS code at the moment) and write in markdown.&lt;/p&gt;
&lt;p&gt;Before publishing an article, I run the text through &lt;a href=&quot;http://alexjs.com/&quot;&gt;Alex&lt;/a&gt; to find insensitive or inconsiderate phrasing. You can try it on their &lt;a href=&quot;http://alexjs.com/&quot;&gt;website&lt;/a&gt; and it is also available on the command line or via one of the available integration.&lt;/p&gt;
&lt;h2 id=&quot;clear-and-concise&quot;&gt;Clear and concise &lt;a class=&quot;permalink&quot; href=&quot;#clear-and-concise&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We shouldn’t try to be clever and use long sentences full of uncommon phrases. There is no need to impress people with your language skills. Writing clear and concise sentences will help many people. You can use a free &lt;a href=&quot;https://www.webpagefx.com/tools/read-able/&quot;&gt;tool to check the readability of your text&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You should also avoid [words](&lt;a href=&quot;http://blog.stoyanstefanov.com/technical-writing-checklist/&quot;&gt;http://blog.stoyanstefanov.com/technical-writing-checklist/&lt;/a&gt; rel=) like &lt;a href=&quot;http://bradfrost.com/blog/post/just/&quot;&gt;just&lt;/a&gt; and easy when describing technical details. It may be easy for you, but this doesn’t mean it is also easy for everyone else.&lt;/p&gt;
&lt;h2 id=&quot;text-alternatives-for-images&quot;&gt;Text alternatives for images &lt;a class=&quot;permalink&quot; href=&quot;#text-alternatives-for-images&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When using images you should always use &lt;a href=&quot;https://www.w3.org/WAI/tutorials/images/&quot;&gt;meaningful&lt;/a&gt; text alternatives. You should also avoid images of text, as this makes the text uncopyable and untranslatable. Furthermore, it decreases the performance and you have to put effort in it to make these images accessible. There are cases where it is fine to include an image with text, for example a screenshot of a website (with an additional link to the pictured site).&lt;/p&gt;
&lt;p&gt;If you can write it down or already have – why use an image of the same text.&lt;/p&gt;
&lt;p&gt;This is a good example where one can clearly see that using an accessible version (text) instead of an inaccessible (text in images) is better for all. It is not only great for accessibility, but also improves user experience, SEO (Search Engine Optimization) and performance.&lt;/p&gt;
&lt;h2 id=&quot;vanilla-code&quot;&gt;Vanilla code &lt;a class=&quot;permalink&quot; href=&quot;#vanilla-code&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When using code examples, use vanilla code. I often see examples where they use Sass for CSS or jQuery for JavaScript code. If you write about a jQuery specific issue you should of course use jQuery, but when writing about JavaScript not so. You can always add an additional example using your preferred framework/plugin/tool, but we should not assume everyone else also prefers your choice. By providing vanilla code everyone can use them and adapt them to their needs.&lt;/p&gt;
&lt;h2 id=&quot;assumptions&quot;&gt;Assumptions &lt;a class=&quot;permalink&quot; href=&quot;#assumptions&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Another issue I often see is authors assuming the reader already knows about X. When using new features not directly related to the article it is always a good idea to link to other articles explaining the feature. This way readers unfamiliar with the feature can read about it before and won’t get stuck when seeing new, unexplained code.&lt;/p&gt;
&lt;h2 id=&quot;browser-support&quot;&gt;Browser support &lt;a class=&quot;permalink&quot; href=&quot;#browser-support&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Web features have different browser support and it should be mentioned in the article. I use &lt;a href=&quot;https://caniuse.com/&quot;&gt;Can I use&lt;/a&gt; to get browser support information and add the info to my articles. There are also various plugins/tools to &lt;a href=&quot;https://caniuse.bitsofco.de/&quot;&gt;embed&lt;/a&gt; the data from Can I use directly in the article, so the information stays up-to-date.&lt;/p&gt;
&lt;h2 id=&quot;outdated-information&quot;&gt;Outdated information &lt;a class=&quot;permalink&quot; href=&quot;#outdated-information&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The specification and implementation of new web features can change over time. The first thing you should do is to show the publish date of an article good visible on the site. It is also a good idea to indicate at the beginning of an article that it may be outdated. For example, I add the following info/warning for technical articles older than one year on my site:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This article has been updated the last time on January 3, 2016 and the given information may be not accurate anymore. Feel free to contact me on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;twitter&lt;/a&gt; to get more details.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;low-contrast&quot;&gt;Low contrast &lt;a class=&quot;permalink&quot; href=&quot;#low-contrast&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There was a trend to use very light, small and grey text on white background – I never understood it, but many people use this for their article pages. My eye-sight is very good, but even for me it is really hard to read many of these pages. Please always use a good &lt;a href=&quot;http://leaverou.github.io/contrast-ratio/&quot;&gt;Contrast ratio&lt;/a&gt; for all elements on your site.&lt;/p&gt;
&lt;h2 id=&quot;tools%2C-guides-and-tips&quot;&gt;Tools, Guides and Tips &lt;a class=&quot;permalink&quot; href=&quot;#tools%2C-guides-and-tips&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://alexjs.com/&quot;&gt;Alex – Catch insensitive, inconsiderate writing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.grammarly.com/&quot;&gt;Grammarly – spell checker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.online-utility.org/english/readability_test_and_improve.jsp&quot;&gt;Test Document Readability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.deque.com/products/axe/&quot;&gt;aXe – free, open-source accessibility testing tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://leaverou.github.io/contrast-ratio/&quot;&gt;Contrast ratio check&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://s.codepen.io/sdras/debug/4437473c764a1d553691005a0f40a145&quot;&gt;Dynamically Generated Alt Text using Azure’s Computer Vision API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-supplements.html&quot;&gt;Reading Level&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/WAI/tutorials/images/&quot;&gt;W3C Web Accessibility Initiative tutorial for images&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://axesslab.com/alt-texts&quot;&gt;A guide for alternative text for images&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Sharing good practice with accessibility in mind on a page (which itself is accessible) may take more time than sharing »simple« inaccessible demos, but it is really worth the effort. The same goes with the content of the article itself, by using clear and concise sentences many more people can read them.&lt;/p&gt;
&lt;p&gt;Nobody is perfect and no website, article or example will ever be perfect, but you should really avoid publishing bad practice. Be responsible.&lt;/p&gt;
&lt;p&gt;I also encourage everybody to write and publish articles. I recently had a problem, googled it and found an old article of mine where I described how to solve it. Back then I also had the problem, did research and wrote about my findings. Now, years later I was able to use this and solve the problem again.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Network based image loading using the Network Information API in Service Worker</title>
							<link>https://justmarkup.com/log/2017/11/network-based-image-loading/</link>
							<pubDate>2017-11-02T10:15:30+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/11/network-based-image-loading/</guid>
							<description>&lt;p&gt;&lt;a href=&quot;https://developers.google.com/web/updates/2017/10/nic62#network-info&quot;&gt;Recently&lt;/a&gt;, Chromium improved their implementation of &lt;code&gt;navigator.connection&lt;/code&gt; by adding three new attributes: &lt;code&gt;effectiveType&lt;/code&gt;, &lt;code&gt;downlink&lt;/code&gt; and &lt;code&gt;rtt&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Before that, the available attributes were &lt;code&gt;downLinkMax&lt;/code&gt; and &lt;code&gt;type&lt;/code&gt;. With these two attributes you couldn’t really tell if the connection was fast or slow. The &lt;code&gt;navigator.connection.type&lt;/code&gt; may tell us a user is using WiFi, but this doesn’t say anything about the real connection speed, as they may be using a hot spot and the connection is in fact 2G.&lt;/p&gt;
&lt;p&gt;With the addition of &lt;a href=&quot;http://wicg.github.io/netinfo/#dfn-effective-connection-type&quot;&gt;effectiveType&lt;/a&gt; we are finally able to get the real connection type. There are four different types (slow-2g, 2g, 3g and 4g) and they are described this way by the &lt;a href=&quot;https://wicg.io/&quot;&gt;Web Incubator Community Group&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;slow-2g: The network is suited for small transfers only such as text-only pages.&lt;br&gt;
2g: The network is suited for transfers of small images.&lt;br&gt;
3g: The network is suited for transfers of large assets such as high resolution images, audio, and SD video.&lt;br&gt;
4g: The network is suited for HD video, real-time video, etc.&lt;/p&gt;
&lt;p&gt;Let’s see how we can improve user experience by delivering images based on available connection speed.&lt;/p&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo &lt;a class=&quot;permalink&quot; href=&quot;#demo&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this demo we will use the Network Information API in our Service Worker to handle image requests based on connection.&lt;/p&gt;
&lt;p&gt;First, we register the Service Worker in our HTML file:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;sw.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        scope&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;./&#39;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, let’s have a look at our Service Worker file (sw.js) we registered.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; connectionEffectiveType &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;connection&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;fetch&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// check if the request is an image&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\.jpg$|.png$|.webp$&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// check if navigator.connection is supported&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigatorConnectionSupported&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; connectionEffectiveType &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;connection&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;effectiveType&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;// check if effectiveType is supported&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;connectionEffectiveType&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; req &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;clone&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; imageResolution &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;connectionEffectiveType&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;slow-2g&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;2g&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                        imageResolution &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;_low&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;4g&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                        imageResolution &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;_high&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                        &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br&gt;                        imageResolution &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;                &lt;span class=&quot;token comment&quot;&gt;// Build the image we want to return based on connection&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; returnUrl &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; imageResolution &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;.&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;                event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;respondWith&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;returnUrl&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;                        mode&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;no-cors&#39;&lt;/span&gt;&lt;br&gt;                    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s go through the code step-by-step.&lt;/p&gt;
&lt;p&gt;First we define a feature test for Network Information API. Next, we define an EventListener for the FetchEvent. Therein the first check ensures we only intercept requests for images (every file ending with .jpg, .png or .webp). Next we have check if the Network Information API is supported and another test to check if also the &lt;code&gt;effectiveType&lt;/code&gt; attribute is defined.&lt;/p&gt;
&lt;p&gt;If both checks are successful we use a switch statement to decide when to use which image. In this case, we want to show low-resolution images for slow-2g and 2g connections, the default one for 3g and the high-resolution for 4g connections. At the end we build our new image url and respond with it instead of the original request. In our case this means if the connection is 4g and the file name is image.jpg we will instead request our high-resolution image that is available as image_high.jpg, for 2g on the other hand we deliver the low-resolution image which we have saved as image_low.jpg.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/11/nia.png&quot; alt=&quot;Screenshot of the demo in Chrome, showing the high-resolution image and that the user is using 4g&quot;&gt;&lt;/p&gt;
&lt;p&gt;You can find the code on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/network-based-img-loading&quot;&gt;Github&lt;/a&gt; and a Demo is also available on &lt;a href=&quot;http://justmarkup.github.io/demos/network-based-img-loading/&quot;&gt;Github pages&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We could enhance this even further, for example adding a download link for the high-resolution image underneath each image and only loading a tiny placeholder image for slow-2g. This way the images won’t be loaded on very slow connections and thus save a lot of data, but users would still be able to see/download the image if they want to.&lt;/p&gt;
&lt;p&gt;Note: You may have noticed that you always get the default image when opening the demo for the first time. This is because on first visit the Service Worker is not yet registered and we can’t intercept the fetch request. The enhancement happens once the Service Worker is installed. At this point we can intercept the image requests and deliver the appropriate image.&lt;/p&gt;
&lt;h2 id=&quot;devtools&quot;&gt;Devtools &lt;a class=&quot;permalink&quot; href=&quot;#devtools&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While testing &lt;code&gt;navigator.connection.effectiveType&lt;/code&gt;, I thought I could use the network throttle option in Chrome to imitate other connection types, but even when I used “Slow 3G”, &lt;code&gt;navigator.connection.effectiveType&lt;/code&gt; still told me I am on 4g. After searching on &lt;a href=&quot;https://crbug.com/&quot;&gt;crbug.com&lt;/a&gt;, I found the following &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=758464&quot;&gt;issue&lt;/a&gt;. I hope this will be fixed soon, so we can test this via the network throttle tool.&lt;/p&gt;
&lt;h2 id=&quot;the-savedata-attribute&quot;&gt;The saveData attribute &lt;a class=&quot;permalink&quot; href=&quot;#the-savedata-attribute&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There is one more attribute defined in the &lt;a href=&quot;http://wicg.github.io/netinfo&quot;&gt;Network Information API&lt;/a&gt;, which is &lt;code&gt;saveData&lt;/code&gt;. If defined, it returns true when the user has requested a reduced data usage mode and otherwise false.&lt;/p&gt;
&lt;p&gt;This isn’t available in any browser at the moment (November 2017), but may be available soon in &lt;a href=&quot;https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/IrIwAdMWhAE&quot;&gt;Chromium&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once available we can extend our code and not only check for &lt;code&gt;effectiveType&lt;/code&gt;, but also check for &lt;code&gt;saveData&lt;/code&gt; and only return high-resolution images if the connection is 4g and the user hasn’t requested a reduced data usage.&lt;/p&gt;
&lt;h2 id=&quot;browser-support&quot;&gt;Browser support &lt;a class=&quot;permalink&quot; href=&quot;#browser-support&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/de/docs/Web/API/Navigator/connection#Browser_compatibility&quot;&gt;Browser support&lt;/a&gt; for &lt;code&gt;navigator.connection&lt;/code&gt; is pretty bad as of now (November 2017). But, by using the API as shown in the examples above, no user will get a worse experience; On the other hand, some users using a supported browser on slow connections will benefit.&lt;/p&gt;
&lt;p&gt;I hope that more browsers will support the Network Information API in the future. In combination with Service Worker this is a great way to enhance user experiences and decrease load times for users on slow connections.&lt;/p&gt;
&lt;h2 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Network Information API and especially &lt;code&gt;effectiveType&lt;/code&gt; is great to deliver content based on network connection.&lt;/p&gt;
&lt;p&gt;Although the API isn’t widely supported at the moment we can still use it to improve the loading experience for some users; Progressive enhancement is never a bad thing.&lt;/p&gt;
&lt;p&gt;In the example above we handle image requests, but we can also use this for video, audio or other heavy assets. Looking forward to seeing more examples using the Network Information API. If you build something with it, please share it with me via &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;twitter&lt;/a&gt; or &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;email&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 4.11.2017:&lt;/strong&gt; Moved future test for the Network Information API outside the fetch handler as suggested by &lt;a href=&quot;https://twitter.com/tomayac&quot;&gt;Thomas Steiner&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> My approach on using id, class and data attributes in HTML, CSS and JavaScript</title>
							<link>https://justmarkup.com/log/2017/07/my-approach-on-using-id-class-and-data-attributes-in-html-css-and-javascript/</link>
							<pubDate>2017-07-05T05:48:40+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/07/my-approach-on-using-id-class-and-data-attributes-in-html-css-and-javascript/</guid>
							<description>&lt;p&gt;Have you ever changed a class name in HTML and some time later got a bug report that a JavaScript functionality was not working anymore? I did and the issue was that the className was not only used as an attribute in HTML and as a selector in CSS, but has also been used by another developer in JavaScript. Over the years, working as a Frontend Developer I realized how important it is when and how to use &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;class&lt;/code&gt; and &lt;code&gt;data&lt;/code&gt; attributes in HTML, CSS and JavaScript.&lt;/p&gt;
&lt;p&gt;So, I thought I share my current practise of using them.&lt;/p&gt;
&lt;h2 id=&quot;id&quot;&gt;id &lt;a class=&quot;permalink&quot; href=&quot;#id&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s start with the &lt;a href=&quot;https://developer.mozilla.org/en/docs/Web/HTML/Global_attributes/id&quot;&gt;&lt;code&gt;id&lt;/code&gt; attribute&lt;/a&gt;. According to the &lt;a href=&quot;https://www.w3.org/TR/html5/dom.html#the-id-attribute&quot;&gt;Specification&lt;/a&gt; the value must be unique amongst all the IDs in the element’s home subtree and must contain at least one character.&lt;/p&gt;
&lt;p&gt;While this is true in theory and will throw an error when &lt;a href=&quot;https://validator.nu/&quot;&gt;validating&lt;/a&gt; HTML with two identical id`s, the page will render fine without an error in every browser and you can also style multiple id`s with the same value in CSS and even use &lt;code&gt;document.querySelectorAll(&#39;#id&#39;);&lt;/code&gt; and it will work fine as you can see in this &lt;a href=&quot;http://jsbin.com/fewaziq/edit?html,css,js,output&quot;&gt;demo&lt;/a&gt;. Nevertheless, you should never use multiple id`s with the same value on a page.&lt;/p&gt;
&lt;p&gt;With that in mind, let’s have a look where the &lt;code&gt;id&lt;/code&gt; attribute is useful and why.&lt;/p&gt;
&lt;h4 id=&quot;fragment-identifier&quot;&gt;Fragment identifier &lt;a class=&quot;permalink&quot; href=&quot;#fragment-identifier&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The first use case for the &lt;code&gt;id&lt;/code&gt; attribute is using it as a fragment identifier. This is really helpful to link to specific areas of a page, for example if you want to link to this section of this article you can add &lt;a href=&quot;#fragment-identifier&quot;&gt;#fragment-identifier&lt;/a&gt; to the url and link to it.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h4&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;fragment-identifier&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Fragment identifier&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Another pattern where this is often used is a “back-to-top” link, you can add an id with the value of top to an element at the beginning of the page and add a link referencing it. The page will scroll to the top by clicking the link.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#top&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Back to top&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;aria&quot;&gt;ARIA &lt;a class=&quot;permalink&quot; href=&quot;#aria&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Another case where I use the id attribute is ARIA, for example aria-labelledby and aria-describedby.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;username&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Your username&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;username&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-describedby&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;username-tip&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;tooltip&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;username-tip&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Your username is your email address&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is an &lt;a href=&quot;http://heydonworks.com/practical_aria_examples/#input-tooltip&quot;&gt;example&lt;/a&gt; from Heydon Pickering showing this in action.&lt;/p&gt;
&lt;h4 id=&quot;form-elments&quot;&gt;Form elments &lt;a class=&quot;permalink&quot; href=&quot;#form-elments&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;As you can see in the example above the id attribute is also used for form elements. By using an &lt;code&gt;id&lt;/code&gt; on the input/textarea and an &lt;code&gt;for&lt;/code&gt; attribute with same name for the label you associate both.&lt;/p&gt;
&lt;h2 id=&quot;class&quot;&gt;class &lt;a class=&quot;permalink&quot; href=&quot;#class&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As said in the beginning, I often used classNames as a selector in JavaScript which works fine most of the time but can lead to problems if you later change a className without remembering that it also has to be changed in JavaScript.&lt;/p&gt;
&lt;p&gt;That’s why I use classNames only for styling.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.class&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;data-attributes&quot;&gt;data attributes &lt;a class=&quot;permalink&quot; href=&quot;#data-attributes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I primarily use it in JavaScript, but also in CSS for different states.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; element &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-toggle]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;element&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;data-active&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;data-active&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;data-active&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If I want to change a state in JavaScript I add/remove a data attribute, which I will use in CSS to define additional styles for it:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;[data-active]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; pink&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This way, I can immediately see which parts in HTML and CSS are dependent from JavaScript.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Lately many people prefer to have HTML, CSS and JavaScript in one place, but I still prefer to separate them and with my current approach of using id, class and data attributes I can easily see in every file which part belongs to which language.&lt;/p&gt;
&lt;p&gt;This approach alone won’t help much if you don’t have documentation in place, so be sure to always document your code in a way that the information will be available for every developer.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> CSS and progressive enhancement</title>
							<link>https://justmarkup.com/log/2017/02/css-and-progressive-enhancement/</link>
							<pubDate>2017-02-13T13:33:50+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/02/css-and-progressive-enhancement/</guid>
							<description>&lt;p&gt;When people talk about progressive enhancement it is often reduced to JavaScript. It involves much more – accessibility, performance, robustness… and also CSS. Badly written CSS can make a site as usable as a JavaScript error or using non-semantic HTML.&lt;/p&gt;
&lt;p&gt;Let’s see why CSS can fail, why fallbacks are important and how to progressively enhance CSS.&lt;/p&gt;
&lt;h2 id=&quot;fallbacks&quot;&gt;Fallbacks &lt;a class=&quot;permalink&quot; href=&quot;#fallbacks&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;CSS has changed a lot in the last years. More and more properties were added and while some are now supported in all modern browsers some only work in one or two browsers. In any way, we can often make use of the architecture of CSS. If a browser doesn’t know a property it will simple skip it without throwing an error. Let’s have a look at an example to demonstrate this:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h2&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; black&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0.9&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case all browsers supporting rgba() will use the rgba() value for the color property. However, browsers not supporting rgba() will ignore this and use the value “black” for the color. In this example there won’t be much harm for users as the default value for color for h2 is already black, so browsers not supporting rgba() would still show the h2 in black, but there are other cases where this can lead to unusable content or unreadable text.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h2&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0.9&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s see how different browsers handle this example. Modern browsers supporting rgba() will show a white headline on a semi-transparent black background; Great. Browsers not supporting rgba() will show a white headline on a white background (assuming you haven’t changed the background-color of the element or parent elements), which means it won’t be visually shown for these users; Not great at all.&lt;/p&gt;
&lt;p&gt;You probably don’t need to set a fallback for every new CSS property, but you should make sure that the content is still usable in browsers where the new CSS property is not supported. If not sure, better use a fallback.&lt;/p&gt;
&lt;h2 id=&quot;feature-tests&quot;&gt;Feature tests &lt;a class=&quot;permalink&quot; href=&quot;#feature-tests&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Lately, there was a new rule defined in CSS – the @supports rule. You can think of it like a feature query. It gives you the possibility to check in CSS if a CSS feature is supported. Let’s have a look at an example:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;header h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 70px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; green&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@supports&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;mix-blend-mode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; screen&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;https://justmarkup.com/iceland/img/l/DSCF3732.JPG&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;background-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cover&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;background-repeat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; no-repeat&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;min-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 56vw&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;header h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;55&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;255&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;255&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0.8&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;mix-blend-mode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; screen&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.5&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Our default (not enhanced) style for our main headline is a big, green font.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/fallback.png&quot; alt=&quot;Screenshot of the default style - showing the word Iceland in green &quot;&gt;&lt;/p&gt;
&lt;p&gt;This looks okay, but we want to enhance this with new CSS features – in our case with mix-blend-mode and a background. To do this, we first define our feature test &lt;code&gt;@supports (mix-blend-mode: screen) {}&lt;/code&gt;. If the browser supports &lt;code&gt;@supports&lt;/code&gt; and &lt;code&gt;mix-blend-mode&lt;/code&gt; the CSS defined within our feature test will be applied. In this case, we set a background image, define the height to 56vw (so the image will maintain 16/9 ratio), add mix-blend-mode to the text and adapt the line-height as well as centering the text.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/with-supports-and-mix-blend-mode-1.png&quot; alt=&quot;Screenshot of the enhanced version with background and mix-blend-mode applied&quot;&gt;&lt;/p&gt;
&lt;p&gt;By using feature queries we can provide an enhanced version without breaking the site for unsupported browsers. Exactly, how I think progressive enhancement should work.&lt;/p&gt;
&lt;p&gt;Here is the demo as a &lt;a href=&quot;http://jsbin.com/sawaqu/edit?css,output&quot;&gt;JS Bin&lt;/a&gt; if you want to see it in action.&lt;/p&gt;
&lt;p&gt;You can find more information about using feature queries in this great &lt;a href=&quot;https://hacks.mozilla.org/2016/08/using-feature-queries-in-css/&quot;&gt;article&lt;/a&gt; by Jen Simmons.&lt;/p&gt;
&lt;h2 id=&quot;custom-properties&quot;&gt;Custom properties &lt;a class=&quot;permalink&quot; href=&quot;#custom-properties&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some new CSS properties only make sense to use for certain scenarios – custom properties (CSS variables) are a good example.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;--theme-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; gray&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; gray&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--theme-color&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; gray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this example, we first set our &lt;code&gt;--theme-color&lt;/code&gt; to gray, next in the selector &lt;code&gt;.element&lt;/code&gt; we first define a fallback for browsers not supporting custom-properties and after that set the background-color to our defined –theme-color. If you wonder why I defined gray inside var() &lt;code&gt;var(--theme-color, gray)&lt;/code&gt; here, that’s because if we would not have defined –theme-color in &lt;code&gt;:root&lt;/code&gt; before it would fallback to the value after the comma, in this case “gray”. To use CSS with custom properties responsible today (as there are still a lot of browsers not supporting custom properties), we would have to define a fallback and a custom property with another fallback.&lt;/p&gt;
&lt;p&gt;So if you only want to store values in CSS you better use pre/post processing as they give you the same result in every browser whereas with custom properties you would either need to set a fallback every time or only modern browser would get the styles you defined with custom properties. But, if you want to have advanced features like property changes and changing properties &lt;a href=&quot;https://drafts.csswg.org/css-variables/#example-a4134550&quot;&gt;depending on the cascade&lt;/a&gt; go for custom properties.&lt;/p&gt;
&lt;p&gt;If you want to implement the option to change the theme of your site, custom properties are a great way for this. You define the custom properties in CSS, all with a fallback to the default theme values, use JavaScript on your site to check if the browser supports custom properties and if this is the case offer an interface for users to change colors, sizes… A great enhancement without harm for any user.&lt;/p&gt;
&lt;h2 id=&quot;css-only&quot;&gt;CSS only &lt;a class=&quot;permalink&quot; href=&quot;#css-only&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As someone working on the front-end you have probably heard of css-only or pure CSS. It is mostly used to show what amazing things can be done with CSS only. Mostly they also require HTML and should better be called No-JavaScript examples. The biggest problem many of this examples have is that the CSS is used for interactivity and often is not accessible. They often use the &lt;a href=&quot;https://css-tricks.com/the-checkbox-hack/&quot;&gt;Checkbox Hack&lt;/a&gt; or make use of &lt;code&gt;:target&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Don`t get me wrong, I am often very impressed by some of the examples, but the same way you shouldn’t use JavaScript to imitate HTML elements you shouldn’t use CSS for parts where JavaScript should be used.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;span onclick=&amp;quot;javascript:window.location.href=&#39;https://justmarkup.com&#39;; return false;&amp;quot;&amp;gt;justmarkup.com&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have been guilty this myself and used &lt;code&gt;:target&lt;/code&gt; for expandable navigation, but now prefer to deliver a full shown navigation as a fallback and use JavaScript and ARIA to enhance the navigation and make it expandable. You can improve the style as much as you wan,t but you should be careful when trying to add interactivity with CSS.&lt;/p&gt;
&lt;h2 id=&quot;ads.css&quot;&gt;ads.css &lt;a class=&quot;permalink&quot; href=&quot;#ads.css&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Imagine a developer wrote a lot of styles and now names the file ads.css. If you wonder about the name, the developer speaks german and “ads” stands for “alle diese styles” (“all these styles”). It is all working fine until someone reports that the styles are not loading for them. The developer tries to reproduce it by testing in various browsers, with different extensions, on different network connections… but couldn’t find out why it is not loading for some users. After some time he finds the problem, these users are using an adblocker which blocks the loading of ads.css because of the name “Ads”.&lt;/p&gt;
&lt;p&gt;While I haven’t seen this case in production, I saw bug reports from sites, where a developer used &lt;code&gt;body class=&amp;quot;ad&amp;quot;&amp;gt;&lt;/code&gt; and the site was showing a white screen instead of the content because of an adblocker blocking every content inside elements with the class ad, ads or advertisement. Better avoid naming anything in your CSS, HTML, JavaScript related to ads if it has nothing to do with ads.&lt;/p&gt;
&lt;p&gt;The takeaway here is that anything can happen and it is not guaranteed that your CSS will always be loaded (bad connection, CDN being down…) and applied (extension interfering for example). That’s why the HTML used is not only important for SEO, screen readers, … but also if the CSS will have no effect.&lt;/p&gt;
&lt;h2 id=&quot;html-structure&quot;&gt;HTML structure &lt;a class=&quot;permalink&quot; href=&quot;#html-structure&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Using &lt;code&gt;&amp;lt;h2&amp;gt;Headline&amp;lt;/h2&amp;gt;&lt;/code&gt; will not only add semantics, but will also be visually remarkable as a headline without CSS because of the default styles the h2 gets from the browser, using &lt;code&gt;&amp;lt;p class=&amp;quot;h2&amp;quot;&amp;gt;Headline&amp;lt;/p&amp;gt;&lt;/code&gt; on the other hand will be shown as a paragraph with no hint that it is a headline if the CSS fails to load.&lt;/p&gt;
&lt;h3 id=&quot;change-order-with-css&quot;&gt;Change order with CSS &lt;a class=&quot;permalink&quot; href=&quot;#change-order-with-css&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes, we want to visually change the order of elements with CSS. We can do that with various properties (flexbox, grid, position…). As an example, let’s say we have a content area and a sidebar. On small devices we want to show the content area first and the sidebar underneath it, on bigger screens we want to show the sidebar on the left side of the screen and the content area on the right side.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/css-order.png&quot; alt=&quot;Screenshot showing the different order on small and big screens&quot;&gt;&lt;/p&gt;
&lt;p&gt;When writing the HTML we should always ask how the logical order should be. In this case, we want to have the content first and the sidebar after that because the content is the most important part and the sidebar contains additional information.&lt;/p&gt;
&lt;p&gt;By changing the order with CSS it won’t change the DOM order and it will also not effect the accessibility tree. This means, screen readers for example, will always get the information of the content area first and the one of the sidebar after that.&lt;/p&gt;
&lt;p&gt;Note: It can get confusing for &lt;a href=&quot;http://tink.uk/flexbox-the-keyboard-navigation-disconnect/&quot;&gt;keyboard users&lt;/a&gt;, as by changing the order with CSS the visual presentation changes, but not the tab order, which means there may be a lot of jumping from here to there to there when using the keyboard.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As with every other part on the web (and everywhere else) it is important to act responsible. While it is unlikely that a missing fallback or using an unknown CSS property will break the whole site, there is a good chance some parts won’t work as expected for some users. This is not about delivering the same styles and experience in every browser – it is about not completely breaking it for some users.&lt;/p&gt;
&lt;p&gt;CSS can fail too, be prepared.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Implementing push notifications on the front-end and back-end</title>
							<link>https://justmarkup.com/log/2017/02/implementing-push-notifications/</link>
							<pubDate>2017-02-07T16:43:07+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/02/implementing-push-notifications/</guid>
							<description>&lt;p&gt;As promised in my &lt;a href=&quot;https://justmarkup.com/log/2017/02/introducing-iss-observer-com/&quot;&gt;article&lt;/a&gt; introducing &lt;a href=&quot;http://iss-observer.com/&quot;&gt;iss-observer.com&lt;/a&gt; here are the technical details about implementing push notifications. Originally, I wanted to focus on the specific issues I encountered on &lt;a href=&quot;https://iss-observer.com/&quot;&gt;iss-observer.com&lt;/a&gt; but thought it may be more useful to show a minimal version and mention some issues as a side note. It should also be noted that some parts of the front-end are based on this &lt;a href=&quot;https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en&quot;&gt;tutorial&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Info: If studying actual code is more your thing, you can find the code on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/push-notifications&quot;&gt;Github&lt;/a&gt; and there is also a working &lt;a href=&quot;https://push-notifications-vwursywdxa.now.sh/&quot;&gt;demo&lt;/a&gt; showing the code in action.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/notification-chrome-mobile.png&quot; alt=&quot;Screenshot of the notification from iss-observer.com&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;front-end&quot;&gt;Front-end &lt;a class=&quot;permalink&quot; href=&quot;#front-end&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s start with the front-end part. First we add a feature test to check if the browser supports push notifications, and if it does load our JavaScript.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;PushManager&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; s &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;script&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/script/push.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;async &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;head&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Before starting with coding we need some prerequisites. We will need Application Server Keys (VAPID Key). You can get them either via this &lt;a href=&quot;https://web-push-codelab.appspot.com/&quot;&gt;site&lt;/a&gt; or by installing the web-push library (which we will need later on the back-end) with &lt;code&gt;npm install -g web-push&lt;/code&gt; and executing &lt;code&gt;web-push generate-vapid-keys&lt;/code&gt; on the terminal. In both cases you will get a public key and a private key, which you should save at safe place.&lt;/p&gt;
&lt;h3 id=&quot;note-on-gcm&quot;&gt;Note on GCM &lt;a class=&quot;permalink&quot; href=&quot;#note-on-gcm&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before the application server key / VAPID spec has been defined the first browser (Chrome, Opera) adding support for push notifications used GCM (Google Cloud Messaging) for handling notifications. All latest browser versions except for &lt;a href=&quot;https://github.com/web-push-libs/web-push#browser-support&quot;&gt;Samsung Internet&lt;/a&gt; now support VAPID. In this article, we won’t cover GCM, if you want to add support for current Samsung Internet (Version 5) and older versions of Chrome or Opera you can learn about more about it &lt;a href=&quot;https://web-push-book.gauntface.com/chapter-06/01-non-standards-browsers/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With that in place, have a look at the JavaScript file “push.js” where we will handle the Service Worker Registration and the subscription of notifications:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;use strict&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; appServerKey &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;BHLCrsFGJQIVgg-XNp8F59C8UFF49GAVxvYMvyCURim3nMYI5TMdsOcrh-yJM7KbtZ3psi5FhfvaJbU_11jwtPY&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pushWrapper &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.push-wrapper&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; pushButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.push-button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; serviceWorkerRegistration &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; subscriptionData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;urlB64ToUint8Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;base64String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; padding &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;=&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; base64String&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; base64 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;base64String &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; padding&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\-&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;+&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; rawData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;atob&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;base64&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; outputArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Uint8Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rawData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; i &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; rawData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    outputArray&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; rawData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;charCodeAt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; outputArray&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;updatePushButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  pushWrapper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hasSubscription&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    pushButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;Disable Push Notifications&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    pushButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;Enable Push Notifications&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;subscribeUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  serviceWorkerRegistration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pushManager&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    userVisibleOnly&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    applicationServerKey&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;urlB64ToUint8Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;appServerKey&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;subscription&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/push/subscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      method&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      headers&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;          &lt;span class=&quot;token string&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;application/json&#39;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;subscription&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; response&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;User is subscribed.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;      &lt;span class=&quot;token function&quot;&gt;updatePushButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;error fetching subscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Failed to subscribe the user: &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;unsubscribeUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  serviceWorkerRegistration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pushManager&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getSubscription&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;subscription&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;subscription&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      subscriptionData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        endpoint&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; subscription&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;endpoint&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;br&gt;      &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/push/unsubscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        method&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;        headers&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token string&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;application/json&#39;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;        body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;subscriptionData&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; response&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token function&quot;&gt;updatePushButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;error fetching subscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;      hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;      &lt;span class=&quot;token function&quot;&gt;updatePushButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; subscription&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;unsubscribe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;initPush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;  pushButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hasSubscription&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token function&quot;&gt;unsubscribeUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token function&quot;&gt;subscribeUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// Set the initial subscription value&lt;/span&gt;&lt;br&gt;  serviceWorkerRegistration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pushManager&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getSubscription&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;subscription&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    hasSubscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;subscription &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token function&quot;&gt;updatePushButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;sw.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;sw&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  serviceWorkerRegistration &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; sw&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token function&quot;&gt;initPush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Service Worker Error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we define the &lt;code&gt;appServerKey&lt;/code&gt; (the public VAPID Key mentioned above) and some elements and variables. Next, we add a function called &amp;quot;urlB64ToUint8Array&amp;quot; we will later use to convert the public key, which is base 64 URL safe encoded, to a UInt8Array.&lt;/p&gt;
&lt;p&gt;After that, we define a function called &amp;quot;updatePushButton&amp;quot; - we will call this every time the status of the notifications changes and update our UI according to it.&lt;/p&gt;
&lt;p&gt;Next, we have the function &amp;quot;subscribeUser&amp;quot; to subscribe users. You may notice that we already defined serviceWorkerRegistration at the beginning of the file. If you go to the end of the file you will see that we override this when registering the service worker so it contains the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration&quot;&gt;service worker registration&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;serviceWorkerRegistration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pushManager&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  userVisibleOnly&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  applicationServerKey&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;urlB64ToUint8Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;appServerKey&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The subscribe() method of the PushManager returns a Promise and needs two configuration parameters:&lt;br&gt;
userVisibleOnly: A Boolean indicating that the returned push subscription will only be used for messages whose effect is made visible to the user. It is required to set this to true.&lt;br&gt;
applicationServerKey: The public key (we generated above) your push server will use to send messages to client apps via a push server. This needs to be a UInt8Array so we use our function mentioned before to convert our key.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;subscription&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/push/subscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    method&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    headers&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token string&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;application/json&#39;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;subscription&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we send the push subscription details to the server. We can safely use the Fetch API here as every browser who supports push notifications also supports fetch. After we got back the response, we update the UI to show that the subscription was successfull or not. This is also the best place to send additional info to the user. For example, on iss-observer a user can decide if they want to receive notifications for sightings and the morning or/and evening and I also send the information about the country, region and city they want to get notifications to the server where I save the information and use them when deciding if a notification should be send.&lt;/p&gt;
&lt;p&gt;After that, we define the unsubscribe function called &amp;quot;unsubscribeUser&amp;quot;. Here, we are using the getSubscription() method of the PushManager to get the current subscription details and send it to the server via the fetch API to remove the subscription from the database.&lt;/p&gt;
&lt;p&gt;Next, we define our init function &amp;quot;initPush&amp;quot;. Here, we have an &lt;code&gt;EventListener&lt;/code&gt; for our push button, which will either call the subscribe or unsubscribe function depending on if we already have a subscription or not. There we also set the initial subscription value.&lt;/p&gt;
&lt;p&gt;You can find the full code used used here on &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/push-notifications/public/script/push.js&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Last in our file we register the service worker.&lt;/p&gt;
&lt;h2 id=&quot;the-service-worker&quot;&gt;The Service Worker &lt;a class=&quot;permalink&quot; href=&quot;#the-service-worker&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here we will focus on the two events, &amp;quot;push&amp;quot; and &amp;quot;nofificationclick&amp;quot; we will need to handle notifications.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;push&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; notificationData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    notificationData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    notificationData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      title&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Default title&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Default message&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      icon&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/default-icon.png&#39;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;  event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitUntil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;    self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;registration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;showNotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;notificationData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;title&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; notificationData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      icon&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; notificationData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;icon&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First we have a look at the &amp;quot;push&amp;quot; event in our service worker. There we check if we get a payload (title, body, icon..) from the server and if not fall back to a default message. After that, we use the showNotification() method to show the notification to the user.&lt;/p&gt;
&lt;p&gt;Note: In addition to title, body and icon the payload can also have other &lt;a href=&quot;https://web-push-book.gauntface.com/chapter-05/02-display-a-notification/#visual-options&quot;&gt;options&lt;/a&gt; like badge, tag or vibrate. At the time of writing this (February 2017) many of these are only available in some browsers. Therefore we will concentrate on title, body and icon which are supported in all browsers supporting push notifications.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;notificationclick&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// close the notification&lt;/span&gt;&lt;br&gt;  event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// see if the current is open and if it is focus it&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// otherwise open new tab&lt;/span&gt;&lt;br&gt;  event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitUntil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;&lt;br&gt;    self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;matchAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;clientList&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;clientList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; clientList&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;focus&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;openWindow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The notificationclick event will be triggered once the user clicks on the notification. We first close the notification. Next we check if the user has already a page open and focus it or otherwise open a new window with our site.&lt;/p&gt;
&lt;h2 id=&quot;back-end&quot;&gt;Back-end &lt;a class=&quot;permalink&quot; href=&quot;#back-end&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Moving on to the back-end where I used the &lt;a href=&quot;https://github.com/web-push-libs/web-push&quot;&gt;Web Push library&lt;/a&gt;. We will use the Node.js version, but there are also libraries for PHP, Java and C# &lt;a href=&quot;https://github.com/web-push-libs&quot;&gt;available&lt;/a&gt; if you prefer any of these languages.&lt;/p&gt;
&lt;p&gt;Note: I assume you have basic knowledge of Node.js and have used Express before. If this is new to you, I recommend reading about it first.&lt;/p&gt;
&lt;p&gt;Okay, first of all we install the Web Push library with &lt;code&gt;npm install web-push --save&lt;/code&gt; and require it in our app with &lt;code&gt;const webPush = require(&#39;web-push&#39;);&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;webPush&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setVapidDetails&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token string&quot;&gt;&#39;mailto:hallo@justmarkup.com&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token string&quot;&gt;&quot;YOUR_PUBLIC_VAPID_KEY&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// process.env.VAPID_PUBLIC_KEY,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token string&quot;&gt;&quot;YOUR_PRIVATE_VAPID_KEY&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// process.env.VAPID_PRIVATE_KEY&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we define the VAPID Details, these are the keys we generated at the beginning. In addition to this, we need to either set an email adress with the prefix mailto: or the URL of our site - this is in case a push service has to contact you for whatever reason. As you can see in the comments in the code I prefer to save these values as an environment variable &lt;code&gt;process.env.VAPID_PUBLIC_KEY&lt;/code&gt; - you may use other methods to save and get these values but the private key should always be saved safely and should never be exposed to the public; There is a reason it is called private key.&lt;/p&gt;
&lt;p&gt;Next, have a look at our subscribe function:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/push/subscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; subscription &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    endpoint&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;endpoint&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    keys&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      p256dh&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;p256dh&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      auth&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; req&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;auth&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; payload &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    title&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Welcome&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Thank you for enabling push notifications&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    icon&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/android-chrome-192x192.png&#39;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; options &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token constant&quot;&gt;TTL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3600&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// 1sec * 60 * 60 = 1h&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  webPush&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sendNotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;    subscription&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;    payload&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    options&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Send welcome push notification&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;subscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Unable to send welcome push notification&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; err &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;subscription not possible&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By sending the subscription details to the sever we will get the endpoint and the p256dh and auth keys. To keep this example short I will not show how to save the data in a database. For example, in my demo I used &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/push-notifications/controllers/push.js#L19&quot;&gt;Mongo DB&lt;/a&gt; to save the subscriptions.&lt;/p&gt;
&lt;p&gt;Here we will return a first notification welcoming the user once they subscribed. sendNotification() accepts three arguments: the subscription details we got from the browser, payload (title, body, icon...) and options. You can read more about the possible options &lt;a href=&quot;https://github.com/web-push-libs/web-push#sendnotificationpushsubscription-payload-options&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Info: The default TTL (Time To Live) defined by the web push library is four weeks. This means if you send a notification and the user is offline for two weeks and goes online again they will still get the notification. It is probably a good idea to change this to a shorter period as getting weeks old push notifications (which should always be important and time relevant) is probably not what you want.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/push/unsubscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// remove from database&lt;/span&gt;&lt;br&gt;  Push&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;findOneAndRemove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;endpoint&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; endpoint&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;      console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;error with unsubscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;unsubscription not possible&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;unsubscribed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;unsubscribe&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When a user unsubscribes we remove the saved entry from our database so we know we don&#39;t need to try sending notifications to them again.&lt;/p&gt;
&lt;h2 id=&quot;more-information&quot;&gt;More information &lt;a class=&quot;permalink&quot; href=&quot;#more-information&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You will probably have different use cases and you can&#39;t and shouldn&#39;t copy paste this, but I hope this tutorial showed you how to implement push notifications on the front-end and back-end.&lt;/p&gt;
&lt;p&gt;Here is the live &lt;a href=&quot;https://push-notifications-vwursywdxa.now.sh/&quot;&gt;demo&lt;/a&gt; used in this article and I also published the code on &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/push-notifications/&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to learn more about Web Push I highly recommend this free &lt;a href=&quot;https://web-push-book.gauntface.com/&quot;&gt;book&lt;/a&gt; or have a look at the examples on &lt;a href=&quot;https://serviceworke.rs/&quot;&gt;servicewore.rs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you have any issues implementing push notifications feel free to contact me on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;twitter&lt;/a&gt; or via &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Introducing 🚀 iss-observer.com</title>
							<link>https://justmarkup.com/log/2017/02/introducing-iss-observer-com/</link>
							<pubDate>2017-02-02T14:14:17+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/02/introducing-iss-observer-com/</guid>
							<description>&lt;p&gt;Since last year I watched the ISS (International Space Station) fly over various time since reading a tweet about &lt;a href=&quot;https://spotthestation.nasa.gov/&quot;&gt;Spot the Station&lt;/a&gt; from the NASA. There, you can enter your location and find out when you can see the ISS. You can also set alerts, to get notified via Email/SMS when the ISS flies over your location. Mostly this works fine, but I found that they are also sending notifications if the weather is really bad and you actually can’t see it and also if you can see it only for a very short time period.&lt;/p&gt;
&lt;p&gt;Later that year, I learned more about &lt;a href=&quot;https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web&quot;&gt;Push Notifications&lt;/a&gt; and started building a web app where you can search for your location, get data about ISS sightings combined with weather information and being able to receive push notifications.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/screen-big.jpg&quot; alt=&quot;Screenshot showing iss-observer open in Chrome Desktop&quot;&gt;&lt;/p&gt;
&lt;p&gt;I had a first version ready pretty quick, but hesitated to launch the site as I knew it is not perfect. I had to remind myself that &lt;a href=&quot;https://adactio.com/journal/11757&quot;&gt;a website is never done&lt;/a&gt;, there are always possible improvements and if I would wait for all the enhancements I have in my mind the site would probably never go public.&lt;/p&gt;
&lt;p&gt;So, without further ado, let me introduce you to &lt;a href=&quot;https://iss-observer.com/&quot;&gt;iss-observer.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;push-notifications&quot;&gt;Push notifications &lt;a class=&quot;permalink&quot; href=&quot;#push-notifications&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/notification-chrome-mobile.png&quot; alt=&quot;Screenshot of the notification from iss-observer.com&quot;&gt;&lt;/p&gt;
&lt;p&gt;The main feature why I build the site is to be able to receive push notifications on my phone. On the technical site, I used the &lt;a href=&quot;https://github.com/web-push-libs/web-push&quot;&gt;Web Push library for Node.js&lt;/a&gt; on the Back-end. This helped me a lot in implementing it. However, I also had some issues along the way, which I will write more about in a separate article.&lt;/p&gt;
&lt;p&gt;You can choose if you want to get notifications in the morning or/and evening and I tried to make clear that you will only receive a notification if the sky is clear enough to see it and if the time period is long enough.&lt;/p&gt;
&lt;h2 id=&quot;performance&quot;&gt;Performance &lt;a class=&quot;permalink&quot; href=&quot;#performance&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I tried my best to get a great performance and on the front-end I am doing pretty well. On &lt;a href=&quot;https://developers.google.com/speed/pagespeed/insights/&quot;&gt;PageSpeed Insights&lt;/a&gt; the site gets 100 out of 100 on mobile and desktop.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/PageSpeed-Insights.png&quot; alt=&quot;Screenshot from the PageSpeed Insights websites showing 100 from 100 for mobile and desktop&quot;&gt;&lt;/p&gt;
&lt;p&gt;Running the &lt;a href=&quot;https://github.com/GoogleChrome/lighthouse&quot;&gt;Lighthouse audit tool&lt;/a&gt; shows me 91 out of 100 possible points.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/02/Bildschirmfoto-vom-2017-02-02-095004.png&quot; alt=&quot;Screenshot of the Lighthouse tool showing 91 from 100&quot;&gt;&lt;/p&gt;
&lt;p&gt;The main reason why I don’t get 100 points is that the server-side can be pretty slow. When you search for a location I need to get the live data from the NASA as well as the weather information and unfortunately this can take some time until I get all the data. I am still looking for a way to improve this though.&lt;/p&gt;
&lt;p&gt;If you find any issues or want a new feature or enhancement added please write me an &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt;, send me a &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;tweet&lt;/a&gt; or file an issue on &lt;a href=&quot;https://github.com/justmarkup/iss-observer.com/issues&quot;&gt;Github&lt;/a&gt;. Thanks!&lt;/p&gt;
&lt;p&gt;I have already various enhancements planned and I am currently working on something which may or may not involve Augmented Reality. Stay tuned.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Handling states on resize using CSS custom properties</title>
							<link>https://justmarkup.com/log/2017/01/handling-states-on-resize-using-css-custom-properties/</link>
							<pubDate>2017-01-24T10:31:50+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/01/handling-states-on-resize-using-css-custom-properties/</guid>
							<description>&lt;p&gt;Last week, Scott Jehl asked: &lt;a href=&quot;https://twitter.com/scottjehl/status/821743412600832000&quot;&gt;Have your a11y assumptions/practices evolved w RWD?&lt;/a&gt;, which reminded me to re-evaluate my current practise of handling states on resize. My current approach is &lt;a href=&quot;https://www.lullabot.com/articles/importing-css-breakpoints-into-javascript&quot;&gt;importing CSS breakpoints into JavaScript&lt;/a&gt; and handle the JavaScript based on the values from the &lt;code&gt;:before&lt;/code&gt; pseudo elements defined in CSS. This way I don’t need to define the width/height where the elements should change in CSS and JavaScript, but only in CSS. While this is a great solution, it is also a hack and I think custom properties are better here.&lt;/p&gt;
&lt;p&gt;So, let’s see how we can improve this using CSS custom properties.&lt;/p&gt;
&lt;h2 id=&quot;expandable-menu&quot;&gt;Expandable menu &lt;a class=&quot;permalink&quot; href=&quot;#expandable-menu&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Throughout this article, we will use an expandable menu as our example. The idea is that the menu is fully visible on big screens and transforms into an expandable menu on small screens. Our basic markup looks like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;header&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;banner&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;logo&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Home&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Logo&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;nav&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;navigation&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;menu&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;js-menu js--expandable&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Link 1&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Another Link&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;			...&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;header&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, we have a header with our Logo and a navigation with multiple navigation items. I also added an id to the nav and two classes, which we will need later.&lt;/p&gt;
&lt;p&gt;With this basic markup and some styles our header will look like the following on big screens and small screens. Users of old browsers will also get this along with the case where JavaScript fails.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/01/Observing-states-on-resize-using-custom-properties.png&quot; alt=&quot;Screenshot of our example header on big screens&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/01/Observing-states-on-resize-using-custom-properties1.png&quot; alt=&quot;Screenshot of our example header on small screens&quot;&gt;&lt;/p&gt;
&lt;p&gt;Now, let’s have a look at the JavaScript.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//CTM&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;supports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;var(--primary)&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; expandableElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.js--expandable&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; header &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;header&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; menu &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.js-menu&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; menuButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; hasRun &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;observeMenu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; isExpandable &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getComputedStyle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;expandableElement&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getPropertyValue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--expandable&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// check if --expandable is set to true&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;isExpandable &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;true&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;						&lt;span class=&quot;token comment&quot;&gt;// add menu toggle button and eventListener if not already happened before&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;hasRun&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token function&quot;&gt;initToggleMenu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;						&lt;span class=&quot;token comment&quot;&gt;// hide menu and show button&lt;/span&gt;&lt;br&gt;			menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-labelledby&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;menu-button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;						&lt;span class=&quot;token comment&quot;&gt;// hide button and show menu&lt;/span&gt;&lt;br&gt;			menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-labelledby&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;initToggleMenu&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// Button properties&lt;/span&gt;&lt;br&gt;		menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;menu-button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;menu-button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;false&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-controls&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;menu&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Menu&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// Menu properties&lt;/span&gt;&lt;br&gt;		menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-labelledby&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;menu-button&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39; is--expandable&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// Add menu button to DOM&lt;/span&gt;&lt;br&gt;		header&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;insertBefore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;menuButton&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; menu&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// handle click on menu button&lt;/span&gt;&lt;br&gt;		menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token comment&quot;&gt;// Hide&lt;/span&gt;&lt;br&gt;				menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;false&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token comment&quot;&gt;// Show&lt;/span&gt;&lt;br&gt;				menu&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				menuButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;true&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		hasRun &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token function&quot;&gt;observeMenu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;br&gt;	window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;resize&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; observeMenu&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is pretty long, so let’s go through this step by step. First, we have a &lt;a href=&quot;http://responsivenews.co.uk/post/18948466399/cutting-the-mustard&quot;&gt;Cut the mustard&lt;/a&gt; check, so only supported browsers will run the JavaScript. Next, we define some variables with our needed elements as well as a Boolean value we will use later to check if the button has already been created.&lt;/p&gt;
&lt;p&gt;After that, we create a function called &lt;code&gt;observeMenu&lt;/code&gt; which we will execute on page load and on every resize. Within the function we first get the CSS custom property named &lt;code&gt;--expandable&lt;/code&gt;, based on which we will decide if the menu should be expandable or not.&lt;/p&gt;
&lt;p&gt;Here is the CSS we use to set the custom property. On small screens we set it to &lt;code&gt;true&lt;/code&gt; and once there is enough space to show it in one line, we set it to &lt;code&gt;false&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.js--expandable&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--expandable&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; true&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;.js--expandable&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token property&quot;&gt;--expandable&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; false&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Back in our &lt;code&gt;observeMenu&lt;/code&gt; function, if &lt;code&gt;isExpandable&lt;/code&gt; is true, we first check if we already added the menu, and if not add it. Futhermore we change some attributes based on the &lt;code&gt;isExpandable&lt;/code&gt; variable.&lt;/p&gt;
&lt;p&gt;Next, we have a function called &lt;code&gt;initToggleMenu&lt;/code&gt;, within we create the menu button to toggle the menu and also add an click event listener for our button.&lt;br&gt;
Lastly in the function we set the variable &lt;code&gt;hasRun&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; so the menu button only gets added once. Add the end we call our &lt;code&gt;observeMenu&lt;/code&gt; function and listen to it onresize.&lt;/p&gt;
&lt;p&gt;With that in place our menu is now expandable on small screens (if the browser supports custom properties) while still looking the same in other browsers and on big screens.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2017/01/Observing-states-on-resize-using-custom-properties2.png&quot; alt=&quot;Screenshot of our example menu showing the closed state&quot;&gt;&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.com/demos/observe-onresize-css-custom-properties/&quot;&gt;Demo&lt;/a&gt; and the code is also available on &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/observe-onresize-css-custom-properties/index.html&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While this solution may not always be the best option, due to &lt;a href=&quot;http://caniuse.com/#feat=css-variables&quot;&gt;browser support of CSS custom properties&lt;/a&gt; it is great as an enhancement for menus or other components. I already have some use cases in my mind that I am looking forward to use in upcoming projects.&lt;/p&gt;
&lt;p&gt;Overall, I think this is a great use case for custom properties and it feels a lot less hacky than using &lt;code&gt;:before&lt;/code&gt; pseudo elements.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Early adopters – Using new web platform features</title>
							<link>https://justmarkup.com/log/2017/01/early-adopters-using-new-web-platform-features/</link>
							<pubDate>2017-01-20T15:05:28+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/01/early-adopters-using-new-web-platform-features/</guid>
							<description>&lt;p&gt;In this article I would like to go through the why and when of using new features, ways to use features early and the responsibility of early adopters.&lt;/p&gt;
&lt;h2 id=&quot;what-are-the-benefits%3F&quot;&gt;What are the benefits? &lt;a class=&quot;permalink&quot; href=&quot;#what-are-the-benefits%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before using a new web platform feature, you should always ask: What are the benefits? Will this increase the experience for your users? Will your company benefit from it by saving money, development time…?&lt;/p&gt;
&lt;p&gt;You should also have a look at your statistics, to see how many users will benefit from the new feature now, in 6 months, in 2 years. Furthermore, you should find out if the new feature is a Draft or Recommendation? Also, how many browsers show interest in the new feature, how many browsers have already implemented it and how many browsers have it on their &lt;a href=&quot;https://www.chromestatus.com/feature/5668769141620736&quot;&gt;road map&lt;/a&gt; to implement it in the near future?&lt;/p&gt;
&lt;p&gt;Finally, you should find out it the feature, can be used as an enhancement, or with &lt;a href=&quot;https://justmarkup.com/log/2016/03/on-browser-support/&quot;&gt;a fallback&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If a feature is a Draft, one browser has implemented it (about 20% of your users), no other browser shows real interest, you could also implement a solution without using the feature and the time to implement it would be 40 hours it probably makes no sense to use the new feature.&lt;/p&gt;
&lt;p&gt;If a feature is a Recommendation, two browsers have implemented it, one is working on it and one shows interest, you couldn’t achieve it with existing technologies and the time to implement it will be 20 hours it probably makes sense – but only if you answered the questions above and see a benefit for your users/your company.&lt;/p&gt;
&lt;p&gt;Using a new feature just because it is “cool” is not really smart. Find out the cost vs. benefit ratio and based on that decide for every feature if you should implement it now, later or never.&lt;/p&gt;
&lt;p&gt;After talking about why and when to use new features, let’s have a look how to use new features.&lt;/p&gt;
&lt;h2 id=&quot;-prefix&quot;&gt;-prefix &lt;a class=&quot;permalink&quot; href=&quot;#-prefix&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;CSS Vendor Prefixes have been proposed by Mike Wexler from Adobe in September 1998. While it seemed like a good idea to ship experimental features with prefixes, in the end they &lt;a href=&quot;http://www.glazman.org/weblog/dotclear/index.php?post/2015/07/30/CSS-Vendor-Prefixes&quot;&gt;didn’t work out so well&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;Because of developers using prefix-only CSS, some browsers even had to add support for &lt;a href=&quot;https://hacks.mozilla.org/2016/09/firefox-49-fixes-sites-designed-with-webkit-in-mind-and-more/&quot;&gt;prefixes from other browsers&lt;/a&gt; because web sites look broken in these browsers.&lt;/p&gt;
&lt;p&gt;Nowadays, there are tools like &lt;a href=&quot;https://github.com/postcss/autoprefixer&quot;&gt;autoprefixer&lt;/a&gt; to automatically add all needed prefixes based on a defined browser matrix. Even if these features would have existed from the beginning of prefixes, there would always be developers not using such a tool and there will always be sites not updating their CSS and we would still have sites using wrong prefixes or even worse prefix-only CSS.&lt;/p&gt;
&lt;p&gt;While we still have to deal with prefixes for some time, I think there won’t be any (at least none I am aware of) new features shipped with a prefix. So, moving away from prefixes, let’s have a look what our options are to try out experimental/new features and ways to use them in production early on.&lt;/p&gt;
&lt;h2 id=&quot;flags&quot;&gt;Flags &lt;a class=&quot;permalink&quot; href=&quot;#flags&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;After learning from the negative impact of prefixes, many browsers like &lt;a href=&quot;about:config&quot;&gt;Firefox&lt;/a&gt;, &lt;a href=&quot;chrome://flags&quot;&gt;Chrome&lt;/a&gt; and &lt;a href=&quot;opera://flags&quot;&gt;Opera&lt;/a&gt; are now adding experimental features behind user-controlled flags.&lt;/p&gt;
&lt;p&gt;With flags, developers can test new features and learn about them so they can use the feature as soon as browsers start to ship to all users. Using feature detection they can also implement a feature now, although it isn’t shipped without a flag in any user and once available without flag users can benefit from it. So, when using features shipped behind flags always be sure to test with flags disabled as this is what the majority of your users get.&lt;/p&gt;
&lt;p&gt;Testing features behind flags gives developers also time to find bugs and report them early in the process (more on that later), and browsers and spec writers time to fix these before shipping it to all users.&lt;/p&gt;
&lt;h2 id=&quot;origin-trials&quot;&gt;Origin Trials &lt;a class=&quot;permalink&quot; href=&quot;#origin-trials&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/jpchase/OriginTrials/blob/gh-pages/explainer.md&quot;&gt;Origin Trials&lt;/a&gt; is an approach to enable safe experimentation with web platform features.&lt;/p&gt;
&lt;p&gt;At the moment (January 2017), Chrome is the only browsers using Origin Trials for some &lt;a href=&quot;https://github.com/jpchase/OriginTrials/blob/gh-pages/available-trials.md&quot;&gt;experimental features&lt;/a&gt;, but I hope more browsers will start using them in the future.&lt;/p&gt;
&lt;p&gt;Before you are able to use a feature shipped with Origin Trials, you have to &lt;a href=&quot;https://docs.google.com/forms/d/e/1FAIpQLSfO0_ptFl8r8G0UFhT0xhV17eabG-erUWBDiKSRDTqEZ_9ULQ/viewform&quot;&gt;request a Token&lt;/a&gt; for your site (origin). You can only participate if your site is available over HTTPS.&lt;/p&gt;
&lt;p&gt;After some time (up to 24hours) you will get an email with the Token. For example, the meta tag for using the Web Share API looks like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;origin-trial&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-feature&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Web Share&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-expires&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;2017-02-15&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;YOURTOKEN&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you have implemented the meta tag on your site you will be able to use the new feature and ship it to all users with a supporting browser. Every 2 months you have to renew your Token and also answer some questions about what you like/dislike about the feature. This information is very important for browsers, so they can change the implementation early on, based on findings from early adopters.&lt;/p&gt;
&lt;p&gt;What I like about Origin Trials is that developers have to use them careful, have to update their Token and most important have to give feedback to the browsers with the benefit of being able to ship new features to all supported browsers early on.&lt;/p&gt;
&lt;h2 id=&quot;sharing-and-caring&quot;&gt;Sharing and Caring &lt;a class=&quot;permalink&quot; href=&quot;#sharing-and-caring&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Developers using new web platform features from the beginning have the responsibility to challenge the features and report bugs and issues to the browsers and specification authors. While specification authors and browser developers try to think about every use case and edge case there are often cases they didn’t take into account and this is where we as developers can help.&lt;/p&gt;
&lt;p&gt;*Every* browser has a page to &lt;a href=&quot;https://bugspencer.com/&quot;&gt;report bugs&lt;/a&gt; and you can also open an &lt;a href=&quot;https://github.com/w3c/&quot;&gt;issue&lt;/a&gt; on the Github pages from the W3C for many new features.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When using new platform features, keep in mind that you are an Alpha/Beta user. Be aware that things may change or even break in the future. When using new features from the beginning, be sure to report bugs and issues.&lt;/p&gt;
&lt;p&gt;And always keep in mind that you don’t have to use/know about every new feature and that it often makes no sense to implement a new feature only because you can. Use featurs wisely!&lt;/p&gt;
&lt;p&gt;As always, these information may be out of date by the time you are reading this. Futhermore there may be more usable information I am/was not aware of. In both cases it would be great if you could let me know via &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt; or on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;twitter.&lt;/a&gt;; Thanks.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Truncating and revealing text  – The Show More and Read More patterns</title>
							<link>https://justmarkup.com/log/2017/01/truncating-and-revealing-text-the-show-more-and-read-more-patterns/</link>
							<pubDate>2017-01-12T17:28:18+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2017/01/truncating-and-revealing-text-the-show-more-and-read-more-patterns/</guid>
							<description>&lt;p&gt;Truncating text and revealing text on the web is very common and I have to deal with these patterns almost on every project I work on. There are many situations where people want to have expandable text. In this article, I will cover the Show More pattern (toggling text on user gesture) and the Read More pattern (Show full content on user gesture).&lt;/p&gt;
&lt;h2 id=&quot;show-more&quot;&gt;Show More &lt;a class=&quot;permalink&quot; href=&quot;#show-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s start with the Show More Pattern – where you have a short text and a button to reveal the longer text. Without the markup needed for the reveal function the HTML may look like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some text. Some text. Some text.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some more text. Some more text. Some more text. Some more text.&lt;br&gt;		Some more text. Some more text. Some more text.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some more text. Some more text. Some more text. Some more text.&lt;br&gt;		Some more text. Some more text. Some more text.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can use a JavaScript or CSS-based method to add the toggle functionality. First, let’s see how we can achieve it with JavaScript.&lt;/p&gt;
&lt;h3 id=&quot;using-javascript&quot;&gt;Using JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#using-javascript&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To start with, we modify the HTML and add a button to toggle the content and an id attribute on the “full text” wrapper element to associate it with the toggle button.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;more-1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;fulltext&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Some more text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-expanded&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;false&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-controls&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;more-1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;toggle-content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Show More&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the button we add two attributes &lt;code&gt;aria-expanded=&amp;quot;false&amp;quot;&lt;/code&gt; and &lt;code&gt;aria-controls=&amp;quot;more-1&amp;quot;&lt;/code&gt; for better accessibility. We also set the attribute &lt;code&gt;hidden&lt;/code&gt; so the button is hidden by default when the full text is not hidden as well. We also add some extra text for context, more on this later.&lt;/p&gt;
&lt;p&gt;With that in place, it will still look and behave the same as before (featured text and full text shown, toggle button hidden). This means that when JavaScript fails/is not available the user will still be able to read the full text.&lt;/p&gt;
&lt;p&gt;Now, we add some JavaScript to enhance this and toggle the full text.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// cut the mustard&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token string&quot;&gt;&#39;addEventListener&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; toggleButtons &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.toggle-content&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; fullTextWrappers &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.fulltext&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; fullText&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; toggleButtonText&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fullTextWrappers&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;fullTextWrapper&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// hide all full text on load&lt;/span&gt;&lt;br&gt;		fullTextWrapper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;toggleButtons&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;toggleButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// show toggle more buttons&lt;/span&gt;&lt;br&gt;		toggleButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// add listener for each button&lt;/span&gt;&lt;br&gt;		toggleButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;			fullTextWrapper &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.fulltext&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			toggleButtonText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.text&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;			&lt;span class=&quot;token comment&quot;&gt;// change attributes and text if full text is shown/hidden&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;fullTextWrapper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				toggleButtonText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Show More&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				fullTextWrapper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				toggleButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				toggleButtonText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Show Less&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				fullTextWrapper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				toggleButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;aria-expanded&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We start by &lt;a href=&quot;https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/&quot;&gt;cutting the mustard&lt;/a&gt;, so users using old browsers not supporting &lt;code&gt;querySelector&lt;/code&gt; or &lt;code&gt;addEventListener&lt;/code&gt; will get the “No-JavaScript Version” and can still read everything, while all other will get the enhanced version.&lt;/p&gt;
&lt;p&gt;Next, we define some variables we will need later and go through all full-text elements and hide them. After that, we loop over every toggle button, show it and add an listener. Within the listener, we check if the full text is hidden or not and based on this show/hide the text and change the text and &lt;code&gt;aria-expanded&lt;/code&gt; attribute of the button.&lt;/p&gt;
&lt;p&gt;Demo: &lt;a href=&quot;https://justmarkup.com/demos/toggle-content/showmore/with-js/&quot;&gt;Using JavaScript to toggle content&lt;/a&gt;, there is also a &lt;a href=&quot;https://justmarkup.com/demos/toggle-content/showmore/with-jquery/&quot;&gt;version with jQuery&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Code: &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/toggle-content/showmore/with-js/index.html&quot;&gt;Using JavaScript&lt;/a&gt; and the one &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/toggle-content/showmore/with-jquery/index.html&quot;&gt;using jQuery&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next, we have a look at how to achieve the same functionality without JavaScript.&lt;/p&gt;
&lt;h3 id=&quot;using-%3Atarget&quot;&gt;Using :target &lt;a class=&quot;permalink&quot; href=&quot;#using-%3Atarget&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For this, we make use of the &lt;a href=&quot;https://bitsofco.de/the-target-trick/&quot;&gt;Target Trick&lt;/a&gt; to show/hide content based on the fragment identifier (hash) of the URL.&lt;/p&gt;
&lt;p&gt;First, we change the Markup of our initial example:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;less-1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Text.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;fulltext&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;more-1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;more&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#more-1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Show more &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;More Text&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;less&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#less-1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Show less &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Headline&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here, we add an id attribute to the outer article element (to jump back there when hidding the content), an id attribute to the full text and two links (one to show and one to hide the full text).&lt;/p&gt;
&lt;p&gt;Next, we add some CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.fulltext p,&lt;br&gt;.less&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.fulltext:target p,&lt;br&gt;.fulltext:target .less&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.fulltext:target .more&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Per default, we hide the full text and the Show Less link. If the full text container is targeted (&lt;code&gt;.fulltext:target&lt;/code&gt;) we show the full text and Show Less link and hide the Show More link.&lt;/p&gt;
&lt;p&gt;Example: &lt;a href=&quot;https://justmarkup.com/demos/toggle-content/showmore/with-target&quot;&gt;Using :target to toggle content&lt;/a&gt;&lt;br&gt;
Code: &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/toggle-content/showmore/with-target/index.html&quot;&gt;of the :target version on Github&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note: You could also use the &lt;a href=&quot;http://css-tricks.com/the-checkbox-hack/&quot;&gt;Checkbox Hack&lt;/a&gt; to achieve a &lt;a href=&quot;https://codepen.io/Idered/pen/AeBgF&quot;&gt;toggle content pattern&lt;/a&gt; without JavaScript.&lt;/p&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary &lt;a class=&quot;permalink&quot; href=&quot;#summary&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;For this pattern I personally prefer a progressive enhanced JavaScript-based version because there won’t be the page jump as with the :target version and while I enjoy tricks/hacks with CSS I think that behaviour should be done in JavaScript if there are no disadvantages over a CSS solution.&lt;/p&gt;
&lt;p&gt;Whatever solution you choose, be sure to test if it is accessible and what happens if the something goes wrong.&lt;/p&gt;
&lt;h2 id=&quot;read-more&quot;&gt;Read More &lt;a class=&quot;permalink&quot; href=&quot;#read-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next, we will have a look at the Read More pattern.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Article&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Text. &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;more&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/article/#more&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Read More &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Article&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;article&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a very common pattern for article overview pages and while it is in use for ages there are still two issues many don’t think of.&lt;/p&gt;
&lt;h2 id=&quot;cutting-text&quot;&gt;Cutting text &lt;a class=&quot;permalink&quot; href=&quot;#cutting-text&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Truncating text on the web often seems an easy job at a first glance, but there are many ways to solve it and a lot of things which can go wrong.&lt;/p&gt;
&lt;p&gt;“Very important person is dead…Read More”&lt;br&gt;
while the whole sentence would be&lt;br&gt;
“Very important person is dead serious about solving the problem.”&lt;/p&gt;
&lt;p&gt;While I haven’t seen exactly this example, I have seen &lt;a href=&quot;https://twitter.com/cabel/status/808783680353116160&quot;&gt;many&lt;/a&gt; &lt;a href=&quot;https://twitter.com/planetmoney/status/809577279349227520&quot;&gt;examples&lt;/a&gt; where truncating text completely changed the meaning of a word or sentence. Sometimes this is funny, but it can also be abusive and offensive.&lt;/p&gt;
&lt;p&gt;That’s why you shouldn’t truncate text automatically if possible. In many CMS authors can define the featured text and where the Read More should appear. This way you will always know where the text is truncated and won’t run into a shitstorm because of wrongly truncated text. If manual truncating is not possible, at least truncate after sentences.&lt;/p&gt;
&lt;h2 id=&quot;providing-context&quot;&gt;Providing context &lt;a class=&quot;permalink&quot; href=&quot;#providing-context&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As shown in all examples above, I added an extra text for all Read/Show More/Less buttons and links with the class &lt;code&gt;.visually-hidden&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;more&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/article/#more&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Read Mor &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;visually-hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;about Article&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.visually-hidden&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;clip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;a:hover .visually-hidden,&lt;br&gt;a:focus .visually-hidden,&lt;br&gt;button:hover .visually-hidden,&lt;br&gt;button:focus .visually-hidden&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This text is visually hidden, but will be announced by screen readers. This is really useful as otherwise they may hear “Read More” multiple times, but don’t know where the link will lead to as the context is missing. For the examples above, I also decided to show the text if you hover or focus any of the links or buttons to see what text you are going to hide/show if there are multiple.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Be nice to your users, try to avoid automatic text truncation and always think about cases where something can go wrong. You don’t want to have hidden text which can’t be expanded because of a JavaScript error.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Distrusting certificates – Time to act if you use a StartCom (StartSSL) or WoSign certificate</title>
							<link>https://justmarkup.com/log/2016/12/distrusting-certificates/</link>
							<pubDate>2016-12-20T16:37:28+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/12/distrusting-certificates/</guid>
							<description>&lt;p&gt;&lt;strong&gt;Info: If you are using a certificate from StartCom (for example the free StartSSL certificate) or WoSign you should start switching to another certificate (from &lt;a href=&quot;https://letsencrypt.org/&quot;&gt;Let’s Encrypt&lt;/a&gt; or any other trusted one). Otherwise, your site will be marked as insecure and might not be accessible to users in the next stable Version of Chrome (56) and Firefox (51) which will both be released at the beginning of 2017.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This month my SSL certificate from StartSSL for &lt;a href=&quot;http://justmarkup.com/&quot;&gt;justmarkup.com&lt;/a&gt; had to be renewed. This task is normally done pretty quick and I didn’t expect any problem. Some days later I updated my Chrome to Version 56 and suddenly my site was marked as insecure and I had to explicitly allow it to access it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/12/api8i4lFwL.png&quot; alt=&quot;Chrome 56 showing justmarkup.com as insecure because of a StartSSL certificate. Screenshot by  Anselm Hannemann&quot;&gt;&lt;/p&gt;
&lt;p&gt;Chrome 56 showing &lt;a href=&quot;http://justmarkup.com/&quot;&gt;justmarkup.com&lt;/a&gt; as insecure because of a StartSSL certificate. Screenshot by &lt;a href=&quot;https://twitter.com/helloanselm&quot;&gt;Anselm Hannemann&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I tried to access it in other browsers, but they all showed the site as secure and after some debugging and trying to find the problem I came across an &lt;a href=&quot;https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html&quot;&gt;article by the Google security team&lt;/a&gt;. As you can read there, as of Chrome 56 (and also &lt;a href=&quot;https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/&quot;&gt;Firefox 51&lt;/a&gt; as I later found out) certificates from StartCom (including their free StartSSL certificates) and WoSign will no longer be accepted and sites using them will be marked as insecure.&lt;/p&gt;
&lt;p&gt;Before Let’s encrypt came out a lot of people got their certificate from StartCom as they were one of the only ones available for free. I expect a lot of people still use them and I hope they find out about the problem soon enough so their sites will still be available after the next stable releases.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/helloanselm&quot;&gt;Anselm Hannemann&lt;/a&gt; for reminding me about the issue yesterday, so I finally took the time to switch servers and to Let’s Encrypt.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Improving performance by Caching and Storing – article for Performance Calendar 2016</title>
							<link>https://justmarkup.com/log/2016/12/improving-performance-by-caching-and-storing-article-for-performance-calendar-2016/</link>
							<pubDate>2016-12-14T06:30:11+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/12/improving-performance-by-caching-and-storing-article-for-performance-calendar-2016/</guid>
							<description>&lt;p&gt;I had the honour to publish an article for the Performance Calendar 2016 about ways to improve performance by caching and storing. I write about ways to enhance performance for first and returning visits and explain the advantages of different caching and storing options.&lt;/p&gt;
&lt;p&gt;You can read the original article over at &lt;a href=&quot;http://calendar.perfplanet.com/2016/improving-performance-by-caching-and-storing/&quot;&gt;http://calendar.perfplanet.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You should also have a look at the other entries.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers should be more  intolerant and punish bad practice</title>
							<link>https://justmarkup.com/log/2016/11/browsers-should-be-more-intolerant/</link>
							<pubDate>2016-11-01T12:51:53+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/11/browsers-should-be-more-intolerant/</guid>
							<description>&lt;p&gt;As of October 15, 2016 the average web page is about 2.5MB. The size is increasing and &lt;a href=&quot;http://httparchive.org/trends.php?s=All&amp;amp;minlabel=Oct+15+2011&amp;amp;maxlabel=Oct+15+2016#bytesTotal&amp;amp;reqTotal&quot;&gt;increasing&lt;/a&gt;. Five years ago it was &lt;a href=&quot;http://httparchive.org/interesting.php?a=All&amp;amp;l=Oct%2015%202011&quot;&gt;830kb&lt;/a&gt; and I don’t want to think of how big it will be in five years from now. In the past five years browsers changed a lot, among other things they also got a lot fast. So, on hand hand browsers get faster on the other we build heavier sites; It is a cat-and-mouse game.&lt;/p&gt;
&lt;p&gt;It’s pretty crazy when you think about it. Browsers get faster, we have new technologies (responsive images, new image formats, Service Worker, HTTP/2…) and still surfing the web often feels as slow or even slower as five years ago. The main reason is that we build sites that are bloated and not optimized.&lt;/p&gt;
&lt;p&gt;There are many reasons why slow and inaccessible web sites are launched day by day: Time, Budget, uninformed developers, false assumptions …&lt;/p&gt;
&lt;p&gt;And there is another reason, I think has an impact: Browsers, browsers being tolerant and letting you load a 5MB background image, browsers being tolerant and letting you listen to events on inaccessible elements. You can throw a lot of *bad* things at browsers and they will not complain. Instead, they will do everything they can to clean up the mess.&lt;/p&gt;
&lt;h2 id=&quot;security&quot;&gt;Security &lt;a class=&quot;permalink&quot; href=&quot;#security&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In some way browsers are already pushing developers in the right direction. &lt;a href=&quot;https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins&quot;&gt;Powerful features&lt;/a&gt; will be has been deprecated on Insecure Origins. Furthermore, browsers started/will start to indicate/warn about insecure sites and also search engines will punish sites not using SSL by giving them a worse ranking. This is fantastic for security and privacy.&lt;/p&gt;
&lt;p&gt;So, when browsers can convince developers/site owners to secure their sites wouldn’t it also be great if they can convince them to build faster and more accessible sites.&lt;/p&gt;
&lt;h2 id=&quot;warn-and-punish&quot;&gt;Warn and punish &lt;a class=&quot;permalink&quot; href=&quot;#warn-and-punish&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I know it can be hard for browsers do decide what is bad and what is still okay? Is a web site loading one 2MB image bad or is that okay? What about a web site loading 50 images with 800kB? And, it will be even harder if not all browsers will agree on being more strict. You surely don’t want to be the browser where things will not work anymore because you started to be more strict and the others are not following.&lt;/p&gt;
&lt;p&gt;Regardless the concerns, I think it would be really great if browsers would start to log errors for bad things: Huge images, accessibility issues, performance issues…&lt;/p&gt;
&lt;p&gt;Here is an example of what this could look like in the console:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/11/Bildschirmfoto-vom-2016-11-01-142557.png&quot; alt=&quot;Optimize the image https://example.com/uploads/bg.png. Images bigger than 1MB will not be loaded as of 15.10.2018. See https://goo.gl/MStTGz for more details.&quot;&gt;&lt;/p&gt;
&lt;p&gt;This way, it will be a lot harder for developers to ignore these issues. Also, clients and site owners may then realize that not everything is possible with the time and budget they considered. That they may not build yet another useless feature, but instead focus on speed and accessibility.&lt;/p&gt;
&lt;p&gt;After some time of warning they could put this into practise and refuse to load big images or ignore events on inaccessible elements.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Many people do a great job and build fast and accessible sites and many people blame slow and inaccessible sites and try to educate others to do better, but I have the feeling this is not enough. For one or another reason there will always be slow and inaccessible sites.&lt;/p&gt;
&lt;p&gt;I know it will be a huge step for browsers, but I think it is about time browsers start to be more strict and prevent this.&lt;/p&gt;
&lt;p&gt;What do you think? Should browsers start to be more strict and intolerant?&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Using the Web Share API to enhance a static share link</title>
							<link>https://justmarkup.com/log/2016/10/using-the-web-share-api/</link>
							<pubDate>2016-10-21T05:56:26+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/10/using-the-web-share-api/</guid>
							<description>&lt;p&gt;The Web Share API is an experiment in Chrome and the origin trial will end in April 2017. Although I try to keep my articles up-to-date, the information here will likely be outdated at some point. For more info please visit &lt;a href=&quot;https://developers.google.com/web/updates/2016/10/navigator-share&quot;&gt;developers.google.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Since Chrome 55 (Beta as of October 2016) you can use the Web Share API as an &lt;a href=&quot;https://github.com/jpchase/OriginTrials/blob/gh-pages/developer-guide.md&quot;&gt;Origin Trail&lt;/a&gt; on Android. In this article, I would like to show, how to enhance your current share button with the Web Share API.&lt;/p&gt;
&lt;h2 id=&quot;requirements&quot;&gt;Requirements &lt;a class=&quot;permalink&quot; href=&quot;#requirements&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As I said, the Web Share API is an origin trail until April 2017. So, you first need to &lt;a href=&quot;https://docs.google.com/forms/d/e/1FAIpQLSfO0_ptFl8r8G0UFhT0xhV17eabG-erUWBDiKSRDTqEZ_9ULQ/viewform&quot;&gt;sign up&lt;/a&gt; to get a trail token. After about 1 day (it took ~4hours in my case) you will get an email with the Origin Trial Token for your site.&lt;/p&gt;
&lt;p&gt;Next you have to include the token on your site:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;origin-trial&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-feature&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Web Share&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-expires&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;2016-12-01&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;TOKEN&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Further requirements are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your site needs to be served via https&lt;/li&gt;
&lt;li&gt;You can call &lt;code&gt;navigator.share()&lt;/code&gt; only on user gesture, eg. click.&lt;/li&gt;
&lt;li&gt;All property values must be strings&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With that in place we can now use the Web Share API.&lt;/p&gt;
&lt;h2 id=&quot;demo-time&quot;&gt;Demo time &lt;a class=&quot;permalink&quot; href=&quot;#demo-time&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/10/Screenshot_20161021-093847-169x300.png&quot; alt=&quot;Screenshot showing the open share dialog in Chrome for Android&quot;&gt;&lt;/p&gt;
&lt;p&gt;First, we will include a static share link for twitter:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;share&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;https://twitter.com/intent/tweet?text=Using%20the%20Web%20Share%20API%20https%3A//justmarkup.com/log/2016/10/using-the-web-share-api/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Share via Twitter&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This way everybody using a browser not supporting the API will get a link (which may or may not look like a button) to share the site on twitter.&lt;/p&gt;
&lt;p&gt;Next, we add a script at the bottom of our site to enhance the link using the Share API:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;share &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;SHARE_BTN&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.share&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token constant&quot;&gt;SHARE_BTN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Share&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token constant&quot;&gt;SHARE_BTN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;		navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;share&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			title&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;title&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			url&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;link[rel=canonical]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;link[rel=canonical]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Successful share&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Error sharing:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s go through the code one by one. First, we add a feature test to check if &lt;code&gt;navigator.share&lt;/code&gt; is supported. If this is the case, we change the text of our share link from “Share via Twitter” to “Share” to show that you can share with various services.&lt;/p&gt;
&lt;p&gt;Next, we add an &lt;code&gt;EventListener&lt;/code&gt; for our share link, to call &lt;code&gt;navigator.share&lt;/code&gt; on click. There we define properties for title and url. You can also add a text property here. For the url we first check if there is a canonical link and use that, otherwise we use the current url.&lt;/p&gt;
&lt;p&gt;Last, we call &lt;code&gt;ev.preventDefault();&lt;/code&gt; to prevent the default action of the link.&lt;/p&gt;
&lt;p&gt;Everyone using a browser supporting the Share API can now easily share the site via all services/apps they have installed on their device and all others still get the twitter link or can copy the URL and share with their favorite service.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.com/web-share-api/using-the-web-share-api.html&quot;&gt;demo&lt;/a&gt; and you can also find the code on &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/web-share-api/using-the-web-share-api.html&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note: To enhance the sharing for browsers not supporting the Web Share API you can also use &lt;a href=&quot;https://jonsuh.com/blog/social-share-links/&quot;&gt;responsible social share links&lt;/a&gt; and load the share dialog in a pop-up.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It takes some preparation to use the Share API, but once you have completed them you can use it with some lines of JavaScript.&lt;/p&gt;
&lt;p&gt;The Web Share API will be a trail at least until April 2017, after that there may be another trail or it may be implemented by default. It also only works on Android for now. Still, I like the idea – it is a great example of browsers implementing features many sites already use. This gives users an enhanced experience without the overhead of loading lots of JavaScript as it currently the case on many sites.&lt;/p&gt;
&lt;p&gt;Happy sharing!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Fast on my machine</title>
							<link>https://justmarkup.com/log/2016/10/fast-on-my-machine/</link>
							<pubDate>2016-10-20T07:07:57+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/10/fast-on-my-machine/</guid>
							<description>&lt;p&gt;Yesterday at Polymer Summit, &lt;a href=&quot;https://twitter.com/slightlylate&quot;&gt;Alex Russell&lt;/a&gt; gave a fantastic &lt;a href=&quot;https://www.youtube.com/watch?v=K1SFnrf4jZo&quot;&gt;talk about adapting to the Mobile Web&lt;/a&gt;; You should watch it!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“You need to be interactive in about 3 seconds, on 3G, on a $200 phone. Then, in less than 1 second on next visit”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;He talked about that we are not succeeding on the mobile web at the moment mostly because our sites are too slow. After watching the video I thought a lot about the past, present and future of the web.&lt;/p&gt;
&lt;p&gt;Let’s have a look at the last couple of years in web development.&lt;/p&gt;
&lt;h2 id=&quot;responsive-design&quot;&gt;Responsive Design &lt;a class=&quot;permalink&quot; href=&quot;#responsive-design&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;in 2010, &lt;a href=&quot;https://twitter.com/beep&quot;&gt;Ethan Marcotte&lt;/a&gt; wrote about &lt;a href=&quot;http://alistapart.com/article/responsive-web-design&quot;&gt;Responsive Web Design&lt;/a&gt;. We were *all* excited about it, but also a little bit afraid because we realized that there is more than “Desktop”. We realized that we have to adapt to lots of different situations – browser, screen sizes, input…&lt;/p&gt;
&lt;p&gt;More importantly, we realized that &lt;a href=&quot;http://dowebsitesneedtolookexactlythesameineverybrowser.com/&quot;&gt;websites doesn’t need to look the same in every browser&lt;/a&gt; and most importantly, many also thought a lot more about accessibility. We wrongly assumed that *all* users use a keyboard and a mouse. After realizing that, we not only made our sites better usable for touch devices, but also for all other including keyboard and screen readers. As a really nice side-effect, we improved the accessibility of our sites.&lt;/p&gt;
&lt;p&gt;In short, Responsive Design brought us better usability and accessibility. Great!&lt;/p&gt;
&lt;h2 id=&quot;mobile-first-%E2%80%93-content-first&quot;&gt;Mobile First – Content First &lt;a class=&quot;permalink&quot; href=&quot;#mobile-first-%E2%80%93-content-first&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In 2009, &lt;a href=&quot;https://twitter.com/lukew&quot;&gt;Luke Wroblewski&lt;/a&gt; talked about &lt;a href=&quot;http://www.lukew.com/ff/entry.asp?933&quot;&gt;Mobile First&lt;/a&gt;. The core part of Mobile First is that we should focus only on the most important data and actions.&lt;/p&gt;
&lt;p&gt;We realized that we should focus on the core part of our site. We realized that we should not bloat our sites with unnecessary content and actions they don’t care about.&lt;/p&gt;
&lt;p&gt;In short, Mobile First brought us better content. Great!&lt;/p&gt;
&lt;h2 id=&quot;progressive-web-apps&quot;&gt;Progressive Web Apps &lt;a class=&quot;permalink&quot; href=&quot;#progressive-web-apps&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In 2015, &lt;a href=&quot;https://twitter.com/slightlylate&quot;&gt;Alex Russell&lt;/a&gt; wrote about a new concept, called &lt;a href=&quot;https://infrequently.org/2015/06/progressive-apps-escaping-tabs-without-losing-our-soul/&quot;&gt;Progressive Web Apps&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A Progressive Web App should be Responsive, Connectivity independent, Fresh, Safe, Discoverable, Re-engageable, Installable, Linkable and should have App-like-interactions. As you can see, Performance, is not part of the definition, but many techniques behind it will improve the performance of your site.&lt;/p&gt;
&lt;p&gt;Some days ago, &lt;a href=&quot;https://twitter.com/grigs&quot;&gt;Jason Grigsby&lt;/a&gt; wrote about why &lt;a href=&quot;https://cloudfour.com/thinks/why-does-the-washington-posts-progressive-web-app-increase-engagement-on-ios/&quot;&gt;The Washington Post’s Progressive Web App increased engagement on iOS?&lt;/a&gt;. The short answer is, the Progressive Web App is much faster than the old mobile site. I wouldn’t say that transforming your site into a Progressive Web App automatically makes it faster, but I think many will realize that the performance of their current site is bad and that they should improve it.&lt;/p&gt;
&lt;p&gt;In short, Progressive Web Apps brings us better performance. I hope so.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We are consistently improving and we often have to realize that our assumptions are wrong. The history showed that new approaches often came with positive side-effects. They brought us better accessibility, better content and now hopefully also better performance.&lt;/p&gt;
&lt;p&gt;If you want an interactive site in 3 seconds on 3G on an average phone on first visit you probably have to rethink, you have to realize that the phone and computer you own are not representative. We have to realize that most people use *slow* devices on *slow* connections. While we realized that “works on my machine” was wrong, we also have to realize that “fast on my machine” is wrong as well.&lt;/p&gt;
&lt;p&gt;We can argue about progressive enhancement forever or we can realize that many parts (server-side rendering on first visit, using appropriate HTML…) give us also the benefit of being fast.&lt;/p&gt;
&lt;p&gt;PS: I tried to find the earliest mentions of the different concepts, but may have missed something, so please let me know if it is not correct. Thanks!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> My reply to ” Progressive enhancement isn’t dead, but it smells funny” by Nolan Lawson</title>
							<link>https://justmarkup.com/log/2016/10/my-reply-to-progressive-enhancement-isnt-dead-but-it-smells-funny-by-nolan-lawson/</link>
							<pubDate>2016-10-13T15:41:39+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/10/my-reply-to-progressive-enhancement-isnt-dead-but-it-smells-funny-by-nolan-lawson/</guid>
							<description>&lt;p&gt;Here is the &lt;a href=&quot;https://nolanlawson.com/2016/10/13/progressive-enhancement-isnt-dead-but-it-smells-funny/&quot;&gt;post&lt;/a&gt;, you should read first before reading my thoughts,&lt;/p&gt;
&lt;p&gt;This is a cross-post, the content I wrote down here is the same as in the &lt;a href=&quot;https://nolanlawson.com/2016/10/13/progressive-enhancement-isnt-dead-but-it-smells-funny/#comment-84645&quot;&gt;original comment&lt;/a&gt; I left on his site.&lt;/p&gt;
&lt;p&gt;First of all, thanks for writing down your thoughts. While I agree with some points I also can’t really agree with some.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(Spoiler alert: many top websites do not bother to make their core functionality work without JavaScript.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yes, many top websites only work with JavaScript, which I don’t think is a practise we should all follow. At least not, if we define JavaScript as client-side JavaScript and don’t involve sever-side JavaScript. Many big sites are also not optimized, eg &lt;a href=&quot;https://twitter.com/molily/status/783767319470374916&quot;&gt;https://twitter.com/molily/status/783767319470374916&lt;/a&gt; and, I think you agree here, that we shouldn’t build our sites by following that.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;As Jake Archibald pointed out, it’s not really about users who have disabled JavaScript, so who exactly are we helping when we make our websites work without it?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Everyone who uses an ad blocker, which may prevent your JavaScript from running, everyone on a poor connection where the JavaScript takes to long on the first load and many more. It is not about “no JavaScript”, it is about, what happens when the JavaScript doesn’t work for the user.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Offline-first is a form of progressive enhancement that directly targets the baseline experience that a high-quality progressive web app ought to support, rather than focusing on the more reductionist mindset of “first HTML, then CSS, then JavaScript.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I am all for offline-first (although I don’t really like the term, as it is only true for second visit) but this doesn’t mean we shouldn’t focus on the the core principles of PE anymore. I really like Service Worker for example, one of the reasons why I really like it is that this is a perfect example of PE for me. If a browser supports Service Worker you get a performance boost if done right, if the browser doesn’t support it they will get the same experience as before. Nobody harmed, but some (many more in the future) get an enhanced experience.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;My question to Jeremy, however, is: why? Why is it considered an unqualified good to make a website that works without JavaScript? Is it possible that this mindset – “start with HTML, add CSS, sprinkle on JavaScript” – is only a best practice in a world of incapable browsers (such as IE6) hooked up to stable desktop connections, and now that we’re in a world of smart, JavaScript-enabled browsers with unreliable connections, we need to re-evaluate our thinking?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From what I understand, Jeremy doesn’t mean “works without JavaScript”, but rather “render the core content if JavaScript fails”. For me this means, that on first load you should always render the core content server-side (be it static HTML, via PHP or via Node.js). A smart, JavaScript-enabled browser is only smart if the JavaScript works perfectly fine, otherwise the browser is rather dump.&lt;/p&gt;
&lt;p&gt;I am all for optimizing for unreliable connections, and rendering the core content server-side on first load will always be faster so why not use this instead of rendering it client-side with JavaScript.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We as a community need to realize that the question of “JavaScript – yes or no?” is less about access and ubiquity, and more about performance and robustness.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yes, it is about performance and robustness but more important about accessibility and being prepared for failures. And JavaScript often fails and all optimizations won’t help the user in that case as they simple can’t use the site anymore if you are not prepared for that scenario.&lt;/p&gt;
&lt;p&gt;To sum up my thoughts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Render the core part of the site server-side (and of course this can also be done with JavaScript, eg. Node.js) on first view. From there on you can render additional content with JavaScript. And, of course you can enhance the regular links on your site and can use JavaScript to transitions between pages.&lt;/li&gt;
&lt;li&gt;Never try to imitate native HTML with JavaScript.&lt;/li&gt;
&lt;li&gt;Accessility should always be more important than performance or other constraints.&lt;/li&gt;
&lt;li&gt;Use JavaScript, but use it wisely and don’t assume it will always work.&lt;/li&gt;
&lt;li&gt;Be nice!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks again for writing this and keep up this nice conversation between different mindsets.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Enhancing a comment form - From basic to custom error message to BackgroundSync</title>
							<link>https://justmarkup.com/log/2016/10/enhancing-a-comment-form/</link>
							<pubDate>2016-10-10T12:12:04+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/10/enhancing-a-comment-form/</guid>
							<description>&lt;p&gt;When building a web site, sooner or later, you will probably have to implement a form, be it a login form or a comment form. I have done it many times before, and the last time I had to create a comment form, I thought about how far I can enhance it. After adding one enhancement, another enhancement crossed my mind and after implementing that yet another one.&lt;/p&gt;
&lt;p&gt;That’s why I would like to show you how you can enhance a form (in this case consisting of an &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; for the name, a &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; for the message and a submit &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;) from the most basic version to an EnhancedEnhanced™ Version with BackgroundSync.&lt;/p&gt;
&lt;h2 id=&quot;basic-version&quot;&gt;Basic Version &lt;a class=&quot;permalink&quot; href=&quot;#basic-version&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We start with the basic version, a HTML form:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;form&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;./&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Name&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Comment&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;textarea&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;textarea&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Publish&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will work in *every* browser. From here we start adding enhancements without breaking the basic version.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v1/&quot;&gt;demo&lt;/a&gt; of the basic version.&lt;/p&gt;
&lt;h2 id=&quot;enhanced-html-version&quot;&gt;Enhanced HTML version &lt;a class=&quot;permalink&quot; href=&quot;#enhanced-html-version&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/09/Bildschirmfoto-vom-2016-09-30-185209.png&quot; alt=&quot;HTML form validation showing &amp;quot;Please fill out this field&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;The first thing we do is adding an &lt;code&gt;required&lt;/code&gt; attribute to our Textarea and as it should never be empty. If the browser &lt;a href=&quot;http://caniuse.com/#feat=form-validation&quot;&gt;supports&lt;/a&gt; HTML form validation we get validation out of the box without using JavaScript. We shouldn’t, however, rely on it (not supported browsers, browser &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=28649&quot;&gt;bugs&lt;/a&gt;, …) so it is always a good idea to validate form values on the server side.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;form&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;./&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Name&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Comment&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;textarea&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;What&lt;span class=&quot;token punctuation&quot;&gt;&#39;&lt;/span&gt;s on your mind?&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;textarea&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Publish&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we add an &lt;a href=&quot;https://davidwalsh.name/html5-placeholder&quot;&gt;&lt;code&gt;placeholder&lt;/code&gt; attribute&lt;/a&gt; as a nice extra touch. Always keep in mind that you should never replace a label with a placeholder, it’s a great enhancement, but not a replacement.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v2/&quot;&gt;demo&lt;/a&gt; of the enhanced HTML version.&lt;/p&gt;
&lt;h2 id=&quot;cut-the-mustard&quot;&gt;Cut the mustard &lt;a class=&quot;permalink&quot; href=&quot;#cut-the-mustard&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;For further enhancements we will use JavaScript. First, we add a &lt;a href=&quot;https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/&quot;&gt;cut the mustard&lt;/a&gt; test to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of our page. We are using a technique I first encountered in the article &lt;a href=&quot;https://www.filamentgroup.com/lab/enhancing-optimistically.html&quot;&gt;Enhancing optimistically&lt;/a&gt; by the Filament Group.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;visibilityState&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// include loadJS here...&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;loadJS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// This is a capable browser, let&#39;s improve the UI further!&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; docElem &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// the class we&#39;ll use to enhance the UI&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; enhancedClass &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;enhanced&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; enhancedScriptPath &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;enhanced.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// add enhanced class&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		docElem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; enhancedClass&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// remove enhanced class&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;removeClass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		docElem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; docElem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; enhancedClass&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// Let&#39;s enhance optimistically...&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token function&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// load enhanced JS file&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; script &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;loadJS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; enhancedScriptPath &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// if script hasn&#39;t loaded after 8 seconds, remove the enhanced class&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; fallback &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; removeClass&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8000&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// when the script loads, clear the timer out and add the class again just in case&lt;/span&gt;&lt;br&gt;	script&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// clear the fallback timer&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token function&quot;&gt;clearTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; fallback &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// add this class, just in case it was removed already (we can&#39;t cancel this request so it might arrive any time)&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token function&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;custom-error-messages&quot;&gt;Custom error messages &lt;a class=&quot;permalink&quot; href=&quot;#custom-error-messages&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/09/Bildschirmfoto-vom-2016-09-30-195016.png&quot; alt=&quot;Custom error message &amp;quot;Please enter a comment&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;With our feature test in place we will add custom error messages, as “Please fill out this field.” isn’t a really nice message. In our enhanced.js script (which will only be loaded in capable browsers) we add the following to define a custom message:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// set a custom text for the error message&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; commentArea &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#comment&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;commentArea&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;invalid&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCustomValidity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;validity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;valid&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCustomValidity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Please enter a comment.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;commentArea&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;input&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCustomValidity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case we show the message “Please enter a comment” when a user submits the form without a comment. You may have noticed that I haven’t talked about styling the error messages so far. That’s because currently there is now way to style them with CSS. There used to be ::-webkit-validation-bubble for webkit-based browsers, but it has been removed. If you really want to style them you need to &lt;a href=&quot;http://developer.telerik.com/featured/building-html5-form-validation-bubble-replacements/&quot;&gt;build your own validation bubble&lt;/a&gt; but be aware that there are many things which may go wrong so I would advise using the default bubbles as they give you all for free.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v3/&quot;&gt;demo&lt;/a&gt; of the custom error message version.&lt;/p&gt;
&lt;h2 id=&quot;ajaxify&quot;&gt;Ajaxify &lt;a class=&quot;permalink&quot; href=&quot;#ajaxify&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;All modern browsers now get a custom error message when the user tries to submit an empty comment, but if they enter a comment the form is still submitted server-side and therefore a page reload is necessary. Let’s enhance it by posting the comment via JavaScript.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// send form data with JavaScript&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FormData&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;appendComment&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;nameValue&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; commentValue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; comment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;li&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; commentName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;h4&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; commentComment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;p&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; commentWrapper &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.comments&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		commentName&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; nameValue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		commentComment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; commentValue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		nameValue &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; comment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;commentName&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		comment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;commentComment&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		commentWrapper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;comment&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	form&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; formData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;FormData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;form&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		commentValue &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; commentArea&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		nameValue &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; nameInput&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; xhr &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;XMLHttpRequest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// save the comment in the database&lt;/span&gt;&lt;br&gt;		xhr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;POST&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;./save&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		xhr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token function&quot;&gt;appendComment&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nameValue&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; commentValue&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		xhr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;formData&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// always call preventDefault at the end, see: http://molily.de/javascript-failure/&lt;/span&gt;&lt;br&gt;		ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First we check if the browser supports &lt;a href=&quot;http://caniuse.com/#feat=xhr2&quot;&gt;FormData&lt;/a&gt;, an advanced XMLHttpRequest feature. If it does, we define a function &lt;code&gt;appendComment()&lt;/code&gt; to append the new comment to the other comments. Next, we add and eventListener to our form to make an XMLHttpRequest on submit. If the request was successfull we append the comment. At the very end we call preventDefault to prevent the default behaviour of the form. It is important to call preventDefault at the end as we cannot be sure if the &lt;a href=&quot;http://molily.de/javascript-failure/&quot;&gt;JavaScript might fail&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With that in place, our form ideally submits the comment without page load, but still works for unsupported browsers.&lt;/p&gt;
&lt;p&gt;At this point you may wonder why I didn’t use &lt;a href=&quot;http://caniuse.com/#feat=fetch&quot;&gt;Fetch&lt;/a&gt;. The reason is, I wanted to support as many modern browsers as possible without requiring a polyfill or only support the latest browsers.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v5/&quot;&gt;demo&lt;/a&gt; of the ajaxified version.&lt;/p&gt;
&lt;h2 id=&quot;auto-expand-the-textarea&quot;&gt;Auto-expand the Textarea &lt;a class=&quot;permalink&quot; href=&quot;#auto-expand-the-textarea&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you want to write a longer comment you currently have to scroll up and down if you want to recheck what you wrote. We can improve this by auto-expanding our Textarea.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/10/textarea-autoexpand.gif&quot; alt=&quot;demo of writing in a Textarea with auto-expand.&quot;&gt;&lt;/p&gt;
&lt;p&gt;For this, we are going to implement a &lt;a href=&quot;https://codepen.io/vsync/pen/czgrf&quot;&gt;solution&lt;/a&gt; I found on CodePen.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;commentArea&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;keydown&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; autosize&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;autosize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; el &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;cssText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;height:auto;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;cssText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;height:&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollHeight &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With that in place the Textarea now adapts to the length of the comment and makes it easier to check what you wrote.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v5/&quot;&gt;demo&lt;/a&gt; of the auto-expand version.&lt;/p&gt;
&lt;h2 id=&quot;prepare-for-success%2C-error-and-poor-connection&quot;&gt;Prepare for success, error and poor connection &lt;a class=&quot;permalink&quot; href=&quot;#prepare-for-success%2C-error-and-poor-connection&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So far we added HTML enhancements (placeholder and required attribute), defined custom error messages, ajaxified our form and added auto-expand for the Textarea.&lt;/p&gt;
&lt;p&gt;Next, we will enhance the experience by showing when the comment was posted successfully or not and also show an indicator if it takes longer.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;feedback&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Publish&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First we add a new element to our form to show messages.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; messageElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;#feedback&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;&lt;br&gt;form&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;&lt;br&gt;	xhr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onerror&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;message error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;There was an error posting the comment. Please try again.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	xhr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;upload&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onprogress&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;evt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Uploading: &#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; evt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;loaded&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;evt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;total&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	xhr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;upload&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onloadend&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;evt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;message success&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Your comment was posted sucessfully.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the comment is not successful for whatever reason we show an error message as defined in the error event, otherwise we show a success message as defined in the loadend event. In the progress event we add an indicator showing how many % of the comment are already uploaded. On fast connections you won’t see the indicator, but if you write a long comment and are on the go using a poor connection this helps to show that there is something happening and that the comment will be uploaded sooner or later.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v6/&quot;&gt;demo&lt;/a&gt; of the progress version.&lt;/p&gt;
&lt;h2 id=&quot;service-worker-and-backgroundsync&quot;&gt;Service Worker and BackgroundSync &lt;a class=&quot;permalink&quot; href=&quot;#service-worker-and-backgroundsync&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now, that we improved the experience with poor connections let’s enhance the experience for unusable connections.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// check for service worker support&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// register the service worker&lt;/span&gt;&lt;br&gt;	navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;./service-worker.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	form&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; formData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;FormData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;form&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// send message via BackgroundSync&lt;/span&gt;&lt;br&gt;		navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ready&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;swRegistration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;			idbKeyval&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;comment&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; commentArea&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			idbKeyval&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; nameInput&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; nameInput&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;message info&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;It seems you are offline. Comment will be published automatically once you are online again.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; swRegistration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;sync&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;form-post&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// always call preventDefault at the end, see: http://molily.de/javascript-failure/&lt;/span&gt;&lt;br&gt;		ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// event to receive messages send by service worker&lt;/span&gt;&lt;br&gt;	navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;message&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;success&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;message success&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Your comment was posted sucessfully.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; nameValue &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			idbKeyval&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				nameValue &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; commentValue &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				idbKeyval&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;comment&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;					commentValue &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;					&lt;span class=&quot;token function&quot;&gt;appendComment&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nameValue&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; commentValue&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;message error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			messageElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;There was an error posting the comment. Please try again later.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FormData&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First, we check if &lt;a href=&quot;https://www.w3.org/TR/service-workers/&quot;&gt;Service Worker&lt;/a&gt; is supported by the browser. If it does, we use &lt;a href=&quot;https://github.com/WICG/BackgroundSync/blob/master/explainer.md&quot;&gt;BackgroundSync&lt;/a&gt; to post the comment, otherwise we will post the comment via an XMLHttpRequest as shown above in the Ajax version.&lt;/p&gt;
&lt;p&gt;Let’s have a look at the code and what it does. On submitting the form we save the value for the name and comment in &lt;a href=&quot;https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API&quot;&gt;IndexedDB&lt;/a&gt;. In my case I am using a helper, a &lt;a href=&quot;https://github.com/jakearchibald/idb-keyval&quot;&gt;promise-based keyval store implemented with IndexedDB&lt;/a&gt; by Jake Archibald. We will also show a message that you are offline and the comment will automatically be published once you are online again. You won’t see this message when you have an usable connection and the form can be published immediately. Finally, we register a BackgroundSync with the tag “form-post”.&lt;/p&gt;
&lt;p&gt;Next, we define an EventListener which checks for messages coming from the Service Worker to show if the comment was posted successful or not.&lt;/p&gt;
&lt;p&gt;Now, let’s have a look what our service-worker.js looks like.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;importScripts&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;idb-keyval.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;VERSION&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;v1&#39;&lt;/span&gt;&lt;br&gt;&lt;br&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;install&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;skipWaiting&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitUntil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;		caches&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; cache&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token string&quot;&gt;&#39;./&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token string&quot;&gt;&#39;./index.html&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token string&quot;&gt;&#39;../style.css&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token string&quot;&gt;&#39;enhanced.js&#39;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;fetch&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; request &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;method &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;GET&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;activate&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;clients &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;claim&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;claim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;sync&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tag &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;form-post&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;waitUntil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;postComment&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;postComment&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; formData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;FormData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	idbKeyval&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		formData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; data &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	idbKeyval&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;comment&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		formData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;comment&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; data &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;./save&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		method&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;		mode&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;cors&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;		body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; formData&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; response&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token function&quot;&gt;send_message_to_all_clients&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;success&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token function&quot;&gt;send_message_to_all_clients&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;send_message_to_client&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;client&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; msg&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;resolve&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; msg_chan &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;MessageChannel&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		msg_chan&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;port1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token function&quot;&gt;reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		client&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;msg&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;msg_chan&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;port2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;send_message_to_all_clients&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;matchAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;clients&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		clients&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;client&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token function&quot;&gt;send_message_to_client&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;client&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; msg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;SW Received Message: &quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;m&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here, we first import the promise-based keyval store we also used in the enhanced.js to handle IndexedDB. Next, we define a const for the cache version and add functions to handle the install (add assets to cache), fetch (handle requests) and activation events. The relevant part starts with the sync version. Here, we first check if the tag is “form-post”, as it is the one we registered before in enhanced.js with &lt;code&gt;swRegistration.sync.register(&#39;form-post&#39;)&lt;/code&gt;. If the tag matches, we call &lt;code&gt;event.waitUntil(postComment());&lt;/code&gt;. This means that postComment will be executed as soon as there is an usable connection.&lt;/p&gt;
&lt;p&gt;In our postComment function we define a new FormData and append the values for the name and comment which we get from IndexedDB. Next we use fetch to save the comment. When the comment was posted we will send a message back to the page to show an success/error message.&lt;/p&gt;
&lt;p&gt;With that in place, the comment will now always be posted. If you are online it will be send straight away and if you are offline it will send as soon as you have an usable connection again, even if you already closed the page with the form.&lt;/p&gt;
&lt;p&gt;Here is the &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v7/&quot;&gt;demo&lt;/a&gt; of the EnhancedEnhanced™ version.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you want to test the offline functionality of the final version, please be aware that there is currently a &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/detail?id=625798&quot;&gt;bug&lt;/a&gt; in Chrome and using the “offline mode” in DevTools doesn’t work. You have to really go offline to test it.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you can see there are many ways to enhance a form and there are various other possible enhancements I didn’t mention. There are many ways to enhance it with CSS, which I didn’t mention at all here, but also many more ways to enhance via JavaScript. The great thing is, by using progressive enhancement *every* browser is supported. Some get a better experience than others, but all are able to perform the task of posting a comment.&lt;/p&gt;
&lt;p&gt;Only a few people will get the EnhancedEnhanced™ version, but under certain circumstances every single of them may only get the basic version.&lt;/p&gt;
&lt;p&gt;Here is the final &lt;a href=&quot;https://justmarkup.github.io/demos/form-enhancement/v7/&quot;&gt;demo&lt;/a&gt; of the EnhancedEnhanced™ version.&lt;/p&gt;
&lt;p&gt;If you have any improvements or found a bug in the code please open an &lt;a href=&quot;https://github.com/justmarkup/demos/issues&quot;&gt;issue on Github&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Ways To Reduce Content Shifting On Page Load – article for Smashing Magazine</title>
							<link>https://justmarkup.com/log/2016/08/ways-to-reduce-content-shifting-on-page-load-article-for-smashing-magazine/</link>
							<pubDate>2016-08-29T13:00:06+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/08/ways-to-reduce-content-shifting-on-page-load-article-for-smashing-magazine/</guid>
							<description>&lt;p&gt;My first article on Smashing Magazine got published 🙂&lt;/p&gt;
&lt;p&gt;Read the original article on &lt;a href=&quot;https://www.smashingmagazine.com/2016/08/ways-to-reduce-content-shifting-on-page-load/&quot;&gt;Smashing Magazine&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Progressive enhancement all the things</title>
							<link>https://justmarkup.com/log/2016/08/progressive-enhancement-all-the-things/</link>
							<pubDate>2016-08-23T13:49:13+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/08/progressive-enhancement-all-the-things/</guid>
							<description>&lt;p&gt;I am currently working on a project where I have to build an interactive graph to accompany some content (text, images). I made sure it is accessible, but what if the JavaScript fails (an error in our JavaScript, connection timeout or because of &lt;a href=&quot;http://kryogenix.org/code/browser/everyonehasjs.html&quot;&gt;another reason&lt;/a&gt;? For the last few days I wondered if I should make the content of the graph somehow available if the JavaScript fails or if the graph is not part of the core content and therefore an enhancement.&lt;/p&gt;
&lt;h2 id=&quot;what-is-the-core-part-of-my-page%3F&quot;&gt;What is the core part of my page? &lt;a class=&quot;permalink&quot; href=&quot;#what-is-the-core-part-of-my-page%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this case we decided that the graph is not part of the core content and can fail in certain cases. More precisely, we decided to show the graph only if the browser is capable of doing so (Opera Mini and other proxy browsers are not) and also to hide it if the &lt;a href=&quot;https://www.filamentgroup.com/lab/enhancing-optimistically.html&quot;&gt;JavaScript fails&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Today, the client came back to us and decided that this graphs should also be available via an extra page where only the graphs are shown. Great, now the enhancement is clearly the core.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When a user opens your site and sees nothing, you either have no content or you are doing it wrong. Apart from that, it is not always easy to decide which parts are an enhancement and which parts belong to the core of a site.&lt;/p&gt;
&lt;p&gt;What I like to do is removing all the enhancements and see if the site still makes sense and is usable. If not, the enhancement should be part of the core experience.&lt;/p&gt;
&lt;p&gt;How do you decide if something is an enhancement or part of the core experience?&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Indicating offline</title>
							<link>https://justmarkup.com/log/2016/08/indicating-offline/</link>
							<pubDate>2016-08-18T05:25:25+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/08/indicating-offline/</guid>
							<description>&lt;p&gt;Developers have been able to make a site available for offline usage for some years using &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache&quot;&gt;Application Cache&lt;/a&gt;, but it has some &lt;a href=&quot;http://alistapart.com/article/application-cache-is-a-douchebag&quot;&gt;downsides&lt;/a&gt; and hasn’t been really popular.&lt;/p&gt;
&lt;p&gt;With the raise of &lt;a href=&quot;https://developers.google.com/web/progressive-web-apps/&quot;&gt;Progressive Web Apps&lt;/a&gt;, and more and more sites using, and browser implementing &lt;a href=&quot;https://www.w3.org/TR/service-workers/&quot;&gt;Service Workers&lt;/a&gt; we will see a lot of sites being “ready for offline” in the upcoming months and years.&lt;/p&gt;
&lt;p&gt;Many users don’t know that websites can also work offline like native Apps. If a user doesn’t have an internet connection they assume a website won’t work and that’s why I think it is important to indicate that the site/app will work offline and also which parts are only usable when online.&lt;/p&gt;
&lt;h2 id=&quot;tell-the-user-that-the-site-works-offline&quot;&gt;Tell the user that the site works offline &lt;a class=&quot;permalink&quot; href=&quot;#tell-the-user-that-the-site-works-offline&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When a user visits your site for the first time, and you have implemented a Service Worker to make it “offline-ready” we can show the user a message saying that “The site is ready to work offline”.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/08/Bildschirmfoto-vom-2016-08-16-182733.png&quot; alt=&quot;Ready to work offline message&quot;&gt;&lt;/p&gt;
&lt;p&gt;Ready to work offline message (Screenshot from &lt;a href=&quot;https://jakearchibald.github.io/svgomg/&quot;&gt;SVGOMG&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;To do this, we listen to the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange&quot;&gt;statechange&lt;/a&gt; event and if the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state&quot;&gt;ServiceWorker.state&lt;/a&gt; is &lt;code&gt;activated&lt;/code&gt; show the message. This way the message will only be shown on first registration and we don’t annoy users with showing it on every page load.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;sw.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;registration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Registration was successful&lt;/span&gt;&lt;br&gt;    &lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; newWorker &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; registration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;installing&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// statechange fires every time the ServiceWorker.state changes&lt;/span&gt;&lt;br&gt;    newWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onstatechange&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token comment&quot;&gt;// show the message on activation&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;state &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;activated&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;controller&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.offline-ready&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;active&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// registration failed :(&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the future users may expect a site to work offline after visiting again, but until this happens, I think it is a good idea to let the users know about this feature.&lt;/p&gt;
&lt;h2 id=&quot;tell-users-that-they-are-offline%2Fonline&quot;&gt;Tell users that they are offline/online &lt;a class=&quot;permalink&quot; href=&quot;#tell-users-that-they-are-offline%2Fonline&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some things, like every network request for new stuff, will never work when offline.&lt;/p&gt;
&lt;p&gt;We can use &lt;a href=&quot;https://developer.mozilla.org/en/docs/Online_and_offline_events&quot;&gt;online and offline events&lt;/a&gt; to indicate to a user that they are currently offline or online again.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;load&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;updateOnlineStatus&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; condition &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onLine &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Live&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Currently offline&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.connection&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; condition&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;  window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;online&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  updateOnlineStatus&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;offline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; updateOnlineStatus&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s say we have a live ticker which gets updated automatically when new content arrives. If the user is online, we can show “Live” to indicate that new content will be shown automatically. If the user is offline on the other hand we can show the message “Currently offline” to point out that the live ticker won’t update until the user is online again.&lt;/p&gt;
&lt;h2 id=&quot;grey-out-things-not-available-offline&quot;&gt;Grey-out things not available offline &lt;a class=&quot;permalink&quot; href=&quot;#grey-out-things-not-available-offline&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some areas of a site/app won’t work when a user is offline because we don’t have a cached version yet. To find out which parts are already cached we can use the &lt;a href=&quot;https://davidwalsh.name/cache&quot;&gt;Cache API&lt;/a&gt;, which is available in Web Workers, Window and Service Workers in &lt;a href=&quot;https://nolanlawson.github.io/html5workertest/&quot;&gt;supported Browers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/08/Grey-out-non-cached-elements.png&quot; alt=&quot;Screenshot showing a list of latest articles whil offline where all expect for the first two already cached links are greyed-out&quot;&gt;&lt;/p&gt;
&lt;p&gt;First, we register a Service Worker if it is supported.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;service-worker.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we switch to our &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/indicating-offline/service-worker.js&quot;&gt;service-worker.js&lt;/a&gt;. I am using the &lt;a href=&quot;https://github.com/GoogleChrome/sw-toolbox&quot;&gt;sw-toolbox&lt;/a&gt; here. If the request contains “article-” we store the response in the cache with the name “articles” which we later can use in our window.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// match every request ending with download&lt;/span&gt;&lt;br&gt;global&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;toolbox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;router&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;article-&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; global&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;toolbox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;cacheFirst&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// Use a dedicated cache for the responses, separate from the default cache.&lt;/span&gt;&lt;br&gt;  cache&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    name&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;articles&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Store up to 10 articles in that cache.&lt;/span&gt;&lt;br&gt;    maxEntries&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Back to our main site, where we first check if the cache API is supported. If it does, we loop over each link on our site and if the value of the href is present in the cache with the name “articles” we add the class “available-offline” to the link.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// check if the cache API is supported&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;caches&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// forEach for NodeList&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token class-name&quot;&gt;NodeList&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;prototype&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;forEach &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;prototype&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;forEach&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// loop over each link and add class &quot;available-offline&quot; if src is already in cache&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; downloadLinks &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    caches&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;articles&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;      cache&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;href&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;matchedResponse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;matchedResponse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;          el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;available-offline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;	&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we add EventListener for the online/offline events to add/remove the class “is-offline” to our &lt;code&gt;html&lt;/code&gt; element and also add the hint Offline/Online for our users.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// add &quot;is-offline&quot; class to the html element if user is offline and remove when online again&lt;/span&gt;&lt;br&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;load&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;updateOnlineStatus&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onLine&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is-offline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.connection-status&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Online&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is-offline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.connection-status&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Offline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;  window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;online&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  updateOnlineStatus&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;offline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; updateOnlineStatus&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we add some styles. If the user if offline and the class “is-offline” is present at the &lt;code&gt;html&lt;/code&gt; element we grey-out all links expect for the links we already have cached and which we gave the class “available-offline” in the code part above. We will also remove the pointer cursor and add a default one for all links not working offline to give users one more hint that these links will not load as expected.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.is-offline a&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; grey&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; default&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.is-offline .available-offline&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; black&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; pointer&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to try it yourself, here is a &lt;a href=&quot;https://justmarkup.github.io/demos/indicating-offline/&quot;&gt;demo&lt;/a&gt; and the code is on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/indicating-offline&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I think we still have a long way to go until “offline-ready” won’t be a feature, but the standard way of serving websites. And it will take time to educate users that websites can work offline like native Apps. Someday, users may assume that a website works offline on repeated visits and you don’t want to have one of the websites not ready, so it is a good idea get yourself comfortable with Service Workers and the cache API.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Progressive web apps – let’s not repeat the errors from the beginning of responsive web design</title>
							<link>https://justmarkup.com/log/2016/06/progressive-web-apps-lets-not-repeat-the-errors-from-the-beginning-of-responsive-web-design/</link>
							<pubDate>2016-06-07T03:51:41+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/06/progressive-web-apps-lets-not-repeat-the-errors-from-the-beginning-of-responsive-web-design/</guid>
							<description>&lt;p&gt;6 years ago, &lt;a href=&quot;https://twitter.com/beep&quot;&gt;Ethan Marcotte&lt;/a&gt; published the article &lt;a href=&quot;http://alistapart.com/article/responsive-web-design&quot;&gt;Responsive Web Design&lt;/a&gt;. It was a new concept, it was exciting, we all needed to learn how to adapt responsive design for our sites, we all made a lot of mistakes by doing so and are still learning.&lt;/p&gt;
&lt;p&gt;Now, in 2016, there is a new term – &lt;a href=&quot;https://infrequently.org/2015/06/progressive-apps-escaping-tabs-without-losing-our-soul/&quot;&gt;Progressive Web Apps (PWA)&lt;/a&gt; – a “umbrella” term for responsive, connectivity independent, fresh, safe, discoverable, re-engageable, installable, linkable Apps/web sites with app-like interactions. Once again, we all need to learn how to integrate the concept of PWA’s, we need to find out what makes sense for our sites and we need to &lt;a href=&quot;https://trib.tv/2016/06/05/progressively-less-progressive/&quot;&gt;discuss&lt;/a&gt; and &lt;a href=&quot;https://infrequently.org/2016/06/pwa-discovery-you-aint-seen-nothin-yet/&quot;&gt;exchange&lt;/a&gt; a lot – we need to avoid the errors we made at the beginning of responsive web design.&lt;/p&gt;
&lt;h3 id=&quot;iphone.css&quot;&gt;iphone.css &lt;a class=&quot;permalink&quot; href=&quot;#iphone.css&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When people learned about responsive design, there were many wrong assumptions. The iPhone and early Android phones *all* had the same screen size (320x480px) and people thought it is a good idea to change the design based on these device-specific sizes. Some even named the css iphone.css :-(.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;only&lt;/span&gt; screen &lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-device-width&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 320px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-device-width&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 480px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;orientation&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; portrait&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* Styles for iPhone in portrait mode */&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I never want to see that again. Device specific CSS, for i*-only. A nightmare nobody should wake up to anymore.&lt;/p&gt;
&lt;h3 id=&quot;beyond-responsive&quot;&gt;Beyond Responsive &lt;a class=&quot;permalink&quot; href=&quot;#beyond-responsive&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After my first experience with responsive design, I realized that designing and programming for specific devices is a No-Go. None of my first attempts made it into a production-ready site, but many others did. Nowadays, most people use mobile-first and add a media query if the design “breaks”. Great.&lt;/p&gt;
&lt;p&gt;If I think about responsive now, it means much more than media queries and flexible content. While working on responsive sites my awareness for accessibility, performance, content and people increased more and more. I realized that a responsive web site is useless if you forget about accessibility and performance. I prefer a fast and accessible site which doesn’t adapt the design to screen sizes over an overloaded, inaccessible, responsive web site every time.&lt;/p&gt;
&lt;p&gt;The same goes for Service Worker, while I first thought it is only about offline, I realized it is a lot more about performance and a way to make sites more accessible and better usable.&lt;/p&gt;
&lt;h3 id=&quot;be-progressive-%E2%80%93-not-only-name-it-progressive&quot;&gt;Be progressive – not only name it progressive &lt;a class=&quot;permalink&quot; href=&quot;#be-progressive-%E2%80%93-not-only-name-it-progressive&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A progressive web app – being responsive, connectivity independent, fresh, safe, discoverable, re-engageable, installable, linkable Apps (basically web sites) with app-like interactions is fantastic, but there is one word in there we should never forget; Progressive.&lt;/p&gt;
&lt;p&gt;I understand that it is hard to sell progressive enhancement, so I think naming them Progressive Web Apps is great. My hope is that many more people will make progressive web sites. That clients will say: “Can you please make our site progressive”. That progressive enhancement is not only a term anymore, but the way everybody wants their site to be.&lt;/p&gt;
&lt;h3 id=&quot;progressive-web-apps-are-an-opportunity&quot;&gt;Progressive web apps are an opportunity &lt;a class=&quot;permalink&quot; href=&quot;#progressive-web-apps-are-an-opportunity&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We are still at the beginning of learning about the best ways to build Progressive Web Apps. I hope it will make many more people aware of progressive enhancement. I hope that nobody makes the error again and concentrates on the device part. Responsive design changed my way of building sites, I now think a lot more about the content, a lot more about accessibility, a lot more about performance and a lot more about people. I hope building PWAs will make a lot more people aware of the “basics” of the web.&lt;/p&gt;
&lt;p&gt;Let’s not make the same errors again. A PWA which only works for specific devices is wrong. Let’s build Progressive Web Apps where we concentrate on the progressive part and not on the app part.&lt;/p&gt;
&lt;h3 id=&quot;further-reading&quot;&gt;Further reading &lt;a class=&quot;permalink&quot; href=&quot;#further-reading&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://infrequently.org/2015/06/progressive-apps-escaping-tabs-without-losing-our-soul/&quot;&gt;Progressive apps escaping tags without losing our soul&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/slightlylate&quot;&gt;Alex Russell&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://trib.tv/2016/06/05/progressively-less-progressive/&quot;&gt;Progressively less progressive&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/triblondon&quot;&gt;Andrew Betts&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://adactio.com/journal/10708&quot;&gt;Regressive Web Apps&lt;/a&gt; and the follow-up &lt;a href=&quot;https://adactio.com/journal/10736&quot;&gt;Regression toward being mean&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/adactio&quot;&gt;Jeremy Keith&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.kryogenix.org/days/2016/06/02/programmatic-progressiveness/&quot;&gt;Programmatic progressiveness&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/sil&quot;&gt;Stuart Langridge&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://soledadpenades.com/2016/06/06/the-p-word/&quot;&gt;The P-word&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/supersole&quot;&gt;Soledad Penadés&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://infrequently.org/2016/06/pwa-discovery-you-aint-seen-nothin-yet/&quot;&gt;PWA Discovery: You Ain’t Seen Nothin Yet&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/slightlylate&quot;&gt;Alex Russell&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Google to reward sites with service worker (offline ready) in search rankings</title>
							<link>https://justmarkup.com/log/2016/04/google-to-reward-sites-with-service-worker-offline-ready-in-search-rankings/</link>
							<pubDate>2016-04-22T09:29:35+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/04/google-to-reward-sites-with-service-worker-offline-ready-in-search-rankings/</guid>
							<description>&lt;p&gt;While this headline is not true now (April 2016) it may be a headline of the near future. This morning one of my clients asked for switching to https for their site. I tried to convince many clients, including this one, over the last years to use https for all their sites saying that it will prevent many security and privacy issues, users will have more trust in a https site and so on; They didn’t really care. At least not until Google announced to &lt;a href=&quot;http://www.forbes.com/sites/larrymagid/2014/08/07/google-to-reward-sites-with-http-security-in-search-rankings/&quot;&gt;reward sites with https in search rankings&lt;/a&gt;. From that moment they all wanted https and they also didn’t care how much it would cost them anymore.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Interesting but also sad to see that many web site owner only switch to https because they heard Google will prioritize them in search.&lt;/p&gt;
&lt;p&gt;— Michael Scharnagl (@justmarkup) &lt;a href=&quot;https://twitter.com/justmarkup/status/723398001641684993&quot;&gt;April 22, 2016&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;seo%2C-seo%2C-seo%2C-seo&quot;&gt;SEO, SEO, SEO, SEO &lt;a class=&quot;permalink&quot; href=&quot;#seo%2C-seo%2C-seo%2C-seo&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I have many clients who tell me regularly that they got a call or even visit from a “SEO Expert” who tries to sell them something so their sites will get a better Google ranking. Most of the advices they want to sell them are completely irrelevant (Use exactly 12 keywords per site) or even very bad (eg. Don’t use more than 3 headlines per site). Aside from that, whenever Google announces to reward sites using a specific technology they say them they have to use this technology now or they will get a worse ranking.&lt;/p&gt;
&lt;p&gt;This happened when Google announced to reward mobile-friendly (responsive) sites, this happens now as Google rewards sites using https and it will happen in the future with other technologies like service workers.&lt;/p&gt;
&lt;p&gt;And, this makes me a bit sad.&lt;/p&gt;
&lt;p&gt;All of these website owners don’t care about the user, all they care about is a top rank in the search results. They don’t care if users are surfing the web on different devices and want to have a great experience with the site on all of them, they don’t care about security or privacy, they don’t care about performance or making the site “offline-ready”. You can tell them all the time about the benefits of a responsive website, about a secure website; They don’t care. However, they care immediately when this will affect their page rank.&lt;/p&gt;
&lt;h2 id=&quot;the-power-of-google&quot;&gt;The power of Google &lt;a class=&quot;permalink&quot; href=&quot;#the-power-of-google&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Google, as a search engine has a lot of power. In Germany more than 90% are using Google search and every web site owner wants to be on top of the search results. If tomorrow, Google would announce that they will reward all sites passing an accessibility check, all the “SEO experts” will throw away their old advices and will tell clients, to make this and this, to make it pass the accessibility test. All the site owners will call their web master (or Web Ninja or whatever the cool kids say today) and tell them their site has to pass the test.&lt;/p&gt;
&lt;p&gt;Even if the clients don’t ask for it I try to make every site as much accessible as possible – I would feel bad otherwise. Many other don’t feel bad obviously and that’s why we have a lot of inaccessible sites – if Google would penalize these sites we would probably have a lot more accessible sites.&lt;/p&gt;
&lt;p&gt;So, yes I think, Google will reward sites using service worker in the near future as they really want to push progressive web apps and “offline-ready” sites and with rewarding such sites, many many sites will do so.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Add to homescreen and the app banner</title>
							<link>https://justmarkup.com/log/2016/04/add-to-homescreen-and-the-app-banner/</link>
							<pubDate>2016-04-09T11:44:42+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/04/add-to-homescreen-and-the-app-banner/</guid>
							<description>&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Some of the information in this article is outdated, for latest info see this article on &lt;a href=&quot;https://developers.google.com/web/fundamentals/engage-and-retain/app-install-banners/?hl=en&quot;&gt;developers.google.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Last week I wrote about &lt;a href=&quot;https://justmarkup.com/log/2016/04/discoverability-or-progressive-web-apps/&quot;&gt;discoverability of progressive web apps&lt;/a&gt; and as part of this I also thought about current ways a site gets promoted as an app by browsers.&lt;/p&gt;
&lt;p&gt;In Chrome for Android there will be shown an app banner for your site to engage users to add the site to the homescreen. The app banner will only be shown if the site meets certain requirements and if a user visits the site regularly, where regularly (at the moment) means at least two visits with five minutes apart. (Note: The time frame already changed over time and may change again)&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/04/Screenshot_20160409-141309.png&quot; alt=&quot;Add to homescreen app banner on Chrome for Android&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;requirements&quot;&gt;Requirements &lt;a class=&quot;permalink&quot; href=&quot;#requirements&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To get the app banner with the “Add to homescreen” dialog for your site it needs to meet some criteria. The site needs a valid manifest, a service worker and the site has to be served over https.&lt;/p&gt;
&lt;h3 id=&quot;manifest&quot;&gt;Manifest &lt;a class=&quot;permalink&quot; href=&quot;#manifest&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First you need a valid manifest for your site. To integrate the manifest you need to link to it via a meta tag with the attribute manifest:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;manifest&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/manifest.json&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is an example of a manifest:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;short_name&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Short Name&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;The long name of the app&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;start_url&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;icons&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/images/icon-128x128.png&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;sizes&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;192x192&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;image/png&quot;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/images/icon-192x192.png&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;sizes&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;192x192&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;image/png&quot;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;  &lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/images/icon-256x256.png&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  &lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;sizes&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;256x256&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  &lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;image/png&quot;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/images/icon-384x384.png&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;sizes&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;384x384&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;image/png&quot;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/images/icon-512x512.png&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;sizes&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;512x512&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;      &lt;span class=&quot;token property&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;image/png&quot;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;background_color&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;#FFFFFF&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;theme_color&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;#AA0F0F&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;display&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;standalone&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;orientation&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;portrait&quot;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From some testing it seems you need at least an icon with 192×192 to get the app banner, but I would suggest to also add at least the 384×384 and 512×512 icons.&lt;/p&gt;
&lt;p&gt;128dp at 1x (160dpi) = 128px&lt;br&gt;
128dp at 1.5x (240dpi) = 192px&lt;br&gt;
128dp at 2x (320dpi) = 256px&lt;br&gt;
128dp at 3x (480dpi) = 384px&lt;br&gt;
128dp at 4x (640dpi) = 512px&lt;/p&gt;
&lt;p&gt;* dp = density-independent pixels and dpi = pixels per inch&lt;/p&gt;
&lt;p&gt;Read more about the ideal sizes on &lt;a href=&quot;https://developers.google.com/web/updates/2015/10/splashscreen&quot;&gt;developers.google.com/&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;service-worker&quot;&gt;Service Worker &lt;a class=&quot;permalink&quot; href=&quot;#service-worker&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You also need a &lt;a href=&quot;https://github.com/slightlyoff/ServiceWorker&quot;&gt;Service Worker&lt;/a&gt; to get the app banner. As Service Worker also requires TLS your site also needs to be served over https, which it should anyway.&lt;/p&gt;
&lt;h2 id=&quot;testing&quot;&gt;Testing &lt;a class=&quot;permalink&quot; href=&quot;#testing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To test “Add to homescreen” open Chrome and Devtools. Next activate the Device Mode (Ctrl + Shift + M) and open the menu on the top right of the screen. Click “Request app banner…” and you will get a dialog to add the site to the shelf (Desktop). If you don’t get the prompt have a look in the console. For example, if the icon is not suited you will get the following message: “App banner not shown: manifest does not contain a suitable icon – PNG format of at least 144x144px is required, and the sizes attribute must be set”.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/04/Bildschirmfoto-vom-2016-04-09-142551.png&quot; alt=&quot;Chrome Devtools Device Mode with settings menu open&quot;&gt;&lt;/p&gt;
&lt;p&gt;If you don’t see the “Request app banner…” entry, try the following:&lt;/p&gt;
&lt;p&gt;* Update Chrome to the latest version&lt;br&gt;
* Enable the flag for “Devtools Experiments” chrome://flags/#enable-devtools-experiments and restart Chrome&lt;br&gt;
* Enable the option “App banner support” in Devtools -&amp;gt; Settings -&amp;gt; Experiments (If you don’t see it, press Shift six times there to get all experiments)&lt;br&gt;
* Enable the flag for “Add to shelf” chrome://flags/#enable-add-to-shelf&lt;/p&gt;
&lt;p&gt;There is also a &lt;a href=&quot;https://manifest-validator.appspot.com/&quot;&gt;Manifest Validator&lt;/a&gt; to test your Manifest and find potential errors.&lt;/p&gt;
&lt;h2 id=&quot;show-app-banner&quot;&gt;Show app banner &lt;a class=&quot;permalink&quot; href=&quot;#show-app-banner&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the most asked question is if it is possible to show the app banner on user interaction. In short, NO. The long answer is that it is and will probably never be possible, mainly because of the fear of abuse. You may all remember the pop-ups we saw on iOS and also Android to show users how to add the site to the home screen. This can be really annoying and therefore browser vendors try their best to only show the app banner if a user is likely to visit the site again and therefore has the need for an extra icon on the homescreen.&lt;/p&gt;
&lt;p&gt;I also would like to have the option to trigger the app banner on user interaction, but I fully understand that this would lead to every site doing it. After some time, most users will be annoyed by all the prompts and will think only negatively about app banner. That’s why we better leave it to the browser when to show the app banner.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/04/add2home-screen.jpeg&quot; alt=&quot;Add to homescreen pop-up on iPhone&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If your site meets all the requirements and a user visits your site regularly you will get the automatically shown app banner. As far as I know the app banner is only shown on Chrome for Android at the moment (April 2016) but I am sure other browsers will add something similar in the future. If you build a progressive web app be sure to test if you meet all the criteria.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Discoverability of progressive web apps</title>
							<link>https://justmarkup.com/log/2016/04/discoverability-of-progressive-web-apps/</link>
							<pubDate>2016-04-05T13:27:52+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/04/discoverability-of-progressive-web-apps/</guid>
							<description>&lt;p&gt;&lt;a href=&quot;https://twitter.com/justmarkup/status/717350691078029312&quot;&gt;Today&lt;/a&gt; I was curious to find out if there is a photo editor I could use in my browser. My requirements are that it should work offline, be responsive and progressive – so basically a &lt;a href=&quot;https://developers.google.com/web/progressive-web-apps?hl=en&quot;&gt;progressive web app (pwa)&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;404-%E2%80%93-not-found&quot;&gt;404 – not found &lt;a class=&quot;permalink&quot; href=&quot;#404-%E2%80%93-not-found&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;My first try was to google for “photo editor web app” but none of the “apps” shown there met my requirements. Next, I tried to change the keywords to get a result, but after 372332 a lot of attempts I figured out that either there is no such web app or I miss anything. At that point I wanted to give up when I discovered the “Apps tab” hidden under “More” – I had hope for a moment to have found a way until I saw that there are only “native apps” listed.&lt;/p&gt;
&lt;p&gt;Next, I remembered that there are &lt;a href=&quot;https://operasoftware.github.io/pwa-list/&quot;&gt;sites&lt;/a&gt; which list &lt;a href=&quot;http://mobilewebappsftw.tumblr.com/&quot;&gt;web apps&lt;/a&gt;. While I like to surf on these sites and see what great web apps are available it doesn’t really help if you search for an app for something specific. Also, at the moment there are only a few progressive web apps, but what if there are millions of them next year – nobody will be able to keep such a site up-to-date.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://http.cat/404&quot; alt=&quot;cat covered in wrapping paper&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;search-engines%2C-please!&quot;&gt;Search engines, please! &lt;a class=&quot;permalink&quot; href=&quot;#search-engines%2C-please!&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I don’t know a lot about how search engines index web pages, but it shouldn’t be that hard to check if the web page has a &lt;a href=&quot;https://www.w3.org/TR/appmanifest/&quot;&gt;manifest&lt;/a&gt;, runs over HTTPS, uses a &lt;a href=&quot;https://serviceworke.rs/&quot;&gt;service worker&lt;/a&gt; (checking for offline may be harder) and tag the page as “progressive web app”.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/04/Bildschirmfoto-vom-2016-04-05-164857.png&quot; alt=&quot;Screenshot of google.com searching for photo editor&quot;&gt;&lt;/p&gt;
&lt;p&gt;This image shows a screenshot of the google search, after searching for “photo editor” and switching to the “Apps” tab. Now, imagine if a web page was tagged as “pwa” it would be shown there – this would solve the discoverability. Furthermore, there is already a filter to search for OS, Google could easily add Web here to filter only progressive web apps.&lt;/p&gt;
&lt;p&gt;I talked about the Google search engine here the whole time, but this could be the same for every search engine, be it Bing, DuckDuckGo or Yahoo!. This way we don’t need a centralized site/store but the user can decide which way they prefer to search.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> CSS containment</title>
							<link>https://justmarkup.com/log/2016/04/css-containment/</link>
							<pubDate>2016-04-05T08:04:11+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/04/css-containment/</guid>
							<description>&lt;p&gt;I haven’t heard about the &lt;a href=&quot;https://drafts.csswg.org/css-containment-3/&quot;&gt;contain property&lt;/a&gt; until some weeks ago when I asked about &lt;a href=&quot;https://justmarkup.com/log/2016/02/use-cases-for-container-queries/&quot;&gt;use cases for container queries&lt;/a&gt; on twitter and &lt;a href=&quot;http://dbaron.org/&quot;&gt;David Baron&lt;/a&gt; mentioned it in a &lt;a href=&quot;https://twitter.com/davidbaron/status/700417133251932160&quot;&gt;response&lt;/a&gt; saying that &lt;code&gt;contain: strict;&lt;/code&gt; can avoid many of the theoretical problems of container queries. Since then I read the specification and everything I found about it trying to understand it; Here is what I learned.&lt;/p&gt;
&lt;h2 id=&quot;the-contain-property&quot;&gt;The contain property &lt;a class=&quot;permalink&quot; href=&quot;#the-contain-property&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It’s a primitive for isolating style, layout, and paint. The contain property allows developers to limit a specific DOM sub-tree and the rest of the document; You can think of it like an iframe. Much like an iframe, this boundary establishes a new layout root, ensuring that DOM changes in the sub-tree never trigger reflows in the parent document.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The contain property allows an author to indicate that an element and its contents are, as much as possible, independent of the rest of the document tree.&lt;/p&gt;
&lt;p&gt;— &lt;a href=&quot;https://drafts.csswg.org/css-containment-3/#contain-property&quot;&gt;From the W3C Specification&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;none-%7C-strict-%7C-layout-%7C-style-%7C-paint-%7C-size-%7C-contain&quot;&gt;none | strict | layout | style | paint | size | contain &lt;a class=&quot;permalink&quot; href=&quot;#none-%7C-strict-%7C-layout-%7C-style-%7C-paint-%7C-size-%7C-contain&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are seven different values for the contain property.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;none&lt;/strong&gt; no effect&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;layout&lt;/strong&gt; turns on layout containment&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;style&lt;/strong&gt; turns on style containment&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;paint&lt;/strong&gt; turns on paint containment&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; turns on size containment&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;content&lt;/strong&gt; all, except size containment&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;strict&lt;/strong&gt; layout, style and paint combined&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;use-cases&quot;&gt;Use cases &lt;a class=&quot;permalink&quot; href=&quot;#use-cases&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So far we know that by using CSS containment we can isolate elements from the rest of the document to mark them as independent parts. To show you where this can be helpful here are some use cases:&lt;/p&gt;
&lt;h3 id=&quot;widgets&quot;&gt;Widgets &lt;a class=&quot;permalink&quot; href=&quot;#widgets&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When integrating third-party widgets you mostly don’t have much control and they can decrease the site performance dramatically by doing expensive layout, style or paint operations. To make them independent from our site we can set &lt;code&gt;contain: strict;&lt;/code&gt; for the most outer element of the third-party widget. This way, they won’t affect the performance of all the other parts of the page.&lt;/p&gt;
&lt;h3 id=&quot;off-screen&quot;&gt;Off-Screen &lt;a class=&quot;permalink&quot; href=&quot;#off-screen&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you build a off-screen navigation or similar, the browser paints the content completely although it is not visible on load. By setting &lt;code&gt;contain: paint;&lt;/code&gt; the user agent can skip the paint off the off-screen element and therefore paint all the other content faster.&lt;/p&gt;
&lt;h2 id=&quot;container-queries&quot;&gt;Container queries &lt;a class=&quot;permalink&quot; href=&quot;#container-queries&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As I already mentioned in the beginning, &lt;code&gt;contain: strict;&lt;/code&gt; can &lt;a href=&quot;https://github.com/ResponsiveImagesCG/container-queries/issues/3#issuecomment-185951645&quot;&gt;avoid many of the problems&lt;/a&gt; of container queries. One of the “problems” of container queries is that the children and their content can have an effect on the size of the container. This can be avoided by using CSS containment.&lt;/p&gt;
&lt;h2 id=&quot;why-can%E2%80%99t-the-browser-do-it-automatically&quot;&gt;Why can’t the browser do it automatically &lt;a class=&quot;permalink&quot; href=&quot;#why-can%E2%80%99t-the-browser-do-it-automatically&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Browser engines already make a lot of optimization under the hood when possible, but each engine has its differences. Using containment provides a standard way for applications to indicate to the &lt;a href=&quot;https://www.w3.org/TR/UAAG20/#def-user-agent&quot;&gt;user agent&lt;/a&gt; that it can optimize certain layout cases, which browser would otherwise not be able to optimize.&lt;/p&gt;
&lt;h2 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you build simple sites without tons of DOM nodes and widgets you probably don’t have to care about CSS containment. On the other hand, if you build more complex sites CSS containment will help to optimize the performance. It is also a good idea to set &lt;code&gt;contain: strict;&lt;/code&gt; for third-party widgets to protect the performance of your site.&lt;/p&gt;
&lt;p&gt;As always – test, test and test again. And not only test with fast network on a high-end machine, but test with old hardware and slow network. To get an idea how otheres experience your site you can also emulate the network speed and the CPU with Chrome Devtools.&lt;/p&gt;
&lt;p&gt;Note: At the moment (April 2016) it is only supported in &lt;a href=&quot;https://www.chromestatus.com/feature/6522186978295808&quot;&gt;Chrome&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 06.04.2016:&lt;/strong&gt; You need to turn on the flag chrome://flags/#enable-experimental-web-platform-features in Chrome at the moment to test CSS containment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 20.05.2016:&lt;/strong&gt; Now enabled by default in &lt;a href=&quot;https://www.chromestatus.com/feature/6522186978295808&quot;&gt;Chrome 52&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 02.08.2016:&lt;/strong&gt; Added the values “size” and “content” from the last update from the specification&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> On browser support</title>
							<link>https://justmarkup.com/log/2016/03/on-browser-support/</link>
							<pubDate>2016-03-22T09:17:52+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/03/on-browser-support/</guid>
							<description>&lt;p&gt;*Every* time a new platform feature gets announced/implemented it doesn’t take long until people moan about not being able to use it because of the poor browser support. Shortly after people will blame browsers for not implementing the feature right away. Accompanied by complaints that the web sucks, browsers are stupid, specifications are **** and other useless statements. If you want a feature to be implemented in a browser – write about it, explain why you need it, prepare use cases, help finding bugs – be helpful and not another troll.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We can’t use feature X because it is not supported in browser Y. “By too many developers”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For me, a web platform feature falls into one of these categories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#use-as-an-enhancement&quot;&gt;Use as an enhancement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#use-with-fallback&quot;&gt;Use with fallback&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#use-with-polyfill&quot;&gt;Use with polyfill&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#wait&quot;&gt;Wait&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;use-as-an-enhancement&quot;&gt;Use as an enhancement &lt;a class=&quot;permalink&quot; href=&quot;#use-as-an-enhancement&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A lot of new web platform features can be used straightaway when used as an enhancement. CSS transitions, border-radius, box-shadow, @font-face, form validation, Geolocation, Service Worker, new input types, – to name a few – can all be used as an enhancement. Where enhancement means that you don’t need any fallback or polyfill. If the feature is not available, the site still works, but may not look as fancy, or may not offer the “little helper” other users with other browser will see/get; That’s &lt;a href=&quot;http://dowebsitesneedtolookexactlythesameineverybrowser.com/&quot;&gt;totally fine.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;use-with-fallback&quot;&gt;Use with fallback &lt;a class=&quot;permalink&quot; href=&quot;#use-with-fallback&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Other features can be used with a fallback. Be it new CSS color values, SVG or Gradients.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #111&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;hsl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;236&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 4%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;use-with-polyfill&quot;&gt;Use with polyfill &lt;a class=&quot;permalink&quot; href=&quot;#use-with-polyfill&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most of ES5/ES6 can be used with a polyfill. Same for requestAnimationFrame or Drag and Drop. You should however be aware that polyfills can reduce the performance and therefore should not be used extensively.&lt;/p&gt;
&lt;p&gt;For me, this means I rather use a fallback to make it usable and accessible for these users instead of slowing their browsers with massive use of polyfills. For example: For audio or video you could also add a polyfill, although I would recommend using it as an enhancement and provide simple links to the files as a fallback.&lt;/p&gt;
&lt;h2 id=&quot;wait&quot;&gt;Wait &lt;a class=&quot;permalink&quot; href=&quot;#wait&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some features get implemented by one browser before there is a *final* specification or a consent between browser vendors. Sometimes they are only available behind flags or only usable with prefixes. If you can/want to use it as an enhancement you may still use it, but you should be aware that the syntax will probably change in the future or that the feature will be removed after some time.&lt;/p&gt;
&lt;p&gt;Every browser vendor has a &lt;a href=&quot;https://bugspencer.com/&quot;&gt;web platform status page&lt;/a&gt; nowadays where you can see how likely a browser will implement a feature. If all but one browser are very skeptical about a feature you may better wait before implementing the feature.&lt;/p&gt;
&lt;h2 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Today, I am &lt;a href=&quot;https://justmarkup.com/log/2015/07/browser-support/&quot;&gt;defining browser support&lt;/a&gt; for modules and not for the whole page. Just because a browser doesn’t support feature X it doesn’t mean we have to stop people from using our site.&lt;/p&gt;
&lt;p&gt;And, yes I know there are cases where this is hard – if you build a game with WebGL and the browser doesn’t support WebGL you can’t really do anything, but you should still show the intro (what is the game about, a video/screencast about the game…) which is probably in HTML anyway and show a hint for users without WebGL so they can decide if they are willing to switch/update the browser. If you show a *warning” before showing any content users will most probably never come back to your site.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Use cases for container queries</title>
							<link>https://justmarkup.com/log/2016/02/use-cases-for-container-queries/</link>
							<pubDate>2016-02-20T14:40:49+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/02/use-cases-for-container-queries/</guid>
							<description>&lt;p&gt;Container queries – formerly known as element queries – are one of the features I really want to see implemented in &lt;a href=&quot;https://justmarkup.com/log/2015/12/front-end-wishlist-for-2016/&quot;&gt;2016&lt;/a&gt;. That’s why I would like to show some use cases for container queries.&lt;/p&gt;
&lt;p&gt;Note: I use the &lt;a href=&quot;https://github.com/marcj/css-element-queries&quot;&gt;CSS-Element-Queries Polyfill&lt;/a&gt; for all demos here, as it supports only min-width, min-height, max-width and max-height (which the native solution will probably also do) and is pretty well tested. I added links to other &lt;a href=&quot;#cqu&quot;&gt;polyfills&lt;/a&gt; at the end of the article. Also, the syntax used by the polyfill will be different from the final solution.&lt;/p&gt;
&lt;h2 id=&quot;modular-components&quot;&gt;Modular components &lt;a class=&quot;permalink&quot; href=&quot;#modular-components&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;The ideal responsive website is a system of flexible, modular components that can be repurposed to serve in multiple contexts.&lt;br&gt;
&lt;a href=&quot;http://alistapart.com/article/container-queries-once-more-unto-the-breach#section1&quot;&gt;Mat Marquis on A List Apart&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using media queries we need to check a module in very area of the site in different screen sizes and add a breakpoint every time the design *breaks*. By using container queries on the other hand the module is independent from the viewport size and we could define styles and container query breakpoints once based on the container size and reuse it everywhere.&lt;/p&gt;
&lt;h3 id=&quot;login-form&quot;&gt;Login form &lt;a class=&quot;permalink&quot; href=&quot;#login-form&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/Login_form_demo-1024x145.png&quot; alt=&quot;Screenshot showing the different styles of a login form in different areas of a website&quot;&gt;&lt;/p&gt;
&lt;p&gt;Let’s start with a demo of a Login form. This may be used in various areas of a site, be it the header, the sidebar or the main area. In this demo the input fields are among each other on narrow screens and next to each other on bigger (&amp;gt; 600px) screens.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;form[max-width~=&quot;600px&quot;] label,&lt;br&gt;form[max-width~=&quot;600px&quot;] input[type=&quot;submit&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.6em 0 0.2em 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/demos/container-queries/form/&quot;&gt;Demo&lt;/a&gt; and &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/container-queries/form/&quot;&gt;Code&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;product-items&quot;&gt;Product items &lt;a class=&quot;permalink&quot; href=&quot;#product-items&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/Product_items_demo-1024x332.png&quot; alt=&quot;Screenshot showing the different styles of a product item in different areas of a website&quot;&gt;&lt;/p&gt;
&lt;p&gt;Next, we have a list of items – in this case products. On narrow screens they are shown among one another, if the container size is between 600px and 800px they are still among one another, but the image floats and the headline and text are shown alongside and if the container size is bigger than 800px the items are shown next to each other. By using container queries we can use the product list everywhere on our site and only need to define container breakpoints once – using mediaqueries we would have to use new breakpoints for every new context.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.products ul&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;list-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; wrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.products[min-width~=&quot;600px&quot;] img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 2em 2em 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.products[min-width~=&quot;800px&quot;] ul&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; space-between&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.products[min-width~=&quot;800px&quot;] li&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 32%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.products[min-width~=&quot;800px&quot;] li:nth-child(1):nth-last-child(1)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* two items */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.products[min-width~=&quot;800px&quot;] li:nth-child(1):nth-last-child(2),&lt;br&gt;.products[min-width~=&quot;800px&quot;] li:nth-child(2):nth-last-child(1)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 49%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.products[min-width~=&quot;800px&quot;] img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/demos/container-queries/product-items/&quot;&gt;Demo&lt;/a&gt; and &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/container-queries/product-items/&quot;&gt;Code&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;widgets&quot;&gt;Widgets &lt;a class=&quot;permalink&quot; href=&quot;#widgets&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Another use case will be widgets, mostly third-party widgets. Think about advertising, social media buttons and widgets, community widgets (comments, forum) or all sorts of forms. When building a third-party widget you never know in which context the code will be integrated, which makes it pretty hard to deliver a responsive version. With container queries developers will be able to react to the surrounding container and deliver a great looking version in every possible case.&lt;/p&gt;
&lt;h3 id=&quot;third-party-iframe&quot;&gt;Third-party iframe &lt;a class=&quot;permalink&quot; href=&quot;#third-party-iframe&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/Third_party_iframe_demo-1024x199.png&quot; alt=&quot;Screenshot showing the different styles of an third-party iframe widget in different areas of a website&quot;&gt;&lt;/p&gt;
&lt;p&gt;Here is an example of a third-party iframe we use in different parts of our website, in this case once in the main area and once in a sidebar. The developer of the widget here changes the background-color of an element from blue to red for narrow (=&amp;lt; 300px) containers.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; blue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div[max-width~=&quot;300px&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/demos/container-queries/third-party/&quot;&gt;Demo&lt;/a&gt; and &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/container-queries/third-party/&quot;&gt;Code&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;advertisement&quot;&gt;Advertisement &lt;a class=&quot;permalink&quot; href=&quot;#advertisement&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/Ad_demo-1024x95.png&quot; alt=&quot;Screenshot showing the different styles of an ad in different areas of a website&quot;&gt;&lt;/p&gt;
&lt;p&gt;Next is an example of an advertisement, inserted into our page with JavaScript. Within the JavaScript of the ad a stylesheet gets inserted, with some styles for the ads. Using container queries the developer changes the font-size from 1em to 1.4em if the container is bigger than 500px.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.ad&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.ad[min-width~=&quot;500px&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.4em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/demos/container-queries/ad/&quot;&gt;Demo&lt;/a&gt; and &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/container-queries/ad/&quot;&gt;Code&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;responsive-images&quot;&gt;Responsive images &lt;a class=&quot;permalink&quot; href=&quot;#responsive-images&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/Responsive_image-1024x330.png&quot; alt=&quot;Screenshot showing the different sizes based on container size of an responsive image in different areas of a website&quot;&gt;&lt;/p&gt;
&lt;p&gt;Wouldn’t it be great if you could define sizes based on container sizes instead of viewport size, I thought so too, but it seems &lt;a href=&quot;https://twitter.com/justmarkup/status/546609019155382273&quot;&gt;impossible&lt;/a&gt;. &lt;a href=&quot;https://twitter.com/yoavweiss&quot;&gt;Yoav Weiss&lt;/a&gt; told me:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;`sizes` can’t be based on layout info, since it’s needed before. EQ based images would have to suffer some delay.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Which makes sense after thinking about it, the browser don’t know the size of the container until the layout is *ready* and therefore it would take some time until the browser can decide which image should be shown.&lt;/p&gt;
&lt;p&gt;We most likely won’t get container based sizes, but one never knows. So, I made an example nevertheless using the pollyfill to show the benefits.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-responsive-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://lorempixel.com/350/150/sports/350x150/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;350&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://lorempixel.com/700/300/sports/700x300/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;700&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://lorempixel.com/1400/600/sports/1400x600/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/demos/container-queries/image/&quot;&gt;Demo&lt;/a&gt; and &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/container-queries/image/&quot;&gt;Code&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;problems-and-questions&quot;&gt;Problems and Questions &lt;a class=&quot;permalink&quot; href=&quot;#problems-and-questions&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When creating all the demos here I also had the idea for a navigation which items change from among each other to side by side if they all fit in one line. It did this by setting a container breakpoint if the nav is higher than 80px and therefore spreads across two lines. If this is the case, the nav items will all be among one another. Using the pollyfill this worked somehow, meaning you would get the right design onload and if you resize from big to small. But it won’t work when resizing from small to big, as the nav will always be higher than 80px. I don’t really know how this could be solved, but maybe you do – here is the &lt;a href=&quot;https://justmarkup.com/demos/container-queries/nav&quot;&gt;demo&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;Yes, there are a lot of questions to be asked and a lot of &lt;a href=&quot;https://github.com/ResponsiveImagesCG/container-queries/issues/3#issuecomment-185951645&quot;&gt;problems&lt;/a&gt; to be addressed, but I am still very optimistic we will see a first draft of container queries by the end of the year.&lt;/p&gt;
&lt;h2 id=&quot;demos&quot;&gt;Demos &lt;a class=&quot;permalink&quot; href=&quot;#demos&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here is a list of all &lt;a href=&quot;https://justmarkup.com/demos/container-queries/index.html&quot;&gt;demos&lt;/a&gt;, also available on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/gh-pages/container-queries/&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;further-reading&quot;&gt;Further reading &lt;a class=&quot;permalink&quot; href=&quot;#further-reading&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://responsiveimagescg.github.io/cq-usecases/&quot;&gt;Use Cases and Requirements for Element Queries (Editor’s Draft)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://drafts.csswg.org/css-containment/#contain-property&quot;&gt;CSS Containment Module Level 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.xanthir.com/b4VG0&quot;&gt;2014 State of Element Queries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://24ways.org/2015/being-responsive-to-the-small-things/&quot;&gt;Being responsive to the small things&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://alistapart.com/article/container-queries-once-more-unto-the-breach&quot;&gt;Container Queries: Once More Unto the Breach&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;pollyfills-(incomplete-list)&quot;&gt;Pollyfills (incomplete list) &lt;a class=&quot;permalink&quot; href=&quot;#pollyfills-(incomplete-list)&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/marcj/css-element-queries&quot;&gt;CSS-Element-Queries Polyfill&lt;/a&gt; by Marc J. Schmidt&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/filamentgroup/elementary&quot;&gt;Elementary&lt;/a&gt; by Scott Jehl&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/tysonmatanich/elementQuery&quot;&gt;ElementQuery&lt;/a&gt; by Tyson Matanich&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Snugug/eq.js&quot;&gt;EQ.js&lt;/a&gt; by Sam Richards&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/ausi/cq-prolyfill&quot;&gt;Prolyfill for CSS Container Queries&lt;/a&gt; by Martin Auswöger&lt;/li&gt;
&lt;/ul&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Theme switcher using CSS custom properties</title>
							<link>https://justmarkup.com/log/2016/02/theme-switcher-using-css-custom-properties/</link>
							<pubDate>2016-02-15T11:37:45+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/02/theme-switcher-using-css-custom-properties/</guid>
							<description>&lt;p&gt;&lt;a href=&quot;https://www.w3.org/TR/css-variables/&quot;&gt;CSS custom properties&lt;/a&gt; have been around for a while now and are currently supported in &lt;a href=&quot;http://caniuse.com/#feat=css-variables&quot;&gt;three browser engines&lt;/a&gt; (as of February 2016). When I first heard about CSS variables I was skeptical as I thought they will offer the same functionality as variables in pre-/post-processors. Some month later I stumbled across the spec and was &lt;a href=&quot;http://philipwalton.com/articles/why-im-excited-about-native-css-variables/&quot;&gt;pretty excited&lt;/a&gt; to find out that they are not really variables, but rather properties which are dynamic and scoped to the DOM. To show this in action I build a simple theme switcher demo.&lt;/p&gt;
&lt;h2 id=&quot;feature-detect&quot;&gt;Feature detect &lt;a class=&quot;permalink&quot; href=&quot;#feature-detect&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As we will use JavaScript to modify custom properties, the first thing we do is adding a detect to decide whether we will show the theme switcher or not.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;supports &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;supports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// CSS custom properties supported.&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// CSS custom properties not supported&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;setting-custom-properties-in-css&quot;&gt;Setting custom properties in CSS &lt;a class=&quot;permalink&quot; href=&quot;#setting-custom-properties-in-css&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next we define some custom properties in our CSS. Here we have a –baseColor, –brandColor and –bgColor which we will use for various elements later in the CSS.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--baseColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #111&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--brandColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; green&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--bgColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #eee&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; green&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* provide fallback */&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--brandColor&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;modifying-custom-properties-with-javascript&quot;&gt;Modifying custom properties with JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#modifying-custom-properties-with-javascript&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When selecting a theme we will change the properties with JavaScript, as shown here:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; root &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;:root&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; htmlStyle &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getComputedStyle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;htmlStyle&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getPropertyValue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--baseColor&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// get the custom property --baseColor&lt;/span&gt;&lt;br&gt;root&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;--baseColor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// set --baseColor to red&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;full-example&quot;&gt;Full example &lt;a class=&quot;permalink&quot; href=&quot;#full-example&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here is the HTML of the theme switcher, which is hidden by default and will be set to visible once the feature detect above returns true.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;theme-changer&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	Choose theme&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;select&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;theme&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;theme&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;option&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-baseColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#111&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-bgColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#eee&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-brandColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;green&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;default&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;default&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;option&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;option&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-baseColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#444&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-bgColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;white&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-brandColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#222&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;light&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;light&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;option&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;option&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-baseColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;white&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-bgColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;black&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-brandColor&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#eee&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dark&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;dark&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;option&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;select&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the full JavaScript for the theme switcher. As you can see I also save the current chosen theme in localStorage so users will get the selected theme on future visits.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// test for localStorage support&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;hasLocalStorage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; mod &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mod&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; mod&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mod&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;// test for CSS custom properties support&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasLocalStorage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;supports &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;supports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;--a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; themeChanger &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;#theme-changer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			root &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;:root&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			themeInput &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;#theme&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			currentTheme &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;				baseColor&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;baseColor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;#111&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;				bgColor&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bgColor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;#eee&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;				brandColor&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;brandColor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;green&#39;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			selectOption&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// show the theme changer&lt;/span&gt;&lt;br&gt;	themeChanger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	themeChanger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// change colors and save to localStorage&lt;/span&gt;&lt;br&gt;	themeInput&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;change&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// get selected option&lt;/span&gt;&lt;br&gt;		selectOption &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;options&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;selectedIndex&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// change values to current theme&lt;/span&gt;&lt;br&gt;		currentTheme &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			baseColor&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; selectOption&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;data-baseColor&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			bgColor&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; selectOption&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;data-bgColor&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			brandColor&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; selectOption&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;data-brandColor&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// change values of custom properties and save to localStorage&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; key &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; currentTheme&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			root&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;--&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; key&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; currentTheme&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;key&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;			localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setItem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;key&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; currentTheme&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;key&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// set theme to previous choosen one&lt;/span&gt;&lt;br&gt;	window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// set option of current theme to selected&lt;/span&gt;&lt;br&gt;		document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-baseColor=&quot;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; currentTheme&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;baseColor &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;selected &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// get values of custom properties and apply&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; key &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; currentTheme&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			root&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;--&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; key&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; currentTheme&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;key&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// CSS custom properties not supported - don&#39;t show the theme switcher&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can find the full &lt;a href=&quot;https://justmarkup.com/demos/custom-prop/&quot;&gt;demo&lt;/a&gt; here and the code is also available on &lt;a href=&quot;https://github.com/justmarkup/demos/blob/gh-pages/theme-changer-css-custom-properties/index.html&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;update-20.02.2016%3A-change-styles-based-on-different-classname&quot;&gt;Update 20.02.2016: Change styles based on different className &lt;a class=&quot;permalink&quot; href=&quot;#update-20.02.2016%3A-change-styles-based-on-different-classname&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As Tomáš Kapler points out in the comments you could also change the html class with JavaScript and change the properties based on the className:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--baseColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #111&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--brandColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; green&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--bgColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #eee&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;:root.light&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--baseColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #444&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--bgColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--brandColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #222&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;:root.dark&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--baseColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--brandColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #eee&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;--bgColor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; black&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is a &lt;a href=&quot;https://justmarkup.com/demos/custom-prop/index1.html&quot;&gt;demo&lt;/a&gt; using this method.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you can see, you can already use CSS custom properties as an enhancement today, but you should always provide a fallback and be careful when using them. If you only need static and lexically scoped variables you are probably better of by using a preprocessor until more browsers support custom properties.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> This should be really easy to implement</title>
							<link>https://justmarkup.com/log/2016/02/this-should-be-really-easy-to-implement/</link>
							<pubDate>2016-02-05T16:50:21+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/02/this-should-be-really-easy-to-implement/</guid>
							<description>&lt;p&gt;Some time ago I wrote about why I think every browser should show the &lt;a href=&quot;https://justmarkup.com/log/2016/01/showing-the-alternative-text-while-images-are-loading/&quot;&gt;alternative text while images are loading&lt;/a&gt;. I opened issues for every major browser engine and was looking forward to hear positive replies as I was really sure there couldn’t be a negative aspect about it. Some kindly people &lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=579402&quot;&gt;replied&lt;/a&gt;, said they already tested it and the user experience was not improved, pointed me to edge cases I haven’t thought about and made me rethink. It’s one of the cases where I say to myself “Hey, this should be really easy to implement” without thinking about the whole picture.&lt;/p&gt;
&lt;h2 id=&quot;there-is-no-easy&quot;&gt;There is no easy &lt;a class=&quot;permalink&quot; href=&quot;#there-is-no-easy&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At a first glance many things look easy to implement/fix, but in the end it is probably not easy, but really hard. So before you shout “Implement this now, that’s easy” make sure you really thought about all possible use and egde cases. I also have been complaining about browsers not implementing a feature, often because I needed the feature for a special use case right now and thought everybody wants this and it shouldn’t be more than a day of work for an engineer to implement it. I have to say I was wrong every single time. If you really want to have a feature implemented do a lot of research first: What’s the use cases for the feature? Are there any edge cases which makes it hard/impossible to implement? Do other people also want this feature or is something you probably only need now for the current project you are working on?&lt;/p&gt;
&lt;p&gt;Thanks to everyone working on browsers; Thank you!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Rethinking setting class=”js” to hide elements if JavaScript is available</title>
							<link>https://justmarkup.com/log/2016/02/rethinking-setting-classjs-to-hide-elements-if-js-available/</link>
							<pubDate>2016-02-01T14:38:11+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/02/rethinking-setting-classjs-to-hide-elements-if-js-available/</guid>
							<description>&lt;p&gt;Last month a client reported an issue with their website, saying that the navigation isn’t working on his new iPhone 6s Plus. After getting all &lt;a href=&quot;https://justmarkup.com/bugreporter&quot;&gt;browser details&lt;/a&gt;, I started to reproduce the error, but neither on my iPad with an identical iOS and Safari version nor on any emulator on &lt;a href=&quot;http://browserstack.com/&quot;&gt;browserstack.com&lt;/a&gt; the error occurred. So, I arranged a meeting with the client and debugged directly on his smartphone. After some testing I noticed an JavaScript exception &lt;code&gt;QUOTA_EXCEEDED_ERR:DOM Exception 22&lt;/code&gt;. I checked the code and found the error was caused by using &lt;code&gt;localStorage.setItem();&lt;/code&gt;. While we checked if localStorage is available &lt;code&gt;&#39;localStorage&#39; in window&lt;/code&gt; we didn’t check for &lt;code&gt;setItem();&lt;/code&gt; &lt;a href=&quot;http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an&quot;&gt;properly&lt;/a&gt; and therefore our complete JavaScript failed.&lt;/p&gt;
&lt;p&gt;This made me rethink my strategy of hiding elements when JavaScript is available. Typically I change the className of &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; from &lt;code&gt;.no-js&lt;/code&gt; to &lt;code&gt;.js&lt;/code&gt; in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; with JavaScript to &lt;a href=&quot;http://www.paulirish.com/2009/avoiding-the-fouc-v3/&quot;&gt;avoid the FOUC&lt;/a&gt;. The problem with this method is if an error occurs, like described before, this will fail and probalby make parts of the site unusable.&lt;/p&gt;
&lt;h2 id=&quot;example&quot;&gt;Example &lt;a class=&quot;permalink&quot; href=&quot;#example&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To demonstrate it here is an &lt;a href=&quot;https://justmarkup.com/progressive-navigation/&quot;&gt;example of a responsive navigation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/navigation-big.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Navigation on big screens&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/navigation-nojs.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Navigation with JavaScript disabled/unusable&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/navigation-js-closed.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;JavaScript usable and navigation closed&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/02/navigation-js-open.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;JavaScript usable and navigation open&lt;/p&gt;
&lt;p&gt;If you view the demo on a small screen you can see that the navigation is hidden and the button to trigger the navigation is visible if JavaScript is usable. If JavaScript is disabled or unusable the navigation is hidden and the navigation is shown.&lt;/p&gt;
&lt;p&gt;Here is the same demo &lt;a href=&quot;https://justmarkup.com/progressive-navigation/error/&quot;&gt;with a JavaScript&lt;/a&gt; error added. As you can see in this case the navigation is displayed the same way it would be if JavaScript was disabled. So whatever error may stop your JavaScript from working the site will still be usable.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To avoid cases where JavaScript is available, but not usable I will use the following code in the future.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\bno-js\b&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onerror&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\bjs\b&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;no-js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Additional I will use &lt;a href=&quot;https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/&quot;&gt;Cut the mustard&lt;/a&gt; to check for features.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;addEventListener&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;// code here&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\bjs\b&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;no-js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are many &lt;a href=&quot;http://kryogenix.org/code/browser/everyonehasjs.html&quot;&gt;ways&lt;/a&gt; where JavaScript is not available or executed in a browser and by using &lt;code&gt;window.onerror&lt;/code&gt; we can handle them and show the same layout/functionality which would be shown for users who disabled JavaScript.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Showing the alternative text while images are loading</title>
							<link>https://justmarkup.com/log/2016/01/showing-the-alternative-text-while-images-are-loading/</link>
							<pubDate>2016-01-20T06:54:22+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/01/showing-the-alternative-text-while-images-are-loading/</guid>
							<description>&lt;p&gt;Some days ago Šime Vidas tweeted: &lt;a href=&quot;https://twitter.com/simevidas/status/688419465223077889&quot;&gt;Why don’t Chrome, Safari reserve space for &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; with height attribute in responsive layouts?&lt;/a&gt; As part of the discussion and after some testing in different browsers I found that Firefox is the only browser at the moment who shows the alt attribute while images are loading. I think it would be great if every browser would show the alternative text while images are loading – especially on slow connections this would be very helpful.&lt;/p&gt;
&lt;h2 id=&quot;slow-connections&quot;&gt;Slow connections &lt;a class=&quot;permalink&quot; href=&quot;#slow-connections&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When browsing web sites, especially on slow connections, it takes some time until all images are loaded. In addition to defining &lt;a href=&quot;https://justmarkup.com/log/2015/11/definining-aspect-ratio-to-prevent-reflow/&quot;&gt;aspect ratio for images&lt;/a&gt; to prevent the jump effect, it would be great if the alternative text would be shown so I could decide more easily if I think it is worth to wait for the image or move on scrolling and reading.&lt;/p&gt;
&lt;h2 id=&quot;improve-accessibility&quot;&gt;Improve accessibility &lt;a class=&quot;permalink&quot; href=&quot;#improve-accessibility&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I think this would also improve accessibility. If authors would see the value of the alt attribute every time they open their site they would more likely add an alternative text for every image. Adding useful alternative text is something many Authors forget and don’t check before publishing an article. Some CMS also pre-fill the alternative text with information they extract from the image, like the name of the camera. My hope is that by making the alternative text more present many authors will think about it and provide useful information for images.&lt;/p&gt;
&lt;h2 id=&quot;styling-the-alternative-text&quot;&gt;Styling the alternative text &lt;a class=&quot;permalink&quot; href=&quot;#styling-the-alternative-text&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can also style the alternative text with CSS. Here is an example of an invalid image where I &lt;a href=&quot;http://jsbin.com/qorowi/edit?html,css,output&quot;&gt;styled the alternative text&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;feature-requests&quot;&gt;Feature requests &lt;a class=&quot;permalink&quot; href=&quot;#feature-requests&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Because I really want this feature in every browser I opened requests for Chrome (Blink), IE/Edge and Safari (WebKit).&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=579402&quot;&gt;Chrome&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://connect.microsoft.com/IE/feedbackdetail/view/2262724/show-alternative-text-while-images-are-loading&quot;&gt;Internet Explorer / Edge&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=153273&quot;&gt;WebKit&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let’s see what they think.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> On the Safari 9.1 release</title>
							<link>https://justmarkup.com/log/2016/01/on-the-safari-9-1-release/</link>
							<pubDate>2016-01-14T07:12:52+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/01/on-the-safari-9-1-release/</guid>
							<description>&lt;p&gt;Earlier this week – January 11, 2016 – Apple announced the release of &lt;a href=&quot;https://developer.apple.com/library/prerelease/mac/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html#//apple_ref/doc/uid/TP40014305-CH10-SW1&quot;&gt;Safari 9.1&lt;/a&gt; which will be available soon is available now. It ships with exciting features – picture element, fast-tap, CSS variables – to name a few. I was as surprised, as other &lt;a href=&quot;https://adactio.com/journal/10084&quot;&gt;web developers&lt;/a&gt; to see this happen and it makes me happy.&lt;/p&gt;
&lt;h2 id=&quot;safari-is-the-new-ie&quot;&gt;Safari is the new IE &lt;a class=&quot;permalink&quot; href=&quot;#safari-is-the-new-ie&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Many web developers have the feeling that Safari is lagging behind other browsers nowadays. On of the reasons is the release cycle of Safari. Until now, a new version of Safari was released only once a year. While other browser vendors release a new version every other month, we – as web developers – had to wait for a long time until features and fixes would land in Safari. I am pleased to see a change happening here and I am looking forward to see more frequent releases in the future.&lt;/p&gt;
&lt;p&gt;I am even optimistic now to see Service Worker coming to Safari this year which I wouldn’t have thought it would ever happen &lt;a href=&quot;https://justmarkup.com/log/2015/12/front-end-wishlist-for-2016/&quot;&gt;a month ago&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And don’t worry, I am sure the internet crowd will soon find another thing which is the new IE.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The death IE8, IE9 and IE10</title>
							<link>https://justmarkup.com/log/2016/01/the-death-of-ie8-ie9-and-ie10/</link>
							<pubDate>2016-01-12T12:58:12+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/01/the-death-of-ie8-ie9-and-ie10/</guid>
							<description>&lt;p&gt;As of today, January 12, 2016, Microsoft will no longer &lt;a href=&quot;https://www.microsoft.com/en-us/WindowsForBusiness/End-of-IE-support&quot;&gt;support&lt;/a&gt; older versions (8, 9 and 10) of Internet Explorer. Many people are celebrating the “death” of these browsers and seem to be very relieved that they no longer have to support these outdated browsers. It seems for many it is all or nothing, black or white, no support or support and I am not very happy with this thinking.&lt;/p&gt;
&lt;h2 id=&quot;core-experience&quot;&gt;Core experience &lt;a class=&quot;permalink&quot; href=&quot;#core-experience&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Don’t get me wrong, I am also pleased to see that outdated browsers will no longer be supported and many users will probably switch to modern browsers, but this doesn’t mean we should stop delivering our core experience for users still using older browsers.&lt;/p&gt;
&lt;p&gt;For me this means, I will update my &lt;a href=&quot;https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/&quot;&gt;cut the mustard tests&lt;/a&gt; and handle IE9 and IE10 as &lt;a href=&quot;http://responsivenews.co.uk/post/18948466399/cutting-the-mustard&quot;&gt;HTML4 browsers&lt;/a&gt; in the future like I already do with IE8. HTML4 browser means these browsers will get the core experience, but I won’t invest extra time to deliver an enhanced version for them.&lt;/p&gt;
&lt;p&gt;This also means old browsers shouldn’t stop you from using new web features or adding enhancements for modern browsers, it means that we shouldn’t exclude users with outdated browsers as they often don’t have the possibility to update and still want to use your website.&lt;/p&gt;
&lt;p&gt;Be future-friendly and stop the all-or-nothing thinking.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Every web site has to start with server-side rendered HTML – no exceptions.</title>
							<link>https://justmarkup.com/log/2016/01/every-web-site-has-to-starts-with-html/</link>
							<pubDate>2016-01-07T12:22:25+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/01/every-web-site-has-to-starts-with-html/</guid>
							<description>&lt;p&gt;If I open an URL and all I get is a blank page – be it because I turned JavaScript off, use an Adblocker, use an outdated browser or anything else – the developer building the site failed – no excuses. This is the case for every type of web site/app/whateveryoucallit – be it a WebGL game, a single-page application, an article or a cat gallery.&lt;/p&gt;
&lt;p&gt;Don’t get me wrong, you shouldn’t and often couldn’t build features without using modern web technologies relying on JavaScript, a modern browser or a fast device. However, this doesn’t stop you to start with well-structured HTML in the first place.&lt;/p&gt;
&lt;h2 id=&quot;no-content&quot;&gt;No content &lt;a class=&quot;permalink&quot; href=&quot;#no-content&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2016/01/ROME-1024x530.png&quot; alt=&quot;ROME&quot;&gt;&lt;/p&gt;
&lt;p&gt;When you open &lt;a href=&quot;http://www.ro.me/&quot;&gt;ROME (3 Dreams of Black )&lt;/a&gt;, a great semi-interactive film, without JavaScript you will see a black page and nothing else. This could also happen under different circumstances – it’s not about people surfing the web without JavaScript. If you view the source of the site you won’t see any content (apart from some meta tags like Title, Description and Open Graph) – it contains of a link to a CSS file, a script linking to a JavaScript file and Google Analytics.&lt;/p&gt;
&lt;p&gt;When viewing the site with JavaScript turned on you will see an animated background (using canvas), an image (containing also text), Links and Share Buttons (Facebook and Twitter). To render that it loads 696 KB, which results in a &lt;a href=&quot;http://www.webpagetest.org/result/160107_F5_MQ9/&quot;&gt;Speedindex of 6568&lt;/a&gt; and takes &lt;a href=&quot;http://www.webpagetest.org/video/compare.php?tests=160107_F5_MQ9-r:1-c:0&quot;&gt;7sec (on 3G)&lt;/a&gt; to show the first visible content.&lt;/p&gt;
&lt;h2 id=&quot;the-basics&quot;&gt;The basics &lt;a class=&quot;permalink&quot; href=&quot;#the-basics&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It’s not terrible bad, but still way to much KB and load time to show static content – the only element where JavaScript is needed is the animated background. I took the generated HTML from DevTools, changed the base href and tested the site again on &lt;a href=&quot;http://www.webpagetest.org/video/compare.php?tests=160107_KJ_NZ6-r:1-c:0&quot;&gt;WebPagetest&lt;/a&gt; and the full content (minus the animated background) was visible after ~4s – to be fair the web font failed to load in this test but if you would improve the HTML structure and load the CSS inline you would reach a similar result.&lt;/p&gt;
&lt;p&gt;Apart from the animated background the site looks and works the same without using JavaScript. There is no need to render the initial content on the client-side and also no need to exclude anyone from viewing it. After the first view loads you could enter the “main” site which requires modern web technologies not everybody has. If a users browser doesn’t have all the needed features integrated you could show a notice, list what’s missing to have a perfect experience and suggest browsers the user could switch to.&lt;/p&gt;
&lt;p&gt;Start every site you build with well-structured HTML and everybody wins.&lt;/p&gt;
&lt;p&gt;Note: I don’t want to blame the developers of ROME here, but if you are reading this maybe you can change the site and start with server-rendered HTML. Please.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Syntax highlighting as an enhancement</title>
							<link>https://justmarkup.com/log/2016/01/add-syntax-highlighting-as-an-enhancement/</link>
							<pubDate>2016-01-05T08:49:08+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/01/add-syntax-highlighting-as-an-enhancement/</guid>
							<description>&lt;p&gt;I never had syntax highlighting for my code examples on this site and thought it is finally time to add one. After looking at some solutions I decided to use &lt;a href=&quot;http://prismjs.com/&quot;&gt;Prism&lt;/a&gt; as it is well tested and maintained and extensible.&lt;/p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation &lt;a class=&quot;permalink&quot; href=&quot;#implementation&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Do use Prism you need to include the CSS and JavaScript files you get from the &lt;a href=&quot;http://prismjs.com/download.html&quot;&gt;Download page&lt;/a&gt;. In my case I saved the CSS I got as &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/blob/master/src/scss/vendor/prism.scss&quot;&gt;prism.scss&lt;/a&gt; under the folder vendor and afer running it through Grunt it got compiled with the other SCSS files, compressed and inlined in the head of the site.&lt;/p&gt;
&lt;p&gt;After that I added the JavaScript in my footer.php at the very end:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;script defer src=&amp;quot;https://justmarkup.com/log/wp-content/themes/justmarkup.com/dist/js/prism.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note: I first tried it with the async attribute but this &lt;a href=&quot;https://github.com/PrismJS/prism/issues/75&quot;&gt;doesn’t work&lt;/a&gt; with Prism so I used the defer attribute instead.&lt;/p&gt;
&lt;p&gt;With this in place I went through my articles and added &lt;code&gt;class=&amp;quot;language-xxx&amp;quot;&amp;gt;&lt;/code&gt; to every code element where I want to have syntax highlighting. Finally some pretty code examples on my site. And if the JavaScript doesn’t load for whatever reason, the code blocks are still readable fine, like it was before – in two words – progressive enhancement.&lt;/p&gt;
&lt;h2 id=&quot;examples&quot;&gt;Examples &lt;a class=&quot;permalink&quot; href=&quot;#examples&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;CSS&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.code&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px solid green&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;JavaScript&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; Prism &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Add Service Worker for WordPress</title>
							<link>https://justmarkup.com/log/2016/01/add-service-worker-for-wordpress/</link>
							<pubDate>2016-01-01T15:17:54+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2016/01/add-service-worker-for-wordpress/</guid>
							<description>&lt;p&gt;As part of the &lt;a href=&quot;https://justmarkup.com/log/2015/11/open-redesign/&quot;&gt;open redesign&lt;/a&gt; of this WordPress site I also added a Service Worker – to improve performance and to offer an offline experience. I encountered some problems along the way so I thought it is a good idea to write about my findings. As a starting point I used this &lt;a href=&quot;https://brandonrozek.com/2015/11/limiting-cache-service-workers-revisited/&quot;&gt;basic implementation&lt;/a&gt; by &lt;a href=&quot;https://brandonrozek.com/&quot;&gt;Brandon Rozek&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;register-the-service-worker&quot;&gt;Register the Service Worker &lt;a class=&quot;permalink&quot; href=&quot;#register-the-service-worker&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/log/sw.min.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;scope&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;/log/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First of all you have to register the Service Worker, at WordPress themes you normally have a &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/blob/master/footer.php#L20-L29&quot;&gt;footer.php&lt;/a&gt; where you can add this.&lt;/p&gt;
&lt;p&gt;My blog is running on &lt;a href=&quot;https://justmarkup.com/log/&quot;&gt;justmarkup.com/log/&lt;/a&gt;, that’s why I use &lt;code&gt;scope: &#39;/log/&#39;&lt;/code&gt; here as the scope as I only want to use this Service Worker for my blog and not for every part (for example: Piwik, hosted on /piwik/) running on the domain. If your WordPress installation is on the root, you should use &lt;code&gt;scope: &#39;./&#39;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Usually, you have your theme files under /wp-content/themes/YOURTHEME/ and also have all your JavaScript files (and therefore also the Service Worker file) in this directory. The problem is that the Service Worker file has to be in the root directory of WordPress (in my case this is /log/) to be able to control and work with every part of your WordPress site. So, the Service Worker can only control everything in the directory it is served from and every directory beneath it. I was rather confused about it the first time, but it makes sense now, as otherwise you would be able to control every site on a shared hosting (think of Github pages).&lt;/p&gt;
&lt;p&gt;To get around the issue on my WordPress site, I created a &lt;a href=&quot;https://en.wikipedia.org/wiki/Symbolic_link&quot;&gt;symbolic link (symlink)&lt;/a&gt; – where I link the Service Worker file in my theme folder to the root folder. This way I can work on the Service Worker file in my themes folder and have it automatically linked to the root folder.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ln&lt;/span&gt; -s /var/www/log/wp-content/themes/justmarkup.com/dist/js/sw.min.js /var/www/log/sw.min.js&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Another way to handle this would be a .htaccess redirect rule, but I personally prefer using a symlink.&lt;/p&gt;
&lt;h2 id=&quot;handle-admin-and-preview-pages&quot;&gt;Handle admin and preview pages &lt;a class=&quot;permalink&quot; href=&quot;#handle-admin-and-preview-pages&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;With this in place my Service Worker was working fine until I was working on a new article and finding out that changes where sometimes not saved correctly and the preview was not accurate anymore. So, I added a &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/blob/master/src/js/sw.js#L131-L134&quot;&gt;conditional statement&lt;/a&gt; to not intercept the fetch when the URL contains wp-admin (the admin area of WordPress) or if the URL contains preview=true (the preview page).&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;//This service worker won&#39;t touch the admin area and preview pages&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;wp-admin&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;request&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;preview=true&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Service Worker are great and an enhancement for every site. While I first thought it is mainly about adding an offline experience I am far more excited about the performance impact and all the &lt;a href=&quot;http://deanhume.com/home/blogpost/service-workers--dynamic-responsive-images-using-webp-images/10132&quot;&gt;other&lt;/a&gt; &lt;a href=&quot;https://developers.google.com/web/updates/2015/12/background-sync?hl=en&quot;&gt;exciting&lt;/a&gt; &lt;a href=&quot;https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en&quot;&gt;things&lt;/a&gt; you can use it for.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/blob/master/src/js/sw.js&quot;&gt;Service Worker file&lt;/a&gt; currently in use on this site.&lt;/p&gt;
&lt;p&gt;If you want to use Service Worker on your WordPress site, I hope this article helps you to implement it without making the errors I made. If you use Service Worker in your WordPress site and found other solutions for the mentioned problems or other ways to improve it, please let me know.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Front-end wishlist for 2016</title>
							<link>https://justmarkup.com/log/2015/12/front-end-wishlist-for-2016/</link>
							<pubDate>2015-12-22T06:59:18+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/12/front-end-wishlist-for-2016/</guid>
							<description>&lt;p&gt;The end of the year is around the corner and it’s time to look into the future of Front-end. In this post I will talk about my wishes for 2016 and why I would love to see these three features implemented.&lt;/p&gt;
&lt;h3 id=&quot;container-queries&quot;&gt;Container queries &lt;a class=&quot;permalink&quot; href=&quot;#container-queries&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://snook.ca/&quot;&gt;Jonathan Snook&lt;/a&gt; wrote a great article called &lt;a href=&quot;https://24ways.org/2015/being-responsive-to-the-small-things/&quot;&gt;Being responsive to the small things&lt;/a&gt; for this year’s 24ways advent calendar about the current state of container queries and JavaScript-based solutions to use them today. Container queries, also known as &lt;a href=&quot;http://www.xanthir.com/b4PR0&quot;&gt;element queries&lt;/a&gt; comes with a lot of challenges for specification editors, browser vendors and everybody involved in adding new browser features, but it looks like it will be &lt;a href=&quot;http://www.xanthir.com/b4VG0&quot;&gt;possible&lt;/a&gt; to implement them. While I know it’s challenging to implement it I am optimistic 2016 will be the year where container queries will make it to a browser near you. So, why do I want to use container queries, isn’t media queries enough?&lt;/p&gt;
&lt;p&gt;We’re not designing pages, we’re designing systems of components. – Stephen Hay&lt;/p&gt;
&lt;p&gt;With media queries for every container our component lives in, we need to specify how to rearrange things in that context. By using container queries we can specify CSS for a component based on the dimensions of the container. This means your components are not dependent on the screen size, but on the container; Fantastic.&lt;/p&gt;
&lt;h3 id=&quot;service-worker-ships-in-safari-and-edge&quot;&gt;Service Worker ships in Safari and Edge &lt;a class=&quot;permalink&quot; href=&quot;#service-worker-ships-in-safari-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I am really excited about Service Worker (probably not as excited as &lt;a href=&quot;https://twitter.com/jaffathecake&quot;&gt;Jake Archibald&lt;/a&gt;, but still) and can’t wait until Safari and Microsoft Edge will implement Service Worker. I am pretty sure it will come to Edge in 2016, although they still have it listed as &lt;a href=&quot;https://dev.windows.com/en-us/microsoft-edge/platform/status/serviceworker&quot;&gt;Under Consideration&lt;/a&gt; at the moment. You should &lt;a href=&quot;https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/6263630-service-worker&quot;&gt;vote&lt;/a&gt; for it.&lt;/p&gt;
&lt;p&gt;To be honest, I am not so enthusiastic about Safari – Service Worker is on the &lt;a href=&quot;http://trac.webkit.org/wiki/FiveYearPlanFall2015&quot;&gt;5-year plan&lt;/a&gt; of WebKit – but even if it will ship to WebKit next year it doesn’t mean it will be shipped in Safari.&lt;/p&gt;
&lt;p&gt;Nevertheless, why I really like Service Worker is that it plays along nicely with progressive enhancement, offers not only an offline experience – but improves performance and all the &lt;a href=&quot;http://deanhume.com/home/blogpost/service-workers--dynamic-responsive-images-using-webp-images/10132&quot;&gt;other&lt;/a&gt; &lt;a href=&quot;https://developers.google.com/web/updates/2015/12/background-sync?hl=en&quot;&gt;exciting&lt;/a&gt; &lt;a href=&quot;https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en&quot;&gt;things&lt;/a&gt; you can use it for.&lt;/p&gt;
&lt;p&gt;If you want to see Service Worker in every major browser next year the best is to make a lot of noise about it, by using Service Worker today in as many sites as possible and by writing about it again and again.&lt;/p&gt;
&lt;h3 id=&quot;parent-and-previous-sibling-selector&quot;&gt;Parent and previous sibling selector &lt;a class=&quot;permalink&quot; href=&quot;#parent-and-previous-sibling-selector&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://css-tricks.com/parent-selectors-in-css/&quot;&gt;Parent selectors&lt;/a&gt; and &lt;a href=&quot;https://lists.w3.org/Archives/Public/www-style/2009Jul/0041.html&quot;&gt;previous sibling selector&lt;/a&gt; have been on the wish list of Front-end developers for years. The main points they are not implemented yet is that they are too expensive to implement and that they are pretty inefficient.&lt;/p&gt;
&lt;p&gt;While this may still be the case I think now is the time to implement them as an experimental feature and see what developers will make of it and how inefficient it really is. If the performance is not acceptable either some clever browser developers can change that or it will be removed again. If it turns of to be more efficient than expected it can be shipped without using an experimental flag; This would make many &lt;a href=&quot;https://remysharp.com/2010/10/11/css-parent-selector&quot;&gt;developers&lt;/a&gt; very happy.&lt;/p&gt;
&lt;h3 id=&quot;what-features-do-you-want-to-see-in-browsers-in-2016%3F&quot;&gt;What features do you want to see in browsers in 2016? &lt;a class=&quot;permalink&quot; href=&quot;#what-features-do-you-want-to-see-in-browsers-in-2016%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;What HTML, CSS or JavaScript features do you want to see shipped in 2016? Whatever it is, the best way to get a feature implemented is to make noise; Write about it, tell everyone why you need the feature, write about it again.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Scale an element without changing the size of its child elements</title>
							<link>https://justmarkup.com/log/2015/11/scale-an-element-without-changing-the-size-of-its-child-elements/</link>
							<pubDate>2015-11-27T10:55:43+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/11/scale-an-element-without-changing-the-size-of-its-child-elements/</guid>
							<description>&lt;p&gt;This morning I asked on &lt;a href=&quot;https://twitter.com/justmarkup/status/670170551000965120&quot;&gt;twitter&lt;/a&gt; for help with using &lt;code&gt;transform: scale();&lt;/code&gt; The first problem was that I wanted to animate the box the same way with &lt;code&gt;scale();&lt;/code&gt; as with changing the width/height of the element. The problem here was I wrongly set &lt;code&gt;transform-origin: 0 0;&lt;/code&gt; only on :hover but not for the inital state; Thanks to &lt;a href=&quot;https://twitter.com/maddesigns&quot;&gt;Sven Wolfermann&lt;/a&gt; for the hint.&lt;/p&gt;
&lt;h3 id=&quot;don%E2%80%99t-scale-the-children&quot;&gt;Don’t scale the children &lt;a class=&quot;permalink&quot; href=&quot;#don%E2%80%99t-scale-the-children&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The second problem was that I wanted to change the size of the element but not the size of its children (text). My first attempt was using &lt;code&gt;transform: scale(2);&lt;/code&gt; for the box (div) and &lt;code&gt;transform: scale(0.5);&lt;/code&gt; for the child element (p). This way the text had the same size before and after the transition but slightly changed the size during the animation and also looked very blur and ugly along the way as you can see in this &lt;a href=&quot;http://jsbin.com/dekaci/edit?html,css,output&quot;&gt;example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After some different approaches I thought about using &lt;code&gt;::before&lt;/code&gt; to achive the same effect. I first thought it doesn’t work (was confused regarding box model and layers – see below) but it turned out to achive exactly what I wanted; Scale an element without effecting the size of its child elements.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div:before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; -1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform-origin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; all 8s&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div:hover:before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is an &lt;a href=&quot;http://jsbin.com/siwitix/edit?html,css,output&quot;&gt;example&lt;/a&gt; showing the animation using scale on the div itself (first box) and using scale on div:before (second box).&lt;/p&gt;
&lt;h3 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;By setting transform on the element the element gets an own &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/speed/layers/&quot;&gt;layer&lt;/a&gt; which does not effect the size of the box model. This means an element with &lt;code&gt;width: 100px; transform: scale(2);&lt;/code&gt; will still have an &lt;code&gt;offsetWidth&lt;/code&gt; and &lt;code&gt;getAttribute(&amp;quot;width&amp;quot;)&lt;/code&gt; of 100px; as you can see in the &lt;a href=&quot;http://jsbin.com/pudawe/edit?html,js,console,output&quot;&gt;console&lt;/a&gt; output here.&lt;/p&gt;
&lt;p&gt;If you really want to change the content width/content height of a box you have to change a property effecting the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model&quot;&gt;box model&lt;/a&gt; (width/height, margin, padding, border). They all trigger layout and repaint and are therefore expensive to animate so if you only want to “visually” change the size of an element use transform.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Definining aspect ratio to prevent reflow</title>
							<link>https://justmarkup.com/log/2015/11/definining-aspect-ratio-to-prevent-reflow/</link>
							<pubDate>2015-11-25T11:21:50+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/11/definining-aspect-ratio-to-prevent-reflow/</guid>
							<description>&lt;p&gt;When browsing the web (especially on a slow connection) it takes some time until images are loaded and the browser is able to calculate the necessary space needed. I often open an URL, start reading and half way down when the images are finally loaded, I lose the current position and have to scroll down and search the position I have been; This is frustrating.&lt;/p&gt;
&lt;p&gt;Here is an &lt;a href=&quot;http://jsbin.com/suyuwas/edit?html,css,output&quot;&gt;example&lt;/a&gt; showing the Reflow effect using Chrome and Network throttling set to 3G.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/10/reflow2.gif&quot; alt=&quot;Animated gif showing browsing a web site where an image creates a jump effect&quot;&gt;&lt;br&gt;
Screencast showing the jump effect&lt;/p&gt;
&lt;p&gt;There are different ways to prevent this jump effect. While you can avoid it by setting an explicit width and height for every image in your HTML we will concentrate on solutions suitable for responsive web sites where images don’t have a fixed width and height.&lt;/p&gt;
&lt;h3 id=&quot;padding-bottom-hack&quot;&gt;padding-bottom hack &lt;a class=&quot;permalink&quot; href=&quot;#padding-bottom-hack&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.aspect-ratio-container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;padding-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 56.25%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* 16/9 aspect ratio */&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.aspect-ratio-container &gt; *&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #eee&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* you could also define a background image as a placeholder here */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/nilemo/latest/edit?html,css,output&quot;&gt;Example on jsbin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The padding-bottom hack – &lt;a href=&quot;http://alistapart.com/article/creating-intrinsic-ratios-for-video&quot;&gt;intrinsic ratios&lt;/a&gt; – has been around for a while now. The only downside is that you need a container to wrap the element.&lt;/p&gt;
&lt;h3 id=&quot;calc()%2Fvw-based-workaround&quot;&gt;calc()/vw based workaround &lt;a class=&quot;permalink&quot; href=&quot;#calc()%2Fvw-based-workaround&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 75em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 90vw&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 auto&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;9 * 90vw / 16&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;object-fit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cover&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #eee&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 75em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;9 * 75em / 16&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;object-fit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cover&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/kezefu/latest/edit?html,css,output&quot;&gt;Example on jsbin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After trying several ways to set an aspect ratio without the need of a container I came up with a workaround using calc() and the vw (viewport width) unit.&lt;/p&gt;
&lt;p&gt;The biggest disadvantage is that it only works for images spreading to the full width of the screen size.&lt;/p&gt;
&lt;p&gt;Browser support is pretty good for &lt;a href=&quot;http://caniuse.com/#feat=calc&quot;&gt;calc()&lt;/a&gt; and &lt;a href=&quot;http://caniuse.com/#feat=viewport-units&quot;&gt;vw&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;the-aspect-ratio-property&quot;&gt;The aspect-ratio property &lt;a class=&quot;permalink&quot; href=&quot;#the-aspect-ratio-property&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* set 16/9 aspect ratio for all images */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;aspect-ratio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 16/9&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Tab Atkins already proposed a draft for an &lt;a href=&quot;http://www.xanthir.com/blog/b4810&quot;&gt;aspect-ratio CSS property&lt;/a&gt; in 2012. According to &lt;a href=&quot;https://twitter.com/tabatkins&quot;&gt;Tab&lt;/a&gt; the CSSWG does want to address it, but it’s been low priority for years. He also mentioned that the proposal has some serious problems:&lt;/p&gt;
&lt;p&gt;If you want to have this property, write a reply to this thread on &lt;a href=&quot;http://discourse.wicg.io/t/css-aspect-ratio-proposal/540&quot;&gt;Specifiction&lt;/a&gt; to show your desire.&lt;/p&gt;
&lt;h3 id=&quot;other-elements&quot;&gt;Other elements &lt;a class=&quot;permalink&quot; href=&quot;#other-elements&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are other elements like video/iframe and ads (inserted asynchronous and expanding the space) which can trigger an unwanted reflow. I recommend setting an aspect ratio for these elements as well. For banners you often have fixed units which gets inserted into the page according to screen size. Here is an example how you could handle this with CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* On small screens show 320x50 banner */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.ad-container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 320px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* On medium screens show 728x90 banner */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 800px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;.ad-container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 728px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 90px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* On large screens show 970x90 banner */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1000px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;.ad-container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 970px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 90px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;bottom-line&quot;&gt;Bottom line &lt;a class=&quot;permalink&quot; href=&quot;#bottom-line&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you are able to set a container the padding-bottom hack is a good way to prevent a Reflow. For images not having an extra container the calc()/vw solution is a good alternative. Until we have a native CSS solution to handle aspect ratios the mentioned workarounds are great to prevent the jump effect.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Open redesign</title>
							<link>https://justmarkup.com/log/2015/11/open-redesign/</link>
							<pubDate>2015-11-12T14:47:34+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/11/open-redesign/</guid>
							<description>&lt;p&gt;I wanted to update the design for this site for years but whenever I started, other projects came in the way. I have at least 10 unfinished designs which will never go live. That’s why I am starting an open redesign now.&lt;/p&gt;
&lt;h3 id=&quot;planned-improvements-(in-random-order)&quot;&gt;Planned improvements (in random order) &lt;a class=&quot;permalink&quot; href=&quot;#planned-improvements-(in-random-order)&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Make it fast, then make it even faster – &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/commit/066ece4b9894b6b45bdc1e5c3ea2146ed55060bd&quot;&gt;Load JavaScript async&lt;/a&gt; – pretty happy with the performance now.&lt;/li&gt;
&lt;li&gt;Improve Accessibility – Fixed labels for forms, &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/commit/71c064260f68e2b404f077bd0af5a2b3edb188e2&quot;&gt;Made svg logo accessible by adding a title attribute, changed heading structure, fixed bad contrast for code element&lt;/a&gt; – marking this as done is probably wrong as I am sure here and there is eg. an alt description not perfect but all the main things are fixed.&lt;/li&gt;
&lt;li&gt;Add last updated at for technical articles&lt;/li&gt;
&lt;li&gt;Service Worker integration – 13.11.2015 – Basic implementation is live: &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/blob/master/src/js/sw.js&quot;&gt;Code&lt;/a&gt; and &lt;a href=&quot;https://justmarkup.com/log/2016/01/add-service-worker-for-wordpress/&quot;&gt;article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Push notification integration with WordPress – 18.11.2015 – Initially I thought it might be a great idea to offer notifications every time I post a new article but that’s what RSS is for. You should only show notifications if it’s important and urgent which is not the case for a new post.&lt;/li&gt;
&lt;li&gt;Responsive Images – &lt;a href=&quot;http://www.smashingmagazine.com/2015/12/responsive-images-in-wordpress-core/&quot;&gt;On by default in all newer posts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Add to homescreen – 13.11.2015 – &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/blob/master/manifest.json&quot;&gt;Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Use em instead of px – 01.01.2016 – &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/commit/cce91c0a25c03c3a7e4718c7c5d833952631c577&quot;&gt;Commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Add logo animation – 19.11.2015 – &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/commit/7cd987de6a7b02f3f410a198074299cdd66685ce&quot;&gt;Commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Add code highlighter as an enhancement – added prismjs (&lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/commit/dd2bf6034c052db21f38503b566ce0e379701df6&quot;&gt;commit&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;…&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can find the code of the WordPress Theme on &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/&quot;&gt;Github&lt;/a&gt;. If you have any other ideas for improvements or found a bug feel free to open an &lt;a href=&quot;https://github.com/justmarkup/justmarkup.com/issues&quot;&gt;issue&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I will write about some improvement along the way. If there is anything you would like to see integrated or anything you would like me to write about, let me know on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;twitter&lt;/a&gt; or write me an &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;email&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;articles-about-it&quot;&gt;Articles about it &lt;a class=&quot;permalink&quot; href=&quot;#articles-about-it&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/log/2016/01/add-service-worker-for-wordpress/&quot;&gt;Add Service Worker for WordPress&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://justmarkup.com/log/2016/01/add-syntax-highlighting-as-an-enhancement/&quot;&gt;Syntax highlighting as an enhancement&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Using text-shadow instead of font-weight bold to avoid jumping</title>
							<link>https://justmarkup.com/log/2015/11/quick-tip-using-text-shadow-instead-of-font-weight-bold-to-avoid-jumping/</link>
							<pubDate>2015-11-02T06:55:32+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/11/quick-tip-using-text-shadow-instead-of-font-weight-bold-to-avoid-jumping/</guid>
							<description>&lt;p&gt;When using font-weight: bold for :hover states on links the width of the element changes as the character width gets increased. This can result in a jump effect as shown in this &lt;a href=&quot;http://jsbin.com/toxija/latest/edit?html,css,output&quot;&gt;example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/log/wp-content/uploads/2015/11/font-weight-bold-jump.gif&quot;&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/11/font-weight-bold-jump.gif&quot; alt=&quot;Screencast showing hovering of a link with font-weight set to bold and the workaround using text-shadow&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;workaround&quot;&gt;Workaround &lt;a class=&quot;permalink&quot; href=&quot;#workaround&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;a:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px 0 0 currentColor&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To prevent the jump effect we can use text-shadow to fake font-weight: bold. Browser support for &lt;a href=&quot;http://caniuse.com/#feat=css-textshadow&quot;&gt;text-shadow&lt;/a&gt; is good for most browsers, except in Internet Explorer where it isn’t supported prior to Version 10. As you want to define :hover states for older IE versions as well you may use conditional comments:&lt;/p&gt;
&lt;h3 id=&quot;conditional-comments&quot;&gt;Conditional comments &lt;a class=&quot;permalink&quot; href=&quot;#conditional-comments&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!--[if lt IE 9]&gt; &amp;lt;html class=&quot;old-ie&quot; lang=&quot;en&quot;&gt; &amp;lt;![endif]--&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!--[if IE 9]&gt; &amp;lt;html class=&quot;old-ie&quot; lang=&quot;en&quot;&gt; &amp;lt;![endif]--&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!--[if !IE]&gt;&amp;lt;!--&gt;&lt;/span&gt; &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;&amp;lt;!--&amp;lt;![endif]--&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;a:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px 0 0 currentColor&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.old-ie a:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; bold&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/tocize/latest/edit?html,css,output&quot;&gt;Example&lt;/a&gt; using conditional comments.&lt;/p&gt;
&lt;h3 id=&quot;css-feature-queries&quot;&gt;CSS Feature Queries &lt;a class=&quot;permalink&quot; href=&quot;#css-feature-queries&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Or you could use @supports to target only browsers which support CSS Feature Queries and text-shadow:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;a:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; bold&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@supports&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px 0 0 #000&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;a:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; normal&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px 0 0 currentColor&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/cipiha/latest/edit?html,css,output&quot;&gt;Example&lt;/a&gt; using @supports.&lt;/p&gt;
&lt;p&gt;I prefer using &lt;a href=&quot;http://caniuse.com/#feat=css-featurequeries&quot;&gt;@supports&lt;/a&gt; as it is future-friendly and although it is not supported in IE11 it is supported in Edge and every other modern browser.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Audio - The preload attribute</title>
							<link>https://justmarkup.com/log/2015/08/audio-the-preload-attribute/</link>
							<pubDate>2015-08-11T10:18:46+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/08/audio-the-preload-attribute/</guid>
							<description>&lt;p&gt;I recently worked on a site where the audio element is used to provide extra information. After testing some article pages with many audio elements I noticed that browsers download the audio source without interacting with it. In some cases, this summed up to 10MB of downloaded data. Visiting such a site with a data plan can be very &lt;a href=&quot;http://whatdoesmysitecost.com/&quot;&gt;expensive&lt;/a&gt;. After visiting &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio&quot;&gt;MDN&lt;/a&gt; and reading more about the audio element I found out about the preload attribute and started testing it.&lt;/p&gt;
&lt;h3 id=&quot;preload-attribute&quot;&gt;Preload attribute &lt;a class=&quot;permalink&quot; href=&quot;#preload-attribute&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If we look at the description defined in the &lt;a href=&quot;http://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload&quot;&gt;W3C specification&lt;/a&gt; we can see that there are three keywords defined for the preload attribute:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;preload=”none”: hints that either the author thinks that the user won’t need to consult that audio or that the server wants to minimize its traffic; in others terms this hint indicates that the audio should not be cached;&lt;/li&gt;
&lt;li&gt;preload=”metadata”: hints that though the author thinks that the user won’t need to consult that audio, fetching the metadata (e.g. length) is reasonable;&lt;/li&gt;
&lt;li&gt;preload=”auto”: hints that the user needs have priority; in others terms this hint indicated that, if needed, the whole audio could be downloaded, even if the user is not expected to use it;&lt;/li&gt;
&lt;li&gt;the empty string: which is a synonym of the auto value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note: I &lt;a href=&quot;https://justmarkup.com/lab/audio/preload/&quot;&gt;tested&lt;/a&gt; in IE9, IE10, IE11, Edge, Chrome, Firefox, Opera, Safari, iOS Safari 8, Opera Mobile and Android 5 on real devices as Device Emulation and BrowserStack both showed the wrong results for mobile browsers. I used mp3 and Ogg sources for the tests, as every browser supporting the audio element supports at least one of them. To check for differences between using mp3 or Ogg first in the source, I tested this as well.&lt;/p&gt;
&lt;h3 id=&quot;preload%3D%E2%80%9Dnone%E2%80%9D&quot;&gt;preload=”none” &lt;a class=&quot;permalink&quot; href=&quot;#preload%3D%E2%80%9Dnone%E2%80%9D&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;audio&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;controls&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;preload&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;none&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mp3.mp3&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/mpeg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;ogg.ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tested with various browsers and combination of source order (ogg first, mp3 first) and no browser downloaded a file. There is however one major issue: &lt;strong&gt;IE9 doesn’t show the audio player at all when using preload=”none”&lt;/strong&gt;. It will only show the player after a right click on the invisible audio player and a click on play.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/08/preload-none-ie9.png&quot; alt=&quot;Audio element not visible when using preload=none in Internet Explorer 9&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;preload%3D%E2%80%9Dmetadata%E2%80%9D&quot;&gt;preload=”metadata” &lt;a class=&quot;permalink&quot; href=&quot;#preload%3D%E2%80%9Dmetadata%E2%80%9D&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;audio&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;controls&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;preload&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;metadata&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mp3.mp3&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/mpeg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;ogg.ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here it gets more interesting. On desktop browsers between 50kb and ~800kb of data gets downloaded from a 40MB file. Mobile browsers only download some kilobytes, only the metadata gets downloaded.&lt;/p&gt;
&lt;h3 id=&quot;preload%3D%E2%80%9Dauto%E2%80%9D&quot;&gt;preload=”auto” &lt;a class=&quot;permalink&quot; href=&quot;#preload%3D%E2%80%9Dauto%E2%80%9D&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;audio&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;controls&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;preload&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;auto&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mp3.mp3&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/mpeg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;ogg.ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On desktop browsers 2MB up to 40MB gets downloaded from a 40MB file. For mobile browsers it’s the same as for preload=”metadata” – only some kilobytes gets downloaded.&lt;/p&gt;
&lt;h3 id=&quot;no-preload-attribute-or-preload%3D%E2%80%9Dfoo%E2%80%9D&quot;&gt;No preload attribute or preload=”foo” &lt;a class=&quot;permalink&quot; href=&quot;#no-preload-attribute-or-preload%3D%E2%80%9Dfoo%E2%80%9D&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;audio&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;controls&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mp3.mp3&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/mpeg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;ogg.ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;audio/ogg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;According to the specification no preload attribute is a synonym for preload=”auto”. The same goes for invalid keywords like preload=”foo”. My tests shows that all browsers requests the same amount of data for preload=”foo”, no preload attribute or preload=”auto”.&lt;/p&gt;
&lt;h3 id=&quot;what-preload-attribute-should-i-use%3F&quot;&gt;What preload attribute should I use? &lt;a class=&quot;permalink&quot; href=&quot;#what-preload-attribute-should-i-use%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before discovering the issue with IE9 and preload=”none” I would have said preload=”none” is the best solution. No unnecessary data gets downloaded beforehand and the users can decide if they want to hear the audio and download the data. There is also another issue with preload=”none” – you won’t get the information of the audio duration before the audio gets played. You may get this information via server side but it may still be a dealbreaker from some.&lt;/p&gt;
&lt;p&gt;As there is no way (at least none I found) to fix the issue with IE9 and preload=”none” I would go with preload=”metadata”. By doing so less data gets downloaded beforehand and you still can get all the meta information of the audio. Mobile browsers already manage this quite well by not downloading much data (regardless of the preload attribute). But, I also tested using a desktop browser connected to a mobile hotspot and there was no difference between 3G or Wifi.&lt;/p&gt;
&lt;p&gt;Do sum it up – Don’t waste data of users, the web is already too bloated and we should respect that connections can be slow and data expensive.&lt;/p&gt;
&lt;h3 id=&quot;resources&quot;&gt;Resources &lt;a class=&quot;permalink&quot; href=&quot;#resources&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/lab/audio/preload/&quot;&gt;Test page&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.w3.org/TR/html5/embedded-content-0.html#the-audio-element&quot;&gt;Specification&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio&quot;&gt;MDN&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Dealing with long words in CSS</title>
							<link>https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/</link>
							<pubDate>2015-07-31T11:54:41+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/</guid>
							<description>&lt;p&gt;The web consists of content, content consists of words and words can be long, very long. Everyone involved with the web will sooner or later have to deal with long words.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/long-word-overlow.png&quot; alt=&quot;Rindfleischetikettierungsüberwachungsaufgabenübertragungsgesetz&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/fujopa/edit?html,css,output&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Browsing the web on my mobile device daily I see all kind of “failures” with long words – broken layouts, cropped words and situations like the one in the image above.&lt;/p&gt;
&lt;h2 id=&quot;hyphens&quot;&gt;Hyphens &lt;a class=&quot;permalink&quot; href=&quot;#hyphens&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The first solution for long words is using hyphens.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/long-word-hyphens.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/zimeta/4/edit?html,css,output&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.hyphens&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-webkit-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-moz-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-ms-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Browser support:&lt;/strong&gt; CSS Hyphenation is supported in every major &lt;a href=&quot;http://caniuse.com/#feat=css-hyphens&quot;&gt;browser&lt;/a&gt;, except from all blink-based browsers (Chrome, Opera, Android) – &lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=47083&quot;&gt;Chromium bug&lt;/a&gt;. I also tested Safari 5.1 for Windows where hyphens are added but in my test words they were all on the wrong position and made no sense.&lt;/p&gt;
&lt;p&gt;Furthermore, hyphens is language-sensitive. You have to define the lang attribute on the parent element and you should be aware that non-english &lt;a href=&quot;https://developer.mozilla.org/en/docs/Web/CSS/hyphens#Notes_on_supported_languages&quot;&gt;languages&lt;/a&gt; are not supported very well across browsers.&lt;/p&gt;
&lt;p&gt;You could also use a JavaScript library like &lt;a href=&quot;http://mnater.github.io/Hyphenator/&quot;&gt;Hyphenator.js&lt;/a&gt; which works with &lt;a href=&quot;https://github.com/mnater/Hyphenator/blob/wiki/en_AddNewLanguage.md#what-we-have-now&quot;&gt;many languages&lt;/a&gt; and in lots of browsers. The downside is that you have to load a lot of extra JavaScript and especially for longer text it will hurt the performance.&lt;/p&gt;
&lt;h2 id=&quot;word-break&quot;&gt;word-break &lt;a class=&quot;permalink&quot; href=&quot;#word-break&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As browser support for hyphens isn’t really good, let’s try word-break – a CSS property to specify whether to break lines within words.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/long-word-word-wrap.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/nulequ/edit?html,css,output&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.word-break&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-ms-word-break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-all&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-all&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Browser support:&lt;/strong&gt; CSS word-break is supported in every &lt;a href=&quot;http://caniuse.com/#feat=word-break&quot;&gt;browser&lt;/a&gt;, except from Opera Mini and old presto-based Opera browsers. I also found some bugs when using word-break in combination with hyphens – more on that later.&lt;/p&gt;
&lt;h2 id=&quot;overflow-wrap&quot;&gt;Overflow-wrap &lt;a class=&quot;permalink&quot; href=&quot;#overflow-wrap&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The next solution is using word-wrap (overflow-wrap), another property to specify whether or not the browser may break lines within words.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/long-word-word-wrap.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/fuweha/edit?html,css,output&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.word-wrap&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;overflow-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Browser support:&lt;/strong&gt; CSS overflow-wrap is supported in every (at least all I tested and listed on Can I use) &lt;a href=&quot;http://caniuse.com/#feat=wordwrap&quot;&gt;browser&lt;/a&gt;. Note: Some browsers require the legacy name “word-wrap” (rather than “overflow-wrap”) to work.&lt;/p&gt;
&lt;h2 id=&quot;ellipsis&quot;&gt;Ellipsis &lt;a class=&quot;permalink&quot; href=&quot;#ellipsis&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Another option to handle long words is truncating.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/long-word-ellipses.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jsbin.com/miselu/edit?html,css,output&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.ellipsis&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;text-overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; ellipsis&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Browser support:&lt;/strong&gt; Text-overflow is supported in every major &lt;a href=&quot;http://caniuse.com/#feat=text-overflow&quot;&gt;browser&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While this technique sounds like a good fit at a first glance it comes with disadvantages. First of all it will truncate every text after one line even if you use short words which would fit perfectly and would break in more lines. Furthermore, words could be truncated in a way that the original word will get another meaning – which may be funny at best or offensive at worst.&lt;/p&gt;
&lt;p&gt;Please, don’t use text-overflow: ellipsis at all – truncating is not a job for CSS. If you really need it do it on the server side and only truncate after full words.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I tested all the &lt;a href=&quot;http://jsbin.com/mojaxo/edit?html,css,output&quot;&gt;examples&lt;/a&gt; above and combinations of them in IE7, IE8, IE9, IE10, IE11, Edge, Firefox 39 (Windows, Linux, Mac), Chrome 44 (Windows, Linux, Mac), Opera 30 (Windows, Mac), Safari 8 (Mac), Safari 5.1 (Windows), Android 5 (Nexus 6), Android 4.4 (Nexus 5), Android 2.3 (Galaxy S2), iOS 8.3 (iPhone 6), iOS 7 (iPhone 5S), iOS 6 (iPhone5), Opera Mini (Android 5), Opera Classic (Android 5), Opera Mobile (Android 5) and Windows Phone 8.1 (Lumia 930) using real devices and &lt;a href=&quot;https://www.browserstack.com/&quot;&gt;BrowserStack&lt;/a&gt; – &lt;a href=&quot;https://gist.github.com/justmarkup/891ae55c4f8667c75e0e&quot;&gt;Here&lt;/a&gt; is a list of all 26 browsers and their &lt;a href=&quot;https://gist.github.com/justmarkup/891ae55c4f8667c75e0e&quot;&gt;results&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When searching the web you probably will find the following &lt;a href=&quot;https://css-tricks.com/almanac/properties/h/hyphenate/&quot;&gt;solution&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.hyphenate&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-ms-word-break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-all&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-all&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-webkit-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-moz-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While this works great in most cases, I found out that in Firefox hyphens won’t work (altough supported) in combination with word-break. Also, as word-break is not supported in Opera Mini it won’t work there.&lt;/p&gt;
&lt;p&gt;As browser support for overflow-wrap is fantastic I tested the following, using overflow-wrap and hyphens:&lt;/p&gt;
&lt;h3 id=&quot;final-solution&quot;&gt;Final solution &lt;a class=&quot;permalink&quot; href=&quot;#final-solution&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.hyphenate&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;overflow-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;word-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; break-word&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-webkit-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-ms-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;-moz-hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;hyphens&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This solution will show hyphens for every browser supporting it and will break lines in every other browser – perfect. Altough I have tested this solution in 26 different browsers I am still not sure this will work 100% – if you find any edge case please let &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;me&lt;/a&gt; know.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 28.09.2015&lt;/strong&gt;&lt;br&gt;
Some people asked why I didn’t mention &lt;a href=&quot;https://en.wikipedia.org/wiki/Soft_hyphen&quot;&gt;HTML soft hyphens&lt;/a&gt;. There are two reasons. First of all, this post is about solutions using CSS and not HTML and second and more important is that I think it’s impractical to define possible hyphens in the text itself and almost impossible for editors to do that by hand.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The Full Tools Developer</title>
							<link>https://justmarkup.com/log/2015/07/the-full-tools-developer/</link>
							<pubDate>2015-07-23T07:35:40+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/the-full-tools-developer/</guid>
							<description>&lt;p&gt;Last week I attended the &lt;a href=&quot;http://lanyrd.com/2015/meetthetag/&quot;&gt;Meet the TAG Meet-Up&lt;/a&gt;, a Q&amp;amp;A Panel with lots of great discussions between W3C TAG members and the audience – I even meet Sir Tim Berners-Lee; A wonderful evening. After the event, I talked to a student and he told me that one part of his studies is to build a “web app”. He decided to build an application for a museum showing interactive elements for exhibits. We started talking about how he plans to structure the project and what web technologies he plans to use when he said:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;» Originally I planned to use AngularJS to build the app, but my professor said I should better use React «&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What?! If now even professors teach students to use tool X, framework Y or library Z instead of telling them about “the basics” CSS, HTML, JavaScript, Accessibility, Progressive Enhancement, etc. we can all shout “The web sucks” and learn Swift. That’s like teaching an apprentice chef how to use kitchen equipment X (also known as jCook) instead of teaching them how to really cook.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;PSA: I think React is good, but pointing beginners w/o great understanding of HTML/CSS to a JavaScript-based UI library…not so much.&lt;/p&gt;
&lt;p&gt;— fantastic ms. (@fox) &lt;a href=&quot;https://twitter.com/fox/status/624116422751449089&quot;&gt;July 23, 2015&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;i-don%E2%80%99t-hate-tools%2C-i-just-don%E2%80%99t-like-the-way-most-people-use-them&quot;&gt;I don’t hate tools, I just don’t like the way most people use them &lt;a class=&quot;permalink&quot; href=&quot;#i-don%E2%80%99t-hate-tools%2C-i-just-don%E2%80%99t-like-the-way-most-people-use-them&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you know me, you know my opinion about using frameworks – let’s politely say I don’t like them very much. I don’t hate frameworks but seeing how these tools are used every day is just wrong in my opinion.&lt;br&gt;
If you use jQuery to hide/show elements and for nothing else – that’s wrong.&lt;br&gt;
If you use React because it’s cool to use it with no real benefits for the user and developers – that’s wrong.&lt;br&gt;
If you use Bootstrap because everybody else does – that’s wrong.&lt;/p&gt;
&lt;p&gt;But I also see developers using tools because it helps them to improve site performance, user experience and reduce developer time and costs – that’s great. I also use jQuery quite a lot, because it’s often the best choice for a project. If you use a tool, to me a favour and think about if you really need it for a project and use it responsible.&lt;/p&gt;
&lt;h3 id=&quot;learn-the-basics%2C-teach-the-basics%2C-use-the-basics&quot;&gt;Learn the basics, teach the basics, use the basics &lt;a class=&quot;permalink&quot; href=&quot;#learn-the-basics%2C-teach-the-basics%2C-use-the-basics&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I see a problem here, developers who knows how to use tool X or how to ask a question to get a full working code example back but may don’t know what to do if nobody is answering or if tool X isn’t the cool tool anymore. So the next time someone asks you what a beginner should learn say HTML, CSS, JavaScript – one after another.&lt;/p&gt;
&lt;p&gt;Maybe I am just a grumpy old chap not ready for a new tool every day; I am okay with that!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Introducing bugspencer.com</title>
							<link>https://justmarkup.com/log/2015/07/introducing-bugspencer-com/</link>
							<pubDate>2015-07-16T11:50:54+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/introducing-bugspencer-com/</guid>
							<description>&lt;p&gt;Browser bugs are annoying, reporting them can be even more frustrating. It can be quite hard to find information about the right place to report browser bugs and I see questions about this pop up on twitter here and there.&lt;/p&gt;
&lt;p&gt;That’s why I started &lt;a href=&quot;http://bugspencer.com/&quot;&gt;bugspencer.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A place to find information about bug trackers and status pages of various browsers, articles around browser bugs and other useful resources. It’s still in his early state as you can see, but it will hopefully improve over time.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bugspencer.com/&quot;&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/Bugspencer.com_.png&quot; alt=&quot;Screenshot of bugspencer.com&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you found an error on the site, want to add an article or resource or even want to help me improve the design (Hint: &lt;a href=&quot;https://github.com/justmarkup/bugspencer.com/issues/1&quot;&gt;Logo&lt;/a&gt;) let me know &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;@justmarkup&lt;/a&gt; or open an &lt;a href=&quot;https://github.com/justmarkup/bugspencer.com/issues/new&quot;&gt;issue&lt;/a&gt; – Your help is highly appreciated.&lt;/p&gt;
&lt;p&gt;If you are wondering about the name – Bugspencer – I was quite a big fan of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bud_Spencer&quot;&gt;Bud Spencer&lt;/a&gt; and his movies, which used to be broadcasted every Sunday in Austria so I changed Bud to Bug and hence the name.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Defining browser support</title>
							<link>https://justmarkup.com/log/2015/07/browser-support/</link>
							<pubDate>2015-07-09T15:03:14+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/browser-support/</guid>
							<description>&lt;p&gt;I attended a meeting this week where we talked about optimising the “web process” for an agency – Among other topics we also had a great discussion about browser support.&lt;/p&gt;
&lt;p&gt;When working with clients you usually set up a &lt;a href=&quot;https://gist.github.com/malarkey/4031110&quot;&gt;contract&lt;/a&gt;, where you often define the browser support for the project. From my experience, this often reads as “We support the latest 2 versions of all popular desktop and mobile browsers” or “We support IE9 and above, Chrome 36 and above, iOS6 and above, etc.”&lt;/p&gt;
&lt;p&gt;While this sounds reasonable at a first glance you will have a hard time if you find out that a special feature won’t work in some of the stated browsers and you have to explain that to your client. This can happen quite often, for example, some features/modules are not fully defined at the start of a project and may require a technology some of the browsers don’t support.&lt;/p&gt;
&lt;h3 id=&quot;browser-support-by-feature&quot;&gt;Browser support by feature &lt;a class=&quot;permalink&quot; href=&quot;#browser-support-by-feature&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Instead of stating browser support for the whole site I think it makes more sense to define browser support for every feature/module.&lt;/p&gt;
&lt;p&gt;Here is an example I put on &lt;a href=&quot;http://output.jsbin.com/cohifu/latest&quot;&gt;jsbin&lt;/a&gt; to show what this might look like:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://output.jsbin.com/cohifu/latest&quot;&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/browser-support-table-by-feature.png&quot; alt=&quot;Browser support table by features&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Do find out the browser support for a module you can use &lt;a href=&quot;http://caniuse.com/&quot;&gt;caniuse.com&lt;/a&gt;. Search for all front-end technologies you need and collect the data in a table/spreadsheet.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/07/caniuse.com-css-filter-effects.png&quot; alt=&quot;CSS filter effects - Support table from caniuse.com&quot;&gt;&lt;br&gt;
CSS filter effects support table from &lt;a href=&quot;http://caniuse.com/&quot;&gt;caniuse.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This way, you have a good overview of browser support for all your modules and everybody involved with the project will have a handy reference. Furthermore, you can include notes describing what “full support” or “no support” means for a specific module. You can even go one step further and define multiple versions of a module and their support. If we take the video example, this could mean core function is a link to the video, enhanced version means HTML5 video player, enhanced enhanced version means full customized HTML5 player.&lt;/p&gt;
&lt;p&gt;While I am fully aware that this may be hard to explain to clients I think it’s worth the time and will help everybody in the end.&lt;/p&gt;
&lt;p&gt;Update: 13.07.2015&lt;br&gt;
As &lt;a href=&quot;https://twitter.com/Fyrd/status/620449756473458688&quot;&gt;Alexis Deveria&lt;/a&gt; points out it’s possible to search for multiple features at once on &lt;a href=&quot;http://caniuse.com/&quot;&gt;caniuse.com&lt;/a&gt; – If your module needs dom-range, mp3 and css zoom you can use this &lt;a href=&quot;http://caniuse.com/#feat=dom-range,mp3,css-zoom&quot;&gt;link&lt;/a&gt; and scroll down to summary to see support for all features.&lt;/p&gt;
&lt;p&gt;What’s your approach of defining browser support for your projects? Let me know &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;@justmarkup&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> A web developer and a surfer went on a Safari – What happend next will shock you.</title>
							<link>https://justmarkup.com/log/2015/07/a-web-developer-and-a-surfer-went-on-a-safari/</link>
							<pubDate>2015-07-07T06:16:40+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/a-web-developer-and-a-surfer-went-on-a-safari/</guid>
							<description>&lt;p&gt;A surfer and a web developer, both familiar with going on Safari, went on a trip the other day. This time they decided to go with the vendor Banana.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://commons.wikimedia.org/wiki/File%3ALacatan.jpg&quot; title=&quot;By Nilo Angue (DSC00280) [CC BY 2.0 (http://creativecommons.org/licenses/by/2.0) or CC BY 2.5 (http://creativecommons.org/licenses/by/2.5)], via Wikimedia Commons&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/3/3b/Lacatan.jpg&quot; alt=&quot;Lacatan&quot;&gt;&lt;/a&gt;&lt;br&gt;
Apple bananas&lt;/p&gt;
&lt;p&gt;After sitting in the Safari SUV (called the mighty Browser by locals) for some time, the surfer praised the smooth experience on the way and that the car hasn’t broken yet like with other vendors before. It’s such a smart and powerful way to go on Safari with Banana, he said. Furthermore, as Banana is the only company available for this region – it all feels so native, very inimitable, he added. That’s amazing, isn’t it, he asked the web developer.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://commons.wikimedia.org/wiki/File%3ASafari_Tanzania.jpg&quot; title=&quot;By Muhammad Mahdi Karim (www.micro2macro.net) Facebook Youtube (Own work) [GFDL 1.2 (http://www.gnu.org/licenses/old-licenses/fdl-1.2.html)], via Wikimedia Commons&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Safari_Tanzania.jpg/512px-Safari_Tanzania.jpg&quot; alt=&quot;Safari Tanzania&quot;&gt;&lt;/a&gt;&lt;br&gt;
The web developer (front) and surfer (back).&lt;/p&gt;
&lt;p&gt;The web developer, taking a deep breath, before replying in his loudest voice, NO! Don’t you see that all the features, we had with other vendors, are missing on this trip? One company even managed to deliver a great experience after the car went out of petrol, that was awesome, he added.&lt;/p&gt;
&lt;p&gt;And thereby ends the story of a grumpy web developer and a happy surfer.&lt;/p&gt;
&lt;p&gt;* Not related to recent articles and discussion about Safari (web browser), isn’t it? Also, I am strictly against Linkbait!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs - The last issue</title>
							<link>https://justmarkup.com/log/2015/07/browsers-and-bugs-the-last-issue/</link>
							<pubDate>2015-07-06T15:48:58+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/browsers-and-bugs-the-last-issue/</guid>
							<description>&lt;p&gt;I have been publishing a new issue of Browsers and Bugs every Friday for 24 weeks in a row until my vacation two weeks ago. After the break, I wanted to start collecting links and deciding what’s worth adding to the list again these days, but it doesn’t feel right anymore.&lt;/p&gt;
&lt;p&gt;I got next to nothing on feedback for any of the published articles and don’t know anymore how to justify 2-4 hours of work a week I usually spent on this. Don’t get me wrong, I never expected a lot of feedback and never thought about turning it viral or making money out of it – I wanted to share links I thought are worth reading, inform people about fixed browser bugs, new browser features, tips for testing and debugging and overall all about Browsers and Bugs.&lt;/p&gt;
&lt;p&gt;It was fun, always informing, mostly interesting and never boring to read all the articles, tips and videos and to decide what content fits into Browsers and Bugs.&lt;/p&gt;
&lt;p&gt;Looks like it didn’t work as expected.&lt;/p&gt;
&lt;p&gt;Maybe it was the name.&lt;br&gt;
Maybe I listed links everybody already read.&lt;br&gt;
Maybe I should have added personal notes for all links.&lt;br&gt;
Maybe I should have published it on another day or time.&lt;br&gt;
Maybe it was me.&lt;br&gt;
Maybe it was you.&lt;br&gt;
Maybe I use maybe too often.&lt;/p&gt;
&lt;p&gt;I still have a lot of ideas about Browsers and Bugs and how it might return someday, but right now, I feel better to work on other side projects for the next time.&lt;/p&gt;
&lt;p&gt;Have a nice day and please don’t stop writing bug reports, testing new features and share your knowledge to make browsers even better.&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;br&gt;
Michael&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Progressive enhancement is not…</title>
							<link>https://justmarkup.com/log/2015/07/progressive-enhancement-is-not/</link>
							<pubDate>2015-07-03T08:50:33+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/07/progressive-enhancement-is-not/</guid>
							<description>&lt;p&gt;… an add-on.&lt;br&gt;
… adding a fallback for every feature you want to use.&lt;br&gt;
… about thinking in browser versions.&lt;br&gt;
… about making it work without JavaScript.&lt;br&gt;
… the answer to the universe life and everything – that’s 42.&lt;br&gt;
…&lt;/p&gt;
&lt;p&gt;I couldn’t attend &lt;a href=&quot;https://edgeconf.com/2015-london&quot;&gt;EdgeConf&lt;/a&gt; last weekend as I was on holiday but reading through my twitter stream it looks like there was a lot of great discussions about &lt;a href=&quot;https://decadecity.net/blog/2015/06/27/edge-conf-progressive-enhancement&quot;&gt;Progressive Enhancement&lt;/a&gt; – &lt;a href=&quot;https://adactio.com/journal/9206&quot;&gt;Baseline&lt;/a&gt;, &lt;a href=&quot;https://remysharp.com/2015/07/02/assumptions&quot;&gt;Assumptions&lt;/a&gt;, &lt;a href=&quot;http://timkadlec.com/2015/06/thriving-in-unpredictability/&quot;&gt;Unpredictability&lt;/a&gt;, &lt;a href=&quot;http://www.kryogenix.org/days/2015/06/28/availability/&quot;&gt;Availability&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I, for myself, like to define Progressive Enhancement as use-case oriented programming™.&lt;/p&gt;
&lt;p&gt;What does that mean? Let’s start with a sample used by many sites – showing a video. For me, this means first of all I would add plain old HTML with the transcript of the video making it accessible to as many people as possible – that’s our baseline. Next, I would a link in HTML to the video source (preferable different formats/qualities if you have them), so every device, browser, whatever able to render HTML will show the link and give the user the possibility to download it. Next I would add the &lt;a href=&quot;http://justmarkup.com/log/2015/01/13/the-download-attribute/&quot;&gt;download attribute&lt;/a&gt; to the link so browsers supporting this attribute will directly open the “Save as…” dialog on click. As the next step, I would then add the HTML video element, with sources to all available formats I have for the video, so users surfing with a newer browser will be able to watch the video right away. As a final step, I could add some JavaScript (only loaded if the browser &lt;a href=&quot;https://justmarkup.com/log/2015/02/26/cut-the-mustard-revisited/&quot;&gt;Cuts the mustard&lt;/a&gt; for the features I want to use), to enhance the player functionality.&lt;/p&gt;
&lt;p&gt;Note, that I don’t add any fallback (Flash, Silverlight…) here as this would mean loading Polyfills or most likely using a library which adds a fallback for flash for older browsers. There is absolutely no need here for spending time in development to fully support all the browsers with a video player. We already have a “fallback”, it’s just not a fallback it’s our baseline – a transcript of the video in HTML. Do web sites need to look the same in every browser – &lt;a href=&quot;http://dowebsitesneedtolookexactlythesameineverybrowser.com/&quot;&gt;NO&lt;/a&gt;. Do web sites need to have the same non-core functionalities in every browser – NO.&lt;/p&gt;
&lt;p&gt;This is Progressive Enhancement for me, start with thinking about the use-case – in this example, “User should be able to consume the content of the video”. If this baseline is in place you can enhance to whatever level you think is right.&lt;/p&gt;
&lt;p&gt;I would like to know your opinion, let’s talk &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;@justmarkup&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 24/2015</title>
							<link>https://justmarkup.com/log/2015/06/browsers-and-bugs-242015/</link>
							<pubDate>2015-06-18T13:32:49+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/06/browsers-and-bugs-242015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 24 of Browsers and Bugs. As I am in Brighton for &lt;a href=&quot;http://responsiveconf.com/&quot;&gt;Responsive Day Out&lt;/a&gt; tomorrow you can enjoy this issue already today. Furthermore, as I am on holiday on an island in Italy starting next week for 10 days there won’t be a new issue the next 2 weeks. Enjoy the summer.&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;building-a-more-interoperable-web-with-microsoft-edge&quot;&gt;&lt;a href=&quot;http://blogs.windows.com/msedgedev/2015/06/17/building-a-more-interoperable-web-with-microsoft-edge/&quot;&gt;Building a more interoperable Web with Microsoft Edge&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#building-a-more-interoperable-web-with-microsoft-edge&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Why user agents are an ever-growing pack of lies; on browsers working around developer errors (eg. correcting charset=”utf8″ to charset=”utf-8″) and much more.&lt;/p&gt;
&lt;h3 id=&quot;from-asm.js-to-webassembly&quot;&gt;&lt;a href=&quot;https://brendaneich.com/2015/06/from-asm-js-to-webassembly/&quot;&gt;From ASM.JS to WebAssembly&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#from-asm.js-to-webassembly&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Browser vendors are collaborating on a WebAssembly standard. You can find some more information and &lt;a href=&quot;https://github.com/WebAssembly/design/blob/master/FAQ.md&quot;&gt;FAQ’s&lt;/a&gt; in the Gitub Repo.&lt;/p&gt;
&lt;h3 id=&quot;firefox%3B-bug-366324&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=366324#c63&quot;&gt;Firefox; Bug 366324&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox%3B-bug-366324&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;SVG site icons (favicons, shortcut icons) support&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;chrome-devtools%2C-front-to-back&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=_-XfJWl6sRs&quot;&gt;Chrome DevTools, Front to Back&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-devtools%2C-front-to-back&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Talk from Katie Fenn presented at ScotlandJS&lt;/p&gt;
&lt;h3 id=&quot;browserremote&quot;&gt;&lt;a href=&quot;https://github.com/auchenberg/browser-remote&quot;&gt;BrowserRemote&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#browserremote&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Debug your user’s browser remotely via Chrome DevTools. Read more about in the &lt;a href=&quot;https://kenneth.io/blog/2015/06/16/use-chrome-devtools-to-debug-your-users-browser-remotely-with-browserremote/&quot;&gt;blog post&lt;/a&gt; from Kenneth Auchenberg.&lt;/p&gt;
&lt;h3 id=&quot;browserstack&quot;&gt;&lt;a href=&quot;https://twitter.com/jon_neal/status/610482003687907328&quot;&gt;BrowserStack&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#browserstack&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can no test Microsoft Edge on BrowserStack.&lt;/p&gt;
&lt;h3 id=&quot;view-jquery-and-jquery-live-events-in-firefox-devtools&quot;&gt;&lt;a href=&quot;http://flailingmonkey.com/view-jquery-and-jquery-live-events-in-firefox-devtools/&quot;&gt;View jQuery and jQuery Live events in Firefox DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#view-jquery-and-jquery-live-events-in-firefox-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 23/2015</title>
							<link>https://justmarkup.com/log/2015/06/browsers-and-bugs-232015/</link>
							<pubDate>2015-06-12T06:02:57+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/06/browsers-and-bugs-232015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 23 of Browsers and Bugs. Happy testing.&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;what%E2%80%99s-new-in-safari-9&quot;&gt;&lt;a href=&quot;https://developer.apple.com/library/prerelease/mac/releasenotes/General/WhatsNewInSafari/Articles/Safari_9.html#//apple_ref/doc/uid/TP40014305-CH9-SW27&quot;&gt;What’s new in Safari 9&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#what%E2%80%99s-new-in-safari-9&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;CSS Scroll Snapping, Backdrop Filters, Responsive Design Mode, @support, Unprefixed CSS Properties and ECMAScript 6 Enhancements. If you prefer watching there is also a &lt;a href=&quot;https://developer.apple.com/videos/wwdc/2015/?id=501&quot;&gt;Video&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;opera-mini-for-windows-phone&quot;&gt;&lt;a href=&quot;http://blogs.opera.com/mobile/2015/06/opera-mini-for-windows-phone/&quot;&gt;Opera Mini for Windows Phone&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-mini-for-windows-phone&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First stable version of Opera Mini for &lt;a href=&quot;https://www.windowsphone.com/en-us/store/app/opera-mini/b3bf000a-e004-4ecb-a8fb-9fc817cdab90&quot;&gt;Windows Phone 8.1&lt;/a&gt; is now available in the Windows Phone App Store.&lt;/p&gt;
&lt;h3 id=&quot;introducing-srcset-in-microsoft-edge&quot;&gt;&lt;a href=&quot;http://blogs.windows.com/msedgedev/2015/06/08/introducing-srcset-responsive-images-in-microsoft-edge/&quot;&gt;Introducing srcset in Microsoft Edge&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#introducing-srcset-in-microsoft-edge&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Windows 10 Insider builds recently introduced support for srcset, our first step on the path to fully supporting the picture element for responsive images. Support for the width descriptor in srcset, and the sizes attribute is not yet implemented but will land in the near future.&lt;/p&gt;
&lt;h3 id=&quot;opera-30&quot;&gt;&lt;a href=&quot;https://dev.opera.com/blog/opera-30/&quot;&gt;Opera 30&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-30&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The autocapitalize HTML attribute, Cache API, Permissions API, JavaScript-powered copy/cut functionality and much more.&lt;/p&gt;
&lt;h3 id=&quot;translate3d(0%2C0%2C0)&quot;&gt;&lt;a href=&quot;http://trac.webkit.org/changeset/185284&quot;&gt;translate3d(0,0,0)&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#translate3d(0%2C0%2C0)&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;WebKit will ignore “translateZ(0), translate3d(0,0,0)…” on devices with 512MB or less.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;debugging-promises-with-devtools&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=o9c3U5_8tGY&amp;amp;list=PLOU2XLYxmsILKwwASNS0xgfcmakbK_8JZ&quot;&gt;Debugging Promises with DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#debugging-promises-with-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In this episode of Totally Tooling Tips, Addy Osmani and Matt Gaunt walk through how to debug ES6 Promises using the brand new Promises debugger in Chrome DevTools.&lt;/p&gt;
&lt;h3 id=&quot;devtool-tricks-for-when-i-forget&quot;&gt;&lt;a href=&quot;https://remysharp.com/2015/06/09/devtool-tricks-for-when-i-forget&quot;&gt;Devtool tricks for when I forget&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtool-tricks-for-when-i-forget&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Remy Sharp demonstrates how to capture XHR results and retrieve results from the ether.&lt;/p&gt;
&lt;h3 id=&quot;pagespeed-insights&quot;&gt;&lt;a href=&quot;http://una.im/gulp-local-psi/#&quot;&gt;PageSpeed Insights&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#pagespeed-insights&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Setting up PageSpeed Insights within existing gulp projects.&lt;/p&gt;
&lt;h3 id=&quot;tota11y&quot;&gt;&lt;a href=&quot;http://khan.github.io/tota11y/&quot;&gt;tota11y&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#tota11y&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;tota11y is a tool which helps visualize how your site performs with assistive technologies.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 22/2015</title>
							<link>https://justmarkup.com/log/2015/06/browsers-and-bugs-222015/</link>
							<pubDate>2015-06-05T04:21:05+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/06/browsers-and-bugs-222015/</guid>
							<description>&lt;p&gt;It’s friday and thus a new round of Browsers and Bugs is ready for you. Hello and welcome to issue 22. Happy bug reporting.&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;chrome-44-beta&quot;&gt;&lt;a href=&quot;http://blog.chromium.org/2015/06/chrome-44-beta-improvements-to.html&quot;&gt;Chrome 44 Beta&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-44-beta&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Improvements to Notifications API and promoted add to homescreen&lt;/p&gt;
&lt;h3 id=&quot;opera-browsers-overview&quot;&gt;&lt;a href=&quot;https://dev.opera.com/articles/browsers-modes-engines/&quot;&gt;Opera Browsers Overview&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-browsers-overview&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are lots of different Opera browsers with different engines and platform availability – this is a great overview of all of them.&lt;/p&gt;
&lt;h3 id=&quot;firefox-platform-rendering&quot;&gt;&lt;a href=&quot;http://junglecode.net/firefox-platform-rendering-current-work/&quot;&gt;Firefox platform rendering&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-platform-rendering&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;An overview of features the Firefox platform team is working on.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;performance-tools-in-firefox-devtools&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/06/new-performance-tools-in-firefox-developer-edition-40/&quot;&gt;Performance Tools in Firefox DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#performance-tools-in-firefox-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Firefox Developer Edition features a new performance tool that gives developers a better understanding of what is happening from a performance standpoint within their applications.&lt;/p&gt;
&lt;h3 id=&quot;scroll-performance&quot;&gt;&lt;a href=&quot;http://wijmo.com/fix-flexgrid-scroll-performance-in-ie-with-this-one-weird-trick/&quot;&gt;Scroll Performance&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#scroll-performance&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes a simple border-radius: 4px can cause scrolling performance issues.&lt;/p&gt;
&lt;h3 id=&quot;the-most-exciting-part-of-computer-programming&quot;&gt;&lt;a href=&quot;https://twitter.com/neillyneil/status/604920707680731137/photo/1&quot;&gt;The most exciting part of computer programming&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#the-most-exciting-part-of-computer-programming&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;optimize-javascript-with-devtools&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/06/power-surge-optimize-the-javascript-in-this-html5-game-using-firefox-developer-edition/&quot;&gt;Optimize JavaScript with DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#optimize-javascript-with-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A screencast on how to use the new performance tools in Firefox Devtools to optimize JavaScript.&lt;/p&gt;
&lt;h3 id=&quot;heroes-of-javascript-and-testing&quot;&gt;&lt;a href=&quot;http://dm.gl/2015/05/29/heroes-of-javascript-and-testing/&quot;&gt;Heroes of JavaScript and Testing&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#heroes-of-javascript-and-testing&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;please-update-picturefill&quot;&gt;&lt;a href=&quot;https://css-tricks.com/please-update-picturefill/&quot;&gt;Please Update Picturefill&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#please-update-picturefill&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you’re using a version of Picturefill from prior to 2.3.1, please update right away – this is important for the web.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 21/2015</title>
							<link>https://justmarkup.com/log/2015/05/browsers-and-bugs-212015/</link>
							<pubDate>2015-05-29T06:18:07+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/05/browsers-and-bugs-212015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 21 of Browsers and Bugs. Happy bug reporting!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;flexbox-bugs&quot;&gt;&lt;a href=&quot;http://benfrain.com/flexbox-gotchas-for-android-2-1-4-3-stock-browser/&quot;&gt;Flexbox bugs&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#flexbox-bugs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Flexbox gotchas for Android 2.1 – 4.3 (stock browser).&lt;/p&gt;
&lt;h3 id=&quot;css-transform-module-level-2&quot;&gt;&lt;a href=&quot;https://www.chromestatus.com/feature/5705698193178624&quot;&gt;CSS Transform Module Level 2&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#css-transform-module-level-2&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Intent to Implement: Independent Properties for CSS Transforms (scale, translate, rotate) in Chromium.&lt;/p&gt;
&lt;h3 id=&quot;svg-sprite&quot;&gt;&lt;a href=&quot;http://fvsch.com/code/svg-sprite/&quot;&gt;SVG sprite&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#svg-sprite&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Tests and notes about browser support for referencing an external SVG file in HTML.&lt;/p&gt;
&lt;h3 id=&quot;assistive-technologies&quot;&gt;&lt;a href=&quot;https://www.linkedin.com/grp/post/4512178-6009113313206616068&quot;&gt;Assistive Technologies&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#assistive-technologies&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Update for IE with future considerations for Assistive Technologies and integrated Accessibility API support in Windows 10 with Edge.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;w3c-developer-tools&quot;&gt;&lt;a href=&quot;https://www.w3.org/developers/tools&quot;&gt;W3C developer tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#w3c-developer-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Various tools and validators to test your site.&lt;/p&gt;
&lt;h3 id=&quot;browser-testing&quot;&gt;&lt;a href=&quot;https://adactio.com/journal/8982&quot;&gt;Browser testing&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#browser-testing&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;So to put it in glib terms, I support every browser …but I optimise for none.&lt;/p&gt;
&lt;h3 id=&quot;throttled-thursdays&quot;&gt;&lt;a href=&quot;http://fourword.fourkitchens.com/article/throttled-thursdays&quot;&gt;Throttled Thursdays&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#throttled-thursdays&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Throttle your internet connection once a week to embrace the pain of slow sites and improve performance.&lt;/p&gt;
&lt;h3 id=&quot;consolebot&quot;&gt;&lt;a href=&quot;https://github.com/meenie/console-bot&quot;&gt;ConsoleBot&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#consolebot&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Allows savvy developers to chat to a website owner via the browser console.&lt;/p&gt;
&lt;h3 id=&quot;friefox-devtools&quot;&gt;&lt;a href=&quot;https://twitter.com/MozDevNet/status/603696014529273856&quot;&gt;Friefox DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#friefox-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Access MDN directly within the Firefox DevTools.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 20/2015</title>
							<link>https://justmarkup.com/log/2015/05/browsers-and-bugs-202015/</link>
							<pubDate>2015-05-22T03:58:35+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/05/browsers-and-bugs-202015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 20 of Browsers and Bugs. Happy bug fixing!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;opera-mini&quot;&gt;&lt;a href=&quot;http://www.operasoftware.com/press/releases/mobile/2015-05-18&quot;&gt;Opera Mini&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-mini&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Opera Mini consumes 14% less battery and 89% less data on an average than other mobile browsers&lt;/p&gt;
&lt;h3 id=&quot;fixing-the-scrolltop-bug&quot;&gt;&lt;a href=&quot;https://dev.opera.com/articles/fixing-the-scrolltop-bug/&quot;&gt;Fixing the scrollTop bug&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#fixing-the-scrolltop-bug&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;…they have to copy WebKit/Blink’s bugs in order to be compatible with the Web.&lt;/p&gt;
&lt;h3 id=&quot;windows-preview-build-10122&quot;&gt;&lt;a href=&quot;http://dev.modern.ie/platform/changelog/10122--desktop/&quot;&gt;Windows Preview Build 10122&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#windows-preview-build-10122&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Support for date/week/month inputs and news CSS3 cursor values among others.&lt;/p&gt;
&lt;h3 id=&quot;delivering-fast-javascript-performance-in-microsoft-edge&quot;&gt;&lt;a href=&quot;http://blogs.windows.com/msedgedev/2015/05/20/delivering-fast-javascript-performance-in-microsoft-edge/&quot;&gt;Delivering fast JavaScript performance in Microsoft Edge&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#delivering-fast-javascript-performance-in-microsoft-edge&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;what%E2%80%99s-new-in-firefox-40-devtools&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/05/developer-edition-40-always-active-network-monitoring-css-rules-filtering-and-more/&quot;&gt;What’s new in Firefox 40 DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#what%E2%80%99s-new-in-firefox-40-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Always active network monitoring, CSS rules filtering, and much more&lt;/p&gt;
&lt;h3 id=&quot;how-to-make-useful-bug-reports&quot;&gt;&lt;a href=&quot;https://css-tricks.com/considerations-on-bug-reporting-in-teams/&quot;&gt;How to make useful bug reports&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#how-to-make-useful-bug-reports&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Getting bug reports lacking information is really frustrating – this article describes how to do it better. For getting &lt;a href=&quot;https://justmarkup.com/bugreporter&quot;&gt;browser details&lt;/a&gt; I shameless recommend this tool my clients use frequently.&lt;/p&gt;
&lt;h3 id=&quot;perfbar&quot;&gt;&lt;a href=&quot;http://lafikl.github.io/perfBar/&quot;&gt;PerfBar&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#perfbar&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Simple way to collect and look at your website performance metrics quickly, that supports budgeting and adding custom metrics.&lt;/p&gt;
&lt;h3 id=&quot;time-travel-debugging-for-javascript%2Fhtml-applications&quot;&gt;&lt;a href=&quot;https://channel9.msdn.com/blogs/Marron/Time-Travel-Debugging-for-JavaScriptHTML&quot;&gt;Time-Travel Debugging for JavaScript/HTML Applications&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#time-travel-debugging-for-javascript%2Fhtml-applications&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This video from Microsoft Research describes an experimental time-traveling debugger inside the next-generation Microsoft Edge web browser.&lt;/p&gt;
&lt;h3 id=&quot;devtools-snippets&quot;&gt;&lt;a href=&quot;https://github.com/bgrins/devtools-snippets&quot;&gt;DevTools snippets&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtools-snippets&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Not the newest &lt;a href=&quot;http://bgrins.github.io/devtools-snippets/&quot;&gt;collection&lt;/a&gt; but still very useful.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Monitor load time performance with Piwik</title>
							<link>https://justmarkup.com/log/2015/05/monitor-load-time-performance-with-piwik/</link>
							<pubDate>2015-05-20T08:53:58+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/05/monitor-load-time-performance-with-piwik/</guid>
							<description>&lt;p&gt;Yesterday I came across this great article about &lt;a href=&quot;http://githubengineering.com/browser-monitoring-for-github-com/&quot;&gt;Browser Monitoring at Github&lt;/a&gt; and how they use the &lt;a href=&quot;http://www.w3.org/TR/navigation-timing/&quot;&gt;Navigation Timing API&lt;/a&gt; to monitor page performance.&lt;/p&gt;
&lt;p&gt;As I use &lt;a href=&quot;http://piwik.org/&quot;&gt;Piwik&lt;/a&gt; to analyze and monitor the traffic on my site I thought about a way to combine both to monitor the load time of my site. After some testing, I came up with the following solution.&lt;/p&gt;
&lt;p&gt;First of all we define a function to get the load time using the Navigation Timing API:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;getPerfTiming&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;performance&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;timing&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;performance&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;navigation&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;performance&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; timing &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;performance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;timing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;            now &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;            start &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; timing&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;navigationStart&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;            loadTime&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        loadTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;now &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ms&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            loadTime&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; loadTime&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-piwik-to-save-results&quot;&gt;Use Piwik to save results &lt;a class=&quot;permalink&quot; href=&quot;#use-piwik-to-save-results&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Next we need to change the Piwik code used on the site. We need to define a &lt;a href=&quot;http://piwik.org/docs/custom-variables/&quot;&gt;custom variable&lt;/a&gt; before calling piwikTracker.trackPageView().&lt;/p&gt;
&lt;p&gt;Using the function from above this looks like the following:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getPerfTiming&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    piwikTracker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCustomVariable&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// slot ID - up to 5 custom variables can be used&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;loadTime&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// name of the custom variable&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token function&quot;&gt;getPerfTiming&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;loadTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// value of the custom variable&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;page&quot;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// scope - page means it gets send on every page load&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;piwikTracker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;trackPageView&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;monitor-results-on-your-piwik-instance&quot;&gt;Monitor results on your Piwik instance &lt;a class=&quot;permalink&quot; href=&quot;#monitor-results-on-your-piwik-instance&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After logging into your Piwik instance, you can go to Visitors -&amp;gt; Custom Variables to all the variables you defined with piwikTracker.setCustomVariable&lt;br&gt;
&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/05/piwik_report.png&quot; alt=&quot;Custom Variables in piwik&quot;&gt;&lt;/p&gt;
&lt;p&gt;I implemented this today on my site and I am already really curious how the load time will differ for the users. To monitor other performance aspects like first paint, you can use additional custom variables if you like.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 19/2015</title>
							<link>https://justmarkup.com/log/2015/05/browsers-and-bugs-192015/</link>
							<pubDate>2015-05-16T07:45:17+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/05/browsers-and-bugs-192015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 19 of Browsers and Bugs. Happy bug reporting!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;firefox-38-for-developers&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/Firefox/Releases/38&quot;&gt;Firefox 38 for developers&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-38-for-developers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Ships with &lt;a href=&quot;https://hacks.mozilla.org/2015/05/trainspotting-firefox-38/&quot;&gt;Responsive Image Support&lt;/a&gt; and lots of bug fixes.&lt;/p&gt;
&lt;h3 id=&quot;spec-allows-use-of-appcache-to-provide-fallback-for-serviceworker&quot;&gt;&lt;a href=&quot;https://twitter.com/service_workers/status/598727002624040961&quot;&gt;Spec allows use of AppCache to provide fallback for ServiceWorker&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#spec-allows-use-of-appcache-to-provide-fallback-for-serviceworker&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;More info in the &lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=410665&quot;&gt;Chromium&lt;/a&gt; and &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1163545&quot;&gt;Firefox&lt;/a&gt; bug tracker.&lt;/p&gt;
&lt;h3 id=&quot;this-is-for-everyone-with-a-certificate&quot;&gt;&lt;a href=&quot;https://adactio.com/journal/8932&quot;&gt;This is for everyone with a certificate&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#this-is-for-everyone-with-a-certificate&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Jeremy Keith about deprecating HTTP in favour of HTTPS.&lt;/p&gt;
&lt;h3 id=&quot;what%E2%80%99s-new-in-the-f12-developer-tools&quot;&gt;&lt;a href=&quot;https://channel9.msdn.com/Events/WebPlatformSummit/2015/Whats-new-in-the-F12-Developer-Tools&quot;&gt;What’s new in the F12 Developer Tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#what%E2%80%99s-new-in-the-f12-developer-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Video from the Microsoft Edge Web Summit.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;reducing-memory-leaks-when-working-with-animations&quot;&gt;&lt;a href=&quot;http://davidwalsh.name/reducing-memory-leaks-working-animations&quot;&gt;Reducing Memory Leaks when Working with Animations&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#reducing-memory-leaks-when-working-with-animations&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;responsive-design-dashboard&quot;&gt;&lt;a href=&quot;https://speedcurve.com/blog/responsive-design-performance-testing/&quot;&gt;Responsive Design Dashboard&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#responsive-design-dashboard&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Great tool from Speedcurve&lt;/p&gt;
&lt;h3 id=&quot;firefox-devtools&quot;&gt;&lt;a href=&quot;https://twitter.com/malyw/status/597741418979831808&quot;&gt;Firefox DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Attributes change animation&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 18/2015</title>
							<link>https://justmarkup.com/log/2015/05/browsers-and-bugs-182015/</link>
							<pubDate>2015-05-08T06:24:48+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/05/browsers-and-bugs-182015/</guid>
							<description>&lt;p&gt;It’s friday and thus a new round of Browsers and Bugs is ready for you. Hello and welcome to issue 18. Happy bug fixing!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;copy%2Fpaste-via-javascript&quot;&gt;&lt;a href=&quot;https://groups.google.com/forum/#!msg/mozilla.dev.platform/oWhmLMvGAD0/3eXWSRjJAZsJ&quot;&gt;Copy/Paste via JavaScript&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#copy%2Fpaste-via-javascript&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After Chrome and IE also Firefox is shipping document.execCommand(“cut”/”copy”).&lt;/p&gt;
&lt;h3 id=&quot;microsoft-edge-web-summit-2015&quot;&gt;&lt;a href=&quot;https://channel9.msdn.com/Events/WebPlatformSummit/2015&quot;&gt;Microsoft Edge Web Summit 2015&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#microsoft-edge-web-summit-2015&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;All videos from the summit are online now.&lt;/p&gt;
&lt;h3 id=&quot;ie-guides&quot;&gt;&lt;a href=&quot;https://msdn.microsoft.com/en-us/library/dn997182(v=vs.85).aspx&quot;&gt;IE Guides&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ie-guides&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Developer Guides for IE7 – Edge&lt;/p&gt;
&lt;h3 id=&quot;firefox-os-for-tv-ux-overview&quot;&gt;&lt;a href=&quot;https://blog.mozilla.org/ux/2015/04/firefox-os-for-tv-ux-overview/&quot;&gt;Firefox OS for TV UX Overview&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-os-for-tv-ux-overview&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;chrome-devtools%3A-front-to-back&quot;&gt;&lt;a href=&quot;http://slidr.io/katiefenn/chrome-devtools-front-to-back&quot;&gt;Chrome DevTools: Front to Back&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-devtools%3A-front-to-back&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Great slides from Katie Fenn&lt;/p&gt;
&lt;h3 id=&quot;f12-developer-tools&quot;&gt;&lt;a href=&quot;https://msdn.microsoft.com/en-us/library/bg182326(v=vs.85).aspx&quot;&gt;F12 developer tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#f12-developer-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Using the F12 developer tools, you can debug, test, and speed up your webpages.&lt;/p&gt;
&lt;h3 id=&quot;cross-browser-source-maps&quot;&gt;&lt;a href=&quot;http://www.sitepoint.com/enhance-your-javascript-debugging-with-cross-browser-source-maps/&quot;&gt;Cross-Browser Source Maps&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#cross-browser-source-maps&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Enhance Your JavaScript Debugging with Cross-Browser Source Maps&lt;/p&gt;
&lt;h3 id=&quot;filmstrip-view&quot;&gt;&lt;a href=&quot;http://webperformance.io/devtools-filmstrip&quot;&gt;Filmstrip View&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#filmstrip-view&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Starting with Chrome 44 you can generate filmstrips with Chrome DevTools&lt;/p&gt;
&lt;h3 id=&quot;vorlon.js&quot;&gt;&lt;a href=&quot;http://vorlonjs.com/&quot;&gt;Vorlon.JS&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#vorlon.js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;An open source, extensible, platform-agnostic tool for remotely debugging and testing your JavaScript.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 17/2015</title>
							<link>https://justmarkup.com/log/2015/05/browsers-and-bugs-172015/</link>
							<pubDate>2015-05-01T06:43:17+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/05/browsers-and-bugs-172015/</guid>
							<description>&lt;p&gt;Another friday, another new issue of Browsers and Bugs. Hello and welcome to number 17. Happy bug reporting!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;hello-my-name-is-edge%2C-microsoft-edge.&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/04/29/microsoft-edge-is-the-browser-for-windows-10.aspx&quot;&gt;Hello my name is Edge, Microsoft Edge.&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#hello-my-name-is-edge%2C-microsoft-edge.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Except from the name they also announced that you will be able to install Chrome/Firefox &lt;a href=&quot;http://blogs.windows.com/bloggingwindows/2015/04/29/welcoming-developers-to-windows-10/&quot;&gt;extension&lt;/a&gt;. If you want to know more do a &lt;a href=&quot;https://www.google.com/search?q=edge&quot;&gt;image search&lt;/a&gt; 🙂&lt;/p&gt;
&lt;h3 id=&quot;dev-channel-for-chrome-on-android&quot;&gt;&lt;a href=&quot;http://blog.chromium.org/2015/04/dev-channel-for-chrome-on-android.html&quot;&gt;Dev channel for Chrome on Android&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#dev-channel-for-chrome-on-android&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Chrome’s Dev channel allows you to test out your sites using an early version of Chrome to find bugs. If you find a browser bug you might consider reporting it on the Chromium &lt;a href=&quot;https://code.google.com/p/chromium/issues/list&quot;&gt;bug tracker&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;opera-turbo&quot;&gt;&lt;a href=&quot;http://blogs.opera.com/mobile/2015/04/opera-turbo-opera-for-android/&quot;&gt;Opera Turbo&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-turbo&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The new version of Opera for Android comes with Opera Turbo mode, automatic text-wrap and other new features.&lt;/p&gt;
&lt;h3 id=&quot;webkit-web-platform-status&quot;&gt;&lt;a href=&quot;http://www.webkit.org/status.html&quot;&gt;WebKit Web Platform Status&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#webkit-web-platform-status&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After &lt;a href=&quot;https://www.chromestatus.com/features&quot;&gt;Chromium&lt;/a&gt; and &lt;a href=&quot;https://status.modern.ie/&quot;&gt;Internet Explorer&lt;/a&gt; now also WebKit has a &lt;a href=&quot;http://www.webkit.org/status.html&quot;&gt;web platform status page&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;pointer-events&quot;&gt;&lt;a href=&quot;https://groups.google.com/forum/#!topic/mozilla.dev.platform/l45DAXyLCAM&quot;&gt;Pointer Events&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#pointer-events&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Pointer Events will be enabled in Firefox Nightly builds within the next few weeks.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;chrome-devtools&quot;&gt;&lt;a href=&quot;https://medium.com/@bdauton/upcoming-features-in-the-next-chrome-devtools-b7edcb3002a5&quot;&gt;Chrome DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A list of upcoming features including Layout mode, Animations and Color Picker.&lt;/p&gt;
&lt;h3 id=&quot;jank-free&quot;&gt;&lt;a href=&quot;http://jankfree.org/&quot;&gt;Jank Free&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#jank-free&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Great resources for building smooth web sites.&lt;/p&gt;
&lt;h3 id=&quot;chromium-accessibility-bugs&quot;&gt;&lt;a href=&quot;https://groups.google.com/a/chromium.org/forum/#!msg/chromium-accessibility/uJeIdCZ_bto/GC_35OR7oD4J&quot;&gt;Chromium accessibility bugs&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chromium-accessibility-bugs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you want to get notified about all accessibility bugs in Chromium, here is the way to subscribe.&lt;/p&gt;
&lt;h3 id=&quot;ios-webkit-debug-proxy&quot;&gt;&lt;a href=&quot;https://github.com/google/ios-webkit-debug-proxy&quot;&gt;iOS WebKit Debug Proxy&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ios-webkit-debug-proxy&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A DevTools proxy (WebKit Remote Debugging Protocol) for iOS devices (Safari Remote Web Inspector).&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 16/2015</title>
							<link>https://justmarkup.com/log/2015/04/browsers-and-bugs-162015/</link>
							<pubDate>2015-04-24T07:40:21+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/04/browsers-and-bugs-162015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 16 of Browsers and Bugs. May your bug reports be as clear and sunny as the weather here in Berlin. Happy bug fixing!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;ncsa-mosaic&quot;&gt;&lt;a href=&quot;https://twitter.com/internetsociety/status/590863343444975616/photo/1&quot;&gt;NCSA Mosaic&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ncsa-mosaic&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The first web browser with the ability to display text and images inline, was released on 22.4.1993 – 22 years ago!&lt;/p&gt;
&lt;h3 id=&quot;new-features-in-project-spartan&quot;&gt;&lt;a href=&quot;https://twitter.com/dstorey/status/591297222802800640&quot;&gt;New features in Project Spartan&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#new-features-in-project-spartan&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Including Media Capture/getUserMeda, ASM.js &amp;amp; Generators and a lots more.&lt;/p&gt;
&lt;h3 id=&quot;client-hints&quot;&gt;&lt;a href=&quot;https://lists.webkit.org/pipermail/webkit-dev/2015-April/027381.html&quot;&gt;Client-Hints&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#client-hints&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Yoav Weiss is going to implement Client-Hints in WebKit.&lt;/p&gt;
&lt;h3 id=&quot;web-manifest&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1083410&quot;&gt;Web manifest&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#web-manifest&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Web manifest obtainer landed in Gecko&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;ghostlab-2&quot;&gt;&lt;a href=&quot;https://css-tricks.com/using-chrome-devtools-to-debug-javascript-in-any-browser-with-ghostlab-2/&quot;&gt;Ghostlab 2&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ghostlab-2&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Using Chrome DevTools to Debug JavaScript in Any Browser with Ghostlab 2.&lt;/p&gt;
&lt;h3 id=&quot;is-anyone-testing-on-mobile%3F&quot;&gt;&lt;a href=&quot;http://webreflection.blogspot.co.uk/2015/04/is-anyone-testing-on-mobile.html&quot;&gt;Is Anyone Testing On Mobile?&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#is-anyone-testing-on-mobile%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;debugging-the-mobile-web&quot;&gt;&lt;a href=&quot;http://callahad.github.io/fluent-web-debugging&quot;&gt;Debugging the Mobile Web&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#debugging-the-mobile-web&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Slides from Mike Taylor and Dan Callahan from their talk at Fluent conference.&lt;/p&gt;
&lt;h3 id=&quot;devtools-timeline%3A-now-providing-the-full-story&quot;&gt;&lt;a href=&quot;http://updates.html5rocks.com/2015/04/devtools-timeline-improvements&quot;&gt;DevTools Timeline: Now Providing the Full Story&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtools-timeline%3A-now-providing-the-full-story&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;aviewer&quot;&gt;&lt;a href=&quot;http://www.paciellogroup.com/blog/2015/04/aviewer-accessibility-inspection-tool-on-github/&quot;&gt;aViewer&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#aviewer&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The accessibility inspection tool from the Paciello Group is now available as open source on &lt;a href=&quot;https://github.com/ThePacielloGroup/aviewer&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 15/2015</title>
							<link>https://justmarkup.com/log/2015/04/browsers-and-bugs-152015/</link>
							<pubDate>2015-04-17T08:09:06+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/04/browsers-and-bugs-152015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 15 of Browsers and Bugs. Happy debugging!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;insecure-http&quot;&gt;&lt;a href=&quot;https://groups.google.com/forum/#!topic/mozilla.dev.platform/xaGffxAM-hs%5B1-25%5D&quot;&gt;Insecure HTTP&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#insecure-http&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Both &lt;a href=&quot;https://www.chromium.org/Home/chromium-security/marking-http-as-non-secure&quot;&gt;Chrome&lt;/a&gt; and &lt;a href=&quot;https://groups.google.com/forum/#!topic/mozilla.dev.platform/xaGffxAM-hs%5B1-25%5D&quot;&gt;Firefox&lt;/a&gt; will mark HTTP as Non-Secure in the future.&lt;/p&gt;
&lt;h3 id=&quot;chrome-43&quot;&gt;&lt;a href=&quot;http://blog.chromium.org/2015/04/chrome-43-beta-web-midi-and-upgrading.html&quot;&gt;Chrome 43&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-43&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Connecting to MIDI devices from the web, Permissions API, Upgrading legacy sites to HTTPS and more.&lt;/p&gt;
&lt;h3 id=&quot;opera-mini-update&quot;&gt;&lt;a href=&quot;http://www.cnet.com/news/opera-mini-for-android-gets-major-overhaul-to-target-more-users/&quot;&gt;Opera Mini Update&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-mini-update&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The browser’s update adds a refined menu, a private-browsing mode, and a scalable interface that allows for support on tablets and smartphones.&lt;/p&gt;
&lt;h3 id=&quot;emulate-push-events&quot;&gt;&lt;a href=&quot;https://codereview.chromium.org/1079013002/&quot;&gt;Emulate push events&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#emulate-push-events&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Chrome DevTools there will soon be an “Emulate push event” button.&lt;/p&gt;
&lt;h3 id=&quot;a-10-year-journey-of-internet-on-a-phone&quot;&gt;&lt;a href=&quot;http://blogs.opera.com/news/2015/04/opera-mini-history-new-version-android/&quot;&gt;A 10-year journey of internet on a phone&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#a-10-year-journey-of-internet-on-a-phone&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;responsive-design-mode&quot;&gt;&lt;a href=&quot;https://twitter.com/RWD/status/588057697678991361&quot;&gt;Responsive Design Mode&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#responsive-design-mode&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Tips from Ethan Marcotte about using the Responsive Design Mode in Firefox&lt;/p&gt;
&lt;h3 id=&quot;devtools-terminal&quot;&gt;&lt;a href=&quot;http://www.html5rocks.com/en/tutorials/developertools/devtools-terminal/&quot;&gt;DevTools Terminal&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtools-terminal&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Using Your Terminal from Chrome DevTools.&lt;/p&gt;
&lt;h3 id=&quot;webpagetest-mapper&quot;&gt;&lt;a href=&quot;http://cruft.io/posts/introducing-webpagetest-mapper/&quot;&gt;WebPageTest-mapper&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#webpagetest-mapper&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A wrapper for WebPageTest-API that transforms the JSON result data into intuitive and informative human-readable formats.&lt;/p&gt;
&lt;h3 id=&quot;building-60-fps-web-apps&quot;&gt;&lt;a href=&quot;https://www.udacity.com/course/ud860&quot;&gt;Building 60 FPS Web Apps&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#building-60-fps-web-apps&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A free course from Paul Lewis about Browser Rendering Optimization.&lt;/p&gt;
&lt;h3 id=&quot;firefox-os&quot;&gt;&lt;a href=&quot;http://convolv.es/blog/2015/03/25/wifi-debug-fxos/&quot;&gt;Firefox OS&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-os&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can now debug Firefox OS via WIFI.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 14/2015</title>
							<link>https://justmarkup.com/log/2015/04/browsers-and-bugs-142015/</link>
							<pubDate>2015-04-10T04:18:44+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/04/browsers-and-bugs-142015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 14 of Browsers and Bugs. The spring is coming here in Europe – so, go out, enjoy the sun and watch some real bugs!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;when-will-a-fix-ship-in-chrome%3F&quot;&gt;&lt;a href=&quot;https://dev.chromium.org/blink/when-will-a-fix-ship-in-chrome-stable-or-canary&quot;&gt;When will a fix ship in Chrome?&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#when-will-a-fix-ship-in-chrome%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A quick guide on how to track Blink changes as they make their way to releases of Chrome.&lt;/p&gt;
&lt;h3 id=&quot;&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/03/30/quot-project-spartan-quot-in-the-windows-technical-preview-build-10049.aspx&quot;&gt;&lt;img srcset=&quot;&quot;&gt;&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After Opera, Chrome, Safari/iOS and Firefox &lt;img srcset=&quot;&quot;&gt; is now also supported in Project Spartan.&lt;/p&gt;
&lt;h3 id=&quot;mozilla-and-the-shadow-dom&quot;&gt;&lt;a href=&quot;https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html&quot;&gt;Mozilla and the Shadow DOM&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#mozilla-and-the-shadow-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Brainstorming about Shadow DOM and components in general.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;dev-tips-daily&quot;&gt;&lt;a href=&quot;https://umaar.com/dev-tips/&quot;&gt;Dev Tips Daily&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#dev-tips-daily&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A developer tip, in the form of a gif, in your inbox 5 days a week.&lt;/p&gt;
&lt;h3 id=&quot;colorblind-design&quot;&gt;&lt;a href=&quot;https://addons.mozilla.org/de/firefox/addon/colorblind-design/?src=api&quot;&gt;Colorblind Design&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#colorblind-design&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A Firefox Add-on to simulate color blindness – great way to test if your site’s colors are accessible.&lt;/p&gt;
&lt;h3 id=&quot;chrome%E2%80%99s-console-api&quot;&gt;&lt;a href=&quot;http://www.mitchrobb.com/chromes-console-api-greatest-hits/&quot;&gt;Chrome’s Console API&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome%E2%80%99s-console-api&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Lots of useful tips on how to use the Console API. Most of this can also be used in Firefox, Opera… by the way.&lt;/p&gt;
&lt;h3 id=&quot;how-to-test-for-internet-explorer-on-android%2C-ios%2C-and-mac-os-x&quot;&gt;&lt;a href=&quot;http://www.sitepoint.com/test-internet-explorer-android-ios-mac-os-x/&quot;&gt;How to Test for Internet Explorer on Android, iOS, and Mac OS X&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#how-to-test-for-internet-explorer-on-android%2C-ios%2C-and-mac-os-x&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;ainspector-sidebar-firefox-add-on&quot;&gt;&lt;a href=&quot;http://ainspector.github.io/&quot;&gt;AInspector Sidebar Firefox Add-on&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ainspector-sidebar-firefox-add-on&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A web accessibility evaluation tool that applies the rules from a selected ruleset, and organizes the results by Rule Categories or WCAG Guidelines.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 13/2015</title>
							<link>https://justmarkup.com/log/2015/04/browsers-and-bugs-132015/</link>
							<pubDate>2015-04-03T06:25:00+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/04/browsers-and-bugs-132015/</guid>
							<description>&lt;p&gt;Hello and welcome to issue 13 of Browsers and Bugs. Happy debugging and may you find lots of easter eggs this weekend!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;firefox-37&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/Firefox/Releases/37&quot;&gt;Firefox 37&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-37&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A new version of Firefox was released. Among small new features and bug fixes, they also fixed a 15-year-old &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=35168&quot;&gt;bug regarding relative positioning of table cells&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;webrtc-in-webkit&quot;&gt;&lt;a href=&quot;https://lists.webkit.org/pipermail/webkit-dev/2015-January/027196.html&quot;&gt;WebRTC in WebKit&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#webrtc-in-webkit&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;WebKit is working on implementing WebRTC in WebKit.&lt;/p&gt;
&lt;h3 id=&quot;opera-for-android&quot;&gt;&lt;a href=&quot;http://forums.opera.com/discussion/1864212/opera-turbo-replaces-off-road-mode#Item_1&quot;&gt;Opera for Android&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-for-android&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Opera for Android 29 beta replaces off-road mode with a new Turbo mode, offering full HTML5 experience &amp;amp; new compression.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;advanced-performance-audits-with-devtools&quot;&gt;&lt;a href=&quot;http://www.paulirish.com/2015/advanced-performance-audits-with-devtools/&quot;&gt;Advanced Performance Audits With DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#advanced-performance-audits-with-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Paul Irish spent some time recently profiling real-world mobile websites including CNet, Time and Google Play.&lt;/p&gt;
&lt;h3 id=&quot;browser-css%2Fjs-loading-capabilities&quot;&gt;&lt;a href=&quot;https://pie.gd/test/script-link-events/&quot;&gt;Browser CSS/JS loading capabilities&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#browser-css%2Fjs-loading-capabilities&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Great table showing which browsers support onload, onerror,….&lt;/p&gt;
&lt;h3 id=&quot;rendering-performance&quot;&gt;&lt;a href=&quot;https://developers.google.com/web/fundamentals/performance/rendering/&quot;&gt;Rendering Performance&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#rendering-performance&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A fantastic guide on optimizing Rendering Performance by Paul Lewis&lt;/p&gt;
&lt;h3 id=&quot;devtools-console&quot;&gt;&lt;a href=&quot;https://twitter.com/addyosmani/status/583635990041985025&quot;&gt;DevTools Console&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtools-console&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Chrome DevTools now supports syntax highlighting &amp;amp; improved styling for console.warn &amp;amp; console.error.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 12/2015</title>
							<link>https://justmarkup.com/log/2015/03/browsers-and-bugs-122015/</link>
							<pubDate>2015-03-27T16:52:23+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/browsers-and-bugs-122015/</guid>
							<description>&lt;p&gt;It’s friday and thus a new round of Browsers and Bugs is ready for you. Hello and welcome to issue 12. Happy bug reporting!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;%5Bintent-to-implement%3A-pointer-events&quot;&gt;[Intent to Implement: Pointer Events &lt;a class=&quot;permalink&quot; href=&quot;#%5Bintent-to-implement%3A-pointer-events&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;](&lt;a href=&quot;https://groups.google.com/a/chromium.org/forum/m/#!topic/blink-dev/ODWmcKNQl0I&quot;&gt;https://groups.google.com/a/chromium.org/forum/m/#!topic/blink-dev/ODWmcKNQl0I&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;After a lot of feedback, Chrome is now considering to implement Pointer Events. Meanwhile in Cupertino, Apple invents new events for &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=142836&quot;&gt;force touch&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;partnering-with-adobe&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/03/23/partnering-with-adobe-on-new-contributions-to-our-web-platform.aspx&quot;&gt;Partnering with Adobe&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#partnering-with-adobe&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Adobe have provided contributions in partnership with engineers on the IE team. Good to see that IE is opening a bit and looking for contributions from outside.&lt;/p&gt;
&lt;h3 id=&quot;status-page-for-webkit&quot;&gt;&lt;a href=&quot;https://lists.webkit.org/pipermail/webkit-dev/2015-March/027351.html&quot;&gt;Status page for WebKit&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#status-page-for-webkit&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After &lt;a href=&quot;https://www.chromestatus.com/features&quot;&gt;Blink&lt;/a&gt; and &lt;a href=&quot;https://status.modern.ie/&quot;&gt;Internet Explorer&lt;/a&gt; also WebKit is considering building a status page. Would be great to get more information about features in WebKit.&lt;/p&gt;
&lt;h3 id=&quot;new-css-parser-for-blink&quot;&gt;&lt;a href=&quot;https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/r9bthijsX3A/discussion&quot;&gt;New CSS parser for Blink&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#new-css-parser-for-blink&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;On most stylesheets, the new parser performed 15-25% faster.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;what-do-you-want-from-your-devtools%3F&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/03/what-do-you-want-from-your-devtools/&quot;&gt;What do you want from your DevTools?&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#what-do-you-want-from-your-devtools%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Have an idea to improve Firefox DevTools? You can submit your idea on &lt;a href=&quot;https://ffdevtools.uservoice.com/forums/246087-firefox-developer-tools-ideas&quot;&gt;UserVoice&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;ie-diagnostics-adapter&quot;&gt;&lt;a href=&quot;https://github.com/Microsoft/IEDiagnosticsAdapter&quot;&gt;IE Diagnostics Adapter&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ie-diagnostics-adapter&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A proxy to use Chrome Devtools to debug and diagnose IE.&lt;/p&gt;
&lt;h3 id=&quot;third-parties&quot;&gt;&lt;a href=&quot;http://blog.webperf.ninja/2015/find-third-party-assets/&quot;&gt;Third-parties&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#third-parties&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Third-party scripts do all kind of nasty stuff, like requesting fourth-party scripts. Here is a tool to find out which hosts gets requested on your site.&lt;/p&gt;
&lt;h3 id=&quot;scratch-js&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/scratch-js/alploljligeomonipppgaahpkenfnfkn&quot;&gt;Scratch JS&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#scratch-js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A browser extension to write and execute ES6 with Chrome DevTools.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Remove console and debugger statements for production with gulp/grunt</title>
							<link>https://justmarkup.com/log/2015/03/remove-console-and-debugger-statements-for-production-with-gulpgrunt/</link>
							<pubDate>2015-03-26T12:05:25+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/remove-console-and-debugger-statements-for-production-with-gulpgrunt/</guid>
							<description>&lt;p&gt;While writing JavaScript you will most likely use either console (console.log, console.error…), debugger; or even alert() (I hope you don’t anymore) at some point to debug your code. Showing these messages on your development server is not a problem as only »you« will see them, but if they show up on your production server everybody will see them.&lt;/p&gt;
&lt;p&gt;Whereas console messages and debugger are only visible if DevTools are open alert() will always show up and even prompt a modal dialog. So, you most probably (*always*) want to remove these statements before pushing new code to production.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/03/alert.png&quot; alt=&quot;Dialog showing the message &#39;Oops, I forgot to remove debug messages.&#39;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Let’s make use of our preferred build tool and remove all debug statements before deploying code to production.&lt;/p&gt;
&lt;h3 id=&quot;gulp&quot;&gt;Gulp &lt;a class=&quot;permalink&quot; href=&quot;#gulp&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For Gulp we can use &lt;a href=&quot;https://www.npmjs.com/package/gulp-strip-debug&quot;&gt;gulp-strip-debug&lt;/a&gt; by Sindre Sorhus.&lt;/p&gt;
&lt;p&gt;Here is what the task will look like if you have all your JavaScript files in src/js and want to save the cleaned up versions in dist/js.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; gulp &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;gulp&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; stripDebug &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;gulp-strip-debug&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;br&gt;gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;task&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;strip-debug&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;src/js/*&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;stripDebug&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;dist/js/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;grunt&quot;&gt;Grunt &lt;a class=&quot;permalink&quot; href=&quot;#grunt&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sindre Sorhus also made a &lt;a href=&quot;https://github.com/sindresorhus/grunt-strip-debug&quot;&gt;Grunt Plugin&lt;/a&gt; we can use.&lt;/p&gt;
&lt;p&gt;Once again, Here is what the task will look like if you have all your JavaScript files in src/js and want to save the cleaned up versions in dist/js.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;grunt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;&lt;br&gt;	&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;load-grunt-tasks&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;grunt&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// npm install --save-dev load-grunt-tasks&lt;/span&gt;&lt;br&gt;&lt;br&gt;	grunt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;initConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		stripDebug&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			dist&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;					files&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; grunt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;expandMapping&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;src/js/*.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;dist/js/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;					flatten&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;					&lt;span class=&quot;token function-variable function&quot;&gt;rename&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;destBase&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; destPath&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;						&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; destBase&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;destPath&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;					&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;				&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;	grunt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;registerTask&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;default&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;stripDebug&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Last but not least, there is also a &lt;a href=&quot;https://github.com/sindresorhus/broccoli-strip-debug&quot;&gt;Broccoli Plugin&lt;/a&gt; if this is your preferred tool.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Removing console messages before deploying code to production is nothing we should do manually – that’s a task for a build tool.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 11/2015</title>
							<link>https://justmarkup.com/log/2015/03/browsers-and-bugs-112015/</link>
							<pubDate>2015-03-20T10:18:28+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/browsers-and-bugs-112015/</guid>
							<description>&lt;p&gt;Hello and welcome to #11 of Browsers and Bugs. Happy bug reporting!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;opera-mini&quot;&gt;&lt;a href=&quot;https://dev.opera.com/blog/opera-mini-server-upgrade/&quot;&gt;Opera Mini&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-mini&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;All Opera Mini servers were upgraded to a new version – now comes with support for HTML5 input types and Flexbox \o/.&lt;/p&gt;
&lt;h3 id=&quot;remote.ie&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/03/18/rendering-engine-updates-in-march-for-the-windows-10-technical-preview.aspx&quot;&gt;remote.ie&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#remote.ie&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Rendering engine updates in March for the Windows 10 Technical Preview.&lt;/p&gt;
&lt;h3 id=&quot;bug-from-the-past&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=69787&quot;&gt;Bug from the past&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bug-from-the-past&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Some things take 14 years, like event.offsetX/Y in Gecko – via &lt;a href=&quot;https://twitter.com/molily/status/578468577013035008&quot;&gt;@molily&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;the-sad-state-of-matrix-transforms&quot;&gt;&lt;a href=&quot;http://atirip.com/2015/03/17/sorry-sad-state-of-matrix-transforms-in-browsers/&quot;&gt;The sad state of matrix transforms&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#the-sad-state-of-matrix-transforms&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;All, but IE, fail miserably on scaling and rotating.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;devtools%3A-state-of-the-union-2015&quot;&gt;&lt;a href=&quot;https://speakerdeck.com/addyosmani/devtools-state-of-the-union-2015&quot;&gt;DevTools: State Of The Union 2015&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtools%3A-state-of-the-union-2015&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Slides from &lt;a href=&quot;http://twitter.com/addyosmani&quot;&gt;@addyosmani&lt;/a&gt; showing new demos for Chrome DevTools. Some awesome stuff in there. Video of the talk will be available in the near future.&lt;/p&gt;
&lt;h3 id=&quot;fetch-api&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/03/using-the-firefox-devtools-to-debug-fetch-on-github/&quot;&gt;Fetch API&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#fetch-api&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Using the Firefox DevTools to Debug fetch() on GitHub.&lt;/p&gt;
&lt;h3 id=&quot;parsing-errors&quot;&gt;&lt;a href=&quot;https://twitter.com/simevidas/status/578608747548925952&quot;&gt;Parsing errors&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#parsing-errors&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Internet Explorer logs HTML parsing errors in the console. Nice!&lt;/p&gt;
&lt;h3 id=&quot;remotedebug-and-cross-browser-devtools.-one-year-later.&quot;&gt;&lt;a href=&quot;https://kenneth.io/blog/2015/03/12/remotedebug-one-year-later/&quot;&gt;RemoteDebug and cross-browser DevTools. One year later.&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#remotedebug-and-cross-browser-devtools.-one-year-later.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 10/2015</title>
							<link>https://justmarkup.com/log/2015/03/browsers-and-bugs-102015/</link>
							<pubDate>2015-03-13T13:19:56+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/browsers-and-bugs-102015/</guid>
							<description>&lt;p&gt;It’s Friday and thus time for a new issue of Browsers and Bugs. Hello and Welcome to number 10. Happy debugging!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;chrome-42-beta&quot;&gt;&lt;a href=&quot;http://blog.chromium.org/2015/03/chrome-42-beta-push-notifications_12.html&quot;&gt;Chrome 42 Beta&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-42-beta&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Among other new features and bugfixes it ships with &lt;a href=&quot;http://updates.html5rocks.com/2015/03/push-notificatons-on-the-open-web&quot;&gt;Push Notifications&lt;/a&gt; and an enhanced &lt;a href=&quot;http://updates.html5rocks.com/2015/03/increasing-engagement-with-app-install-banners-in-chrome-for-android&quot;&gt;Add to homescreen&lt;/a&gt; function.&lt;/p&gt;
&lt;h3 id=&quot;opera-28&quot;&gt;&lt;a href=&quot;https://dev.opera.com/blog/opera-28/&quot;&gt;Opera 28&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-28&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;What’s new in Opera 28 (based on Chromium 41) for Mac, Windows, Linux and Android.&lt;/p&gt;
&lt;h3 id=&quot;break-up-width-ie8&quot;&gt;&lt;a href=&quot;http://breakupwithie8.com/&quot;&gt;Break Up Width IE8&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#break-up-width-ie8&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;IE8 is already 6 years old and I agree that it’s time to stop supporting it.&lt;/p&gt;
&lt;h3 id=&quot;null-check-the-responsive-selector-in-images&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1141260&quot;&gt;Null-check the responsive selector in images&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#null-check-the-responsive-selector-in-images&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This crashed some sites using img srcset. Aleady fixed in Firefox 38.&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;dev-consoles-considered-harmful-(%E2%80%A6for-learning)-by-kyle-simpson&quot;&gt;&lt;a href=&quot;http://blog.getify.com/dev-consoles-considered-harmful/&quot;&gt;Dev Consoles Considered Harmful (…for learning) by Kyle Simpson&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#dev-consoles-considered-harmful-(%E2%80%A6for-learning)-by-kyle-simpson&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The dev console in browsers is great, but it’s particularly harmful to the purposes of accurately learning JS. We need a new real-JavaScript-REPL tool, and it needs to land in a browser soon.&lt;/p&gt;
&lt;h3 id=&quot;animation-timeline-%5Bvideo%5D&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=U9xfYbKxosI&quot;&gt;Animation Timeline [Video]&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#animation-timeline-%5Bvideo%5D&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Will be available soon in Chrome DevTools.&lt;/p&gt;
&lt;h3 id=&quot;firefox-devtools&quot;&gt;&lt;a href=&quot;https://twitter.com/patrickbrosset/status/576027485684539393/photo/1&quot;&gt;Firefox DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Developers can now inspect/debug any Firefox Popup.&lt;/p&gt;
&lt;h3 id=&quot;chrome-devtools-experiments&quot;&gt;Chrome Devtools Experiments &lt;a class=&quot;permalink&quot; href=&quot;#chrome-devtools-experiments&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To try out the experiments open chrome://flags -&amp;gt; Enable Developer Tools experiments and click “Relaunch Now” at the bottom. After restart, open Devtools, go to settings and have a look at the Experiments Tab. If you want to see all experiments, press Shift 6 times (yes 6, not 7 to activate Developer Options on Android :-)) while the experiments tab is open.&lt;/p&gt;
&lt;h3 id=&quot;domlistener&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/domlistener/jlfdgnlpibogjanomigieemaembjeolj&quot;&gt;DOMListener&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#domlistener&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A Chrome DevTools Extension to monitor, browse and filter all DOM changes.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Dynamic responsive background images</title>
							<link>https://justmarkup.com/log/2015/03/dynamic-responsive-background-images/</link>
							<pubDate>2015-03-12T08:57:39+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/dynamic-responsive-background-images/</guid>
							<description>&lt;p&gt;This morning I saw a &lt;a href=&quot;https://twitter.com/helloanselm/status/575933371693592576&quot;&gt;Tweet from Anselm Hannemann&lt;/a&gt; asking »What’s the best way to add dynamic responsive background images?« and after some quick tests I came up with the following solution.&lt;/p&gt;
&lt;p&gt;Here is the HTML:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;bg-image&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Dynamic Background&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we add some general CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.bg-image&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;background-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cover&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And now comes the interesting part, let’s assume we use PHP and have access to the following dynamic background images and sizes we then can use in our HTML:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;small&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// contains the value for the small image for a post, eg. &#39;/postid/small.jpg&#39;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token variable&quot;&gt;$image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;big&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// contains the value for the big image for a post, eg. &#39;/postid/big.jpg&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we can add an &amp;lt;style&amp;gt; element to the &amp;lt;head&amp;gt; of our site defining the different background images for different sizes:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 501px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;.bg-image&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&amp;lt;?php echo $image[&lt;span class=&quot;token string&quot;&gt;&#39;big&#39;&lt;/span&gt;] ?&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; no-repeat 0 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 500px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;.bg-image&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&amp;lt;?php echo $image[&lt;span class=&quot;token string&quot;&gt;&#39;small&#39;&lt;/span&gt;] ?&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; no-repeat 0 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By using min-width and max-width media queries we ensure that only the appropriate image is loaded. For more info see this &lt;a href=&quot;http://timkadlec.com/2012/04/media-query-asset-downloading-results/#test5&quot;&gt;test by Tim Kadlec&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this example, I used PHP (yes old style, but simplest for me to set up the tests), but you can use this technique also with other languages and also on static sites (eg. Jekyll).&lt;/p&gt;
&lt;p&gt;I also put together a &lt;a href=&quot;http://jsbin.com/qekepoceyo/1/edit?html,css,output&quot;&gt;demo&lt;/a&gt; on jsbin to demonstrate it. If you find any disadvantages or improvements of this technique please let me know on &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;twitter&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 09/2015</title>
							<link>https://justmarkup.com/log/2015/03/browsers-and-bugs-092015/</link>
							<pubDate>2015-03-06T09:00:50+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/browsers-and-bugs-092015/</guid>
							<description>&lt;p&gt;Hello and Welcome to issue 9 of Browsers and Bugs. Happy testing!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;opera-mini&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=69dVffbcMlU&amp;amp;feature=youtu.be&quot;&gt;Opera Mini&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#opera-mini&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First look at the new Opera Mini beta for Android&lt;/p&gt;
&lt;h3 id=&quot;firefox-developer-edition-38&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/03/firefox-developer-edition-38-64-bits-and-more/&quot;&gt;Firefox Developer Edition 38&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-developer-edition-38&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;app-install-banners&quot;&gt;&lt;a href=&quot;https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/HSSqpbYd8W8&quot;&gt;App install banners&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#app-install-banners&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Blink – Intent to Implement: API to support web/native app install banners&lt;/p&gt;
&lt;h3 id=&quot;mozilla-location-services-to-replace-google%E2%80%99s-geolocation-service-in-firefox&quot;&gt;&lt;a href=&quot;http://www.ghacks.net/2015/03/04/mozilla-location-services-to-replace-googles-geolocation-service-in-firefox/&quot;&gt;Mozilla Location Services to replace Google’s geolocation service in Firefox&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#mozilla-location-services-to-replace-google%E2%80%99s-geolocation-service-in-firefox&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;shadow-dom&quot;&gt;&lt;a href=&quot;https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/lLfzjTPuZtk/SrUHp9uVRiEJ&quot;&gt;Shadow DOM&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#shadow-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Blink – Intent to Implement: Shadow DOM – closed mode&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;blackbox-javascript-source-files&quot;&gt;&lt;a href=&quot;https://developer.chrome.com/devtools/docs/blackboxing&quot;&gt;Blackbox JavaScript Source Files&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#blackbox-javascript-source-files&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Useful if you want to skip third-party Code while debugging in Chrome&lt;/p&gt;
&lt;h3 id=&quot;amok&quot;&gt;&lt;a href=&quot;http://caspervonb.com/javascript/tools/live-edit-javascript-amok/&quot;&gt;Amok&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#amok&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Live Edit JavaScript with Amok&lt;/p&gt;
&lt;h3 id=&quot;konsole.js&quot;&gt;&lt;a href=&quot;https://github.com/eatcodeplay/Konsole.js/blob/master/README.md&quot;&gt;Konsole.js&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#konsole.js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Konsole.js is a On-Screen Debugger/Logger and (optionally) default browser console replacement.&lt;/p&gt;
&lt;h3 id=&quot;high-performance-touch-interactions&quot;&gt;&lt;a href=&quot;http://maketea.co.uk/2015/02/16/high-performance-touch-interactions.html&quot;&gt;High performance touch interactions&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#high-performance-touch-interactions&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Demo - Responsive Pop-out Menu</title>
							<link>https://justmarkup.com/log/2015/03/demo-responsive-pop-out-menu/</link>
							<pubDate>2015-03-03T14:31:57+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/03/demo-responsive-pop-out-menu/</guid>
							<description>&lt;p&gt;I am currently redesigning my website and therefore also the navigation. There are loads of different &lt;a href=&quot;http://bradfrost.github.io/this-is-responsive/patterns.html#navigation&quot;&gt;navigation pattern&lt;/a&gt; and I made many myself in the last years. However, I searched for a different solution again as none of the patterns I know offers the following points I had in mind:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It should work well without JavaScript.&lt;/li&gt;
&lt;li&gt;On small screens, all menu items should be easily reachable&lt;/li&gt;
&lt;li&gt;Important menu items should always stay in the beginning&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;1)-should-work-without-javascript&quot;&gt;1) Should work without JavaScript &lt;a class=&quot;permalink&quot; href=&quot;#1)-should-work-without-javascript&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This is simple to achieve, I used the &lt;a href=&quot;https://justmarkup.com/log/2015/02/26/cut-the-mustard-revisited/&quot;&gt;Cut the Mustard&lt;/a&gt; technique to only serve JavaScript to modern browsers and then add class=”js” to the html element to be able to style the menu differently. I also add EventListener to open/close the menu.&lt;/p&gt;
&lt;p&gt;Here is the complete JavaScript:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token comment&quot;&gt;// CTM, only init JavaScript for modern browsers&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;visibilityState&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; doc&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// Add class to html elment once js is available&lt;/span&gt;&lt;br&gt;		doc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;br&gt;		&lt;span class=&quot;token comment&quot;&gt;// Add Eventlistener to open/close menu&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; menuLayer &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; doc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is--menu-layer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			menuClose &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; doc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is--menu-close&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;			menuOpen &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; doc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;is--menu-open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;openMenu&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			menuLayer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;is--menu-opened&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;closeMenu&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;			menuLayer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;		menuClose&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; closeMenu&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		menuOpen&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; openMenu&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On older browsers and devices without JavaScript the menu items will always stay visible and will align to the left.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/03/menu-no-js.png&quot; alt=&quot;Menu with no JavaScript&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;2)-all-menu-items-should-be-easily-reachable&quot;&gt;2) All menu items should be easily reachable &lt;a class=&quot;permalink&quot; href=&quot;#2)-all-menu-items-should-be-easily-reachable&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Smartphones are getting bigger and bigger and thus it becomes quite hard to reach menu items in the upper-left corner. Thus, I made an wrapper around the menu list and set it to position: fixed (yes, this is dangerous on some devices but with the CTM technique above this only applies to browsers where support is good enough). Next, I set the menu list to position: absolute and position it down in the right corner. This way all the items are reachable quite easily with one thumb.&lt;/p&gt;
&lt;h3 id=&quot;3)-important-menu-items-should-always-stay-in-the-beginning&quot;&gt;3) Important menu items should always stay in the beginning &lt;a class=&quot;permalink&quot; href=&quot;#3)-important-menu-items-should-always-stay-in-the-beginning&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;While all the items are now aligned at the bottom, the most important items (usually first in order) are still at the top. To change it, I used this &lt;a href=&quot;https://justmarkup.com/log/2014/11/28/reverse-order-of-elements-with-css/&quot;&gt;technique&lt;/a&gt; to reverse the order of the items and, therefore, show the most important item at the very bottom.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.js .navigation ul&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;-webkit-transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;180deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;-ms-transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;180deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;180deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;.js .navigation li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;-webkit-transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;-180deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;-ms-transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;-180deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rotate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;-180deg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is a screenshot of the opened menu on Android:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/03/menu-open-android.png&quot; alt=&quot;Opened menu on Android&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;code&quot;&gt;Code &lt;a class=&quot;permalink&quot; href=&quot;#code&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here is the &lt;a href=&quot;https://justmarkup.com/demos/responsive-pop-out-menu/&quot;&gt;demo&lt;/a&gt; and you can find all the demo files on &lt;a href=&quot;https://github.com/justmarkup/demos/tree/master/responsive-pop-out-menu&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you find any bug please open an &lt;a href=&quot;https://github.com/justmarkup/demos/issues&quot;&gt;issue&lt;/a&gt; on Github.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 08/2015</title>
							<link>https://justmarkup.com/log/2015/02/browsers-and-bugs-082015/</link>
							<pubDate>2015-02-27T07:49:40+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/browsers-and-bugs-082015/</guid>
							<description>&lt;p&gt;Hello and Welcome to issue 8 of Browsers and Bugs. Happy testing!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;the-pointer-events-specification-became-a-w3c-recommendation.&quot;&gt;&lt;a href=&quot;http://www.w3.org/TR/pointerevents/&quot;&gt;The Pointer Events specification became a W3C Recommendation.&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#the-pointer-events-specification-became-a-w3c-recommendation.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Posts on standards &amp;amp; Apple’s influence: &lt;a href=&quot;http://www.quirksmode.org/blog/archives/2015/02/tired_of_safari.html&quot;&gt;Tired of Safari by PPK&lt;/a&gt;, &lt;a href=&quot;http://timkadlec.com/2015/02/apples-web/&quot;&gt;Apple’s Web by Tim Kadlec&lt;/a&gt; and &lt;a href=&quot;http://aaron-gustafson.com/notebook/apple-business-and-standards/&quot;&gt;Apple, Business, and Standards by Aaron Gustafson&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;firefox-version-36.0&quot;&gt;&lt;a href=&quot;https://www.mozilla.org/en-US/firefox/36.0/releasenotes/&quot;&gt;Firefox Version 36.0&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-version-36.0&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Unicode-range, object-fit, will-change &amp;amp; Promise inspection arrive in Firefox&lt;/p&gt;
&lt;h3 id=&quot;fetch-event-support-in-firefox-nightly&quot;&gt;&lt;a href=&quot;https://blog.wanderview.com/blog/2015/02/23/that-event-is-so-fetch/&quot;&gt;Fetch Event support in Firefox Nightly&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#fetch-event-support-in-firefox-nightly&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;a-break-from-the-past&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/02/26/a-break-from-the-past-the-birth-of-microsoft-s-new-web-rendering-engine.aspx&quot;&gt;A break from the past&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#a-break-from-the-past&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The birth of Microsoft’s new web rendering engine&lt;/p&gt;
&lt;h3 id=&quot;bug-330884&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=330884&quot;&gt;Bug 330884&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bug-330884&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This privacy flaw has caused my fiancé and I to break-up after having dated for 5 years.&lt;/p&gt;
&lt;h3 id=&quot;spartan-to-remove-the-300ms-delay%2C-pointer-events-become-w3c-recommendation&quot;&gt;&lt;a href=&quot;http://www.favbrowser.com/spartan-to-temove-300ms-delay-pointer-events-become-w3c-recommenadtion/&quot;&gt;Spartan To Remove The 300ms Delay, Pointer Events Become W3C Recommendation&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#spartan-to-remove-the-300ms-delay%2C-pointer-events-become-w3c-recommendation&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;polybrowser&quot;&gt;&lt;a href=&quot;https://polybrowser.com/&quot;&gt;PolyBrowser&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#polybrowser&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;New browser build on top of Firefox&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;devtools-for-designers&quot;&gt;&lt;a href=&quot;https://trello.com/b/GKotpgkR/devtools-for-designers&quot;&gt;DevTools for Designers&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#devtools-for-designers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Explore what Chrome DevTools could do for designers.&lt;/p&gt;
&lt;h3 id=&quot;node-reordering-by-drag%2Fdrop-in-firefox-devtools-inspector!&quot;&gt;&lt;a href=&quot;https://twitter.com/patrickbrosset/status/570859784016154624/photo/1&quot;&gt;Node reordering by drag/drop in Firefox DevTools inspector!&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#node-reordering-by-drag%2Fdrop-in-firefox-devtools-inspector!&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Will soon land in Firefox Nightly Builds.&lt;/p&gt;
&lt;h3 id=&quot;cubic-bezier&quot;&gt;&lt;a href=&quot;https://twitter.com/vlh/status/569933167546773504/photo/1&quot;&gt;cubic-bezier&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#cubic-bezier&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Editable cubic-bezier easing graphs (plus frames view) now in Chrome Canary.&lt;/p&gt;
&lt;h3 id=&quot;promise-debugging-support-now-in-firefox-devtools&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Type-specific_rich_output&quot;&gt;Promise debugging support now in Firefox Devtools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#promise-debugging-support-now-in-firefox-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;chrome-devtools-extensions-for-clojurescript-developers&quot;&gt;&lt;a href=&quot;https://github.com/binaryage/cljs-devtools&quot;&gt;Chrome Devtools extensions for ClojureScript developers&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-devtools-extensions-for-clojurescript-developers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Cut the mustard revisited</title>
							<link>https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/</link>
							<pubDate>2015-02-26T09:49:02+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/</guid>
							<description>&lt;p&gt;Cutting the mustard is a term coined by the BBC team (&lt;a href=&quot;http://responsivenews.co.uk/post/18948466399/cutting-the-mustard&quot;&gt;post&lt;/a&gt;) to group browsers into »modern« browsers and »old« browsers. This is not done by sniffing the User Agent but by using &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Browser_Feature_Detection&quot;&gt;Browser Feature Detection&lt;/a&gt;. Here is the JavaScript that decides whether the browser is modern or old.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;localStorage&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;addEventListener&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;     &lt;span class=&quot;token comment&quot;&gt;// Modern browser. Let&#39;s add JavaScript functionality&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this in place, we have two groups of browsers, modern (IE9+, Fx, Safari, Opera, Chrome, iOS, Android 2.1+, …) and old (IE8-, Blackberry, …). I used the same check in the last years. I don’t have to care about JavaScript implementation and errors in old browsers as I only serve JavaScript to modern browsers and I know which JavaScript features I can use safely. It works out great most of the time.&lt;/p&gt;
&lt;p&gt;However, this morning I saw a &lt;a href=&quot;https://twitter.com/jaffathecake/status/570872103227953153&quot;&gt;tweet from Jake Archibald&lt;/a&gt; which made me think about my current CTM check.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;if (!(&#39;visibilityState&#39; in document)) return; A nice way to prevent your JS running in IE&amp;lt;10 and Android WebKit &lt;a href=&quot;http://t.co/yjbUnyaobV&quot;&gt;http://t.co/yjbUnyaobV&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;— Jake Archibald (@jaffathecake) &lt;a href=&quot;https://twitter.com/jaffathecake/status/570872103227953153&quot;&gt;February 26, 2015&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Looking at the browser support of &lt;a href=&quot;http://caniuse.com/#feat=pagevisibility&quot;&gt;Page Visibility&lt;/a&gt; and some statistics in recent projects I can say that only adding JavaScript for this group of browsers makes more sense nowadays than the old check. Android-4, IE9, and others lack support for many features we want and can use today and if you start a project now the percentage of users using such a browser will be even lower than they are already.&lt;/p&gt;
&lt;p&gt;While the check mentioned by Jake is great, I immediately thought about extending it and adding a check for ServiceWorker to improve performance for browsers supporting it and for adding offline support. So here is my new check I will use in most of my projects from now on:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;visibilityState&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;// Modern browser. Let&#39;s load JavaScript&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;serviceWorker&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token comment&quot;&gt;// Let&#39;s add offline support&lt;/span&gt;&lt;br&gt;        navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;sw.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            scope&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;./&#39;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you are unfamiliar with ServiceWorker, I recommend this &lt;a href=&quot;https://github.com/jakearchibald/simple-serviceworker-tutorial&quot;&gt;interactive introduction&lt;/a&gt; and if you are searching for a way to generate service worker code, I can recommend this &lt;a href=&quot;https://github.com/jeffposnick/sw-precache&quot;&gt;node module&lt;/a&gt; that will precache specific resources.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;So, can or should I also use this CTM check? Often, well probably most of the time, it depends! It depends on your audience (study your statistics), it depends on the functionality used on your website or application – it depends on many things. However, using Cut the Mustard (in this way or another) is a perfect example of Progressive Enhancement. Web sites doesn’t need to look exactly the same in &lt;a href=&quot;http://dowebsitesneedtolookexactlythesameineverybrowser.com/&quot;&gt;every browser&lt;/a&gt; and old browsers don’t need all the functionality modern browsers offer as long as the same content is available for all. Don’t bloat old browsers with tons of polyfills to get modern JavaScript features working there and make your life as a web developer unnecessary hard by trying to learn an old car flying.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;Follow me on twitter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[Share via Twitter](&lt;a href=&quot;https://twitter.com/intent/tweet?text=Cut&quot;&gt;https://twitter.com/intent/tweet?text=Cut&lt;/a&gt; the mustard revisited%20https://justmarkup.com/log/2015/02/cut-the-mustard-revisited/)&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 07/2015</title>
							<link>https://justmarkup.com/log/2015/02/browsers-and-bugs-072015/</link>
							<pubDate>2015-02-20T10:00:41+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/browsers-and-bugs-072015/</guid>
							<description>&lt;p&gt;It’s Friday and this means a new roundup of Browsers and Bugs. Welcome to issue number 7. Happy debugging!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;asm.js&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/02/18/bringing-asm-js-to-the-chakra-javascript-engine-in-windows-10.aspx&quot;&gt;asm.js&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#asm.js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Bringing asm.js to the Chakra JavaScript engine in Windows 10&lt;/p&gt;
&lt;h3 id=&quot;responsive-images&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1017875&quot;&gt;Responsive Images&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#responsive-images&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Srcset attribute and picture element for responsive images will land in Firefox 38&lt;/p&gt;
&lt;h3 id=&quot;svg-webkit-bugs&quot;&gt;&lt;a href=&quot;https://gist.github.com/SaraSoueidan/cbe8fb44bb3177509d03&quot;&gt;SVG Webkit Bugs&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#svg-webkit-bugs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I still can’t believe it but looks like Safari is finally listening to Developers \o/ So better add your bugs now!&lt;/p&gt;
&lt;h3 id=&quot;bug-1134506&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1134506&quot;&gt;Bug 1134506&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bug-1134506&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Mark “Superfish, Inc.” root certificate as untrusted in NSS. You can find more info about Superfish &lt;a href=&quot;http://www.theverge.com/2015/2/19/8069127/superfish-password-certificate-cracked-lenovo&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;state-of-blink&quot;&gt;&lt;a href=&quot;http://youtu.be/Ku3znd7JNIk&quot;&gt;State of Blink&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#state-of-blink&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Keynote about the current state and future of Blink&lt;/p&gt;
&lt;h3 id=&quot;http-strict-transport-security-comes-to-internet-explorer&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/02/16/http-strict-transport-security-comes-to-internet-explorer.aspx&quot;&gt;HTTP Strict Transport Security comes to Internet Explorer&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#http-strict-transport-security-comes-to-internet-explorer&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;chrome-devtools-tips-and-tricks-part-i&quot;&gt;&lt;a href=&quot;http://codepen.io/TheodoreVorillas/blog/chrome-devtools-tips-and-tricks&quot;&gt;Chrome Devtools Tips and Tricks Part I&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-devtools-tips-and-tricks-part-i&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;pick-color-with-an-eye-dropper-straight-from-dev-tools&quot;&gt;&lt;a href=&quot;https://twitter.com/Paul_Kinlan/status/567972543975571456&quot;&gt;Pick color with an eye dropper straight from Dev Tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#pick-color-with-an-eye-dropper-straight-from-dev-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Paul Kinlan demoes the color picker in Chrome DevTools&lt;/p&gt;
&lt;h3 id=&quot;tenon.io&quot;&gt;&lt;a href=&quot;http://tenon.io/&quot;&gt;Tenon.io&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#tenon.io&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Solve WCAG 2.0 &amp;amp; Section 508 issues before they happen with our robust, flexible, and easy API&lt;/p&gt;
&lt;h3 id=&quot;stetho%3A-a-new-debugging-platform-for-android&quot;&gt;&lt;a href=&quot;https://code.facebook.com/posts/393927910787513/&quot;&gt;Stetho: A new debugging platform for Android&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#stetho%3A-a-new-debugging-platform-for-android&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 06/2015</title>
							<link>https://justmarkup.com/log/2015/02/browsers-and-bugs-062015/</link>
							<pubDate>2015-02-14T08:40:48+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/browsers-and-bugs-062015/</guid>
							<description>&lt;p&gt;Hello and welcome to #6 of Browsers and Bugs. Happy bug reporting!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;hello-http%2F2%2C-goodbye-spdy&quot;&gt;&lt;a href=&quot;http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html&quot;&gt;Hello HTTP/2, Goodbye SPDY&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#hello-http%2F2%2C-goodbye-spdy&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Chrome plans to gradually roll out support for HTTP/2 in Chrome 40 in the upcoming weeks.&lt;/p&gt;
&lt;h3 id=&quot;internet-explorer-in-the-windows-10-technical-preview-for-phones&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/02/12/internet-explorer-in-the-windows-10-technical-preview-for-phones.aspx&quot;&gt;Internet Explorer in the Windows 10 Technical Preview for phones&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#internet-explorer-in-the-windows-10-technical-preview-for-phones&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First preview of Project Spartan for Windows phones.&lt;/p&gt;
&lt;h3 id=&quot;how-browser-developers-should-seek-feedback-from-web-developers&quot;&gt;&lt;a href=&quot;http://dbaron.org/log/20150213-feedback&quot;&gt;How browser developers should seek feedback from Web developers&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#how-browser-developers-should-seek-feedback-from-web-developers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;introducing-firefox-service-worker-builds&quot;&gt;&lt;a href=&quot;http://blog.wanderview.com/blog/2015/02/10/introducing-firefox-service-worker-builds/&quot;&gt;Introducing Firefox Service Worker Builds&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#introducing-firefox-service-worker-builds&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Test an early implementation of Service Worker in Firefox and help find bugs&lt;/p&gt;
&lt;h3 id=&quot;contributing-to-chromium%3A-an-illustrated-guide&quot;&gt;&lt;a href=&quot;http://meowni.ca/posts/chromium-101/&quot;&gt;Contributing to Chromium: an illustrated guide&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#contributing-to-chromium%3A-an-illustrated-guide&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;media-query-inspector&quot;&gt;&lt;a href=&quot;https://twitter.com/addyosmani/status/566026402592743425&quot;&gt;Media Query inspector&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#media-query-inspector&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Chrome DevTools, toggle Media Query inspector to see media queries from your stylesheets. Right-click for source.&lt;/p&gt;
&lt;h3 id=&quot;css-shapes-editor-for-opera-devtools&quot;&gt;&lt;a href=&quot;https://addons.opera.com/en/extensions/details/css-shapes-editor/&quot;&gt;CSS Shapes Editor for Opera DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#css-shapes-editor-for-opera-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;%23a11y-inspection-functionality&quot;&gt;&lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=390254#c12&quot;&gt;#a11y inspection functionality&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#%23a11y-inspection-functionality&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Work in progress to include Accessibility Developer Tools functionality into Chrome DevTools&lt;/p&gt;
&lt;h3 id=&quot;how-to-use-bugzilla-to-efficiently-squash-bugs&quot;&gt;&lt;a href=&quot;http://www.sitepoint.com/use-bugzilla-efficiently-squash-bugs/&quot;&gt;How to Use Bugzilla to Efficiently Squash Bugs&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#how-to-use-bugzilla-to-efficiently-squash-bugs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Input type email – better don’t use it!</title>
							<link>https://justmarkup.com/log/2015/02/input-type-email-better-dont-use-it/</link>
							<pubDate>2015-02-13T11:07:51+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/input-type-email-better-dont-use-it/</guid>
							<description>&lt;p&gt;&lt;strong&gt;Last update: 21.03.2017 – updated browser support for Chrome, added info about punycode in Chrome&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;tl;dr If you want to use input type=”email”, be aware that international email addresses (containing Umlaut, non-latin characters…) are not supported in every browsers and you may exclude users using such an email address from using your service. Furthermore, the current version (56) of Chrome translates international addresses to punycode, so if a user registers with &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt;, the value you will receive will be &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; in Chrome but &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; in all other browsers supporting international email addresses. So, think twice and be careful using it!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;According to a &lt;a href=&quot;http://www.quirksmode.org/blog/archives/2015/02/poll_results_po.html&quot;&gt;survey&lt;/a&gt; by Peter-Paul Koch input type=”email” is the most used advanced input type. Which makes sense in my opinion as almost every site using a form also has a field for email. So, at a first glance it seems perfect to use it, browsers who support it will validate it, most mobile browsers will add the @ sign to the keyboard and most importantly, if a browser doesn’t support it, it falls back to type=”text”.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/02/safari_iphone6.png&quot; alt=&quot;screenshot Safari on iPhone6&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/02/windows81_lumia520.png&quot; alt=&quot;screenshot from Lumia520&quot;&gt;&lt;/p&gt;
&lt;p&gt;However, at a second glance, you will find out that it comes with some disadvantages and unexpected behaviors.&lt;/p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation &lt;a class=&quot;permalink&quot; href=&quot;#validation&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can use type=”email” to validate the value of the input. I put together a simple &lt;a href=&quot;https://jsbin.com/vakucin/2/edit?html,outputt&quot;&gt;test&lt;/a&gt; to find out which browsers accept which values for input type=”email”.&lt;/p&gt;
&lt;p&gt;Here are the values I tested:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;test&lt;/li&gt;
&lt;li&gt;test@&lt;/li&gt;
&lt;li&gt;test@test&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;mailto:test@127.0.0.1&quot;&gt;test@127.0.0.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;test@test.test&lt;/li&gt;
&lt;li&gt;test.O’test@test.com&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;mailto:test@xn--test-ooa.com&quot;&gt;test@testä.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;test@郵件.商務&lt;/li&gt;
&lt;li&gt;test@मोहन.ईन्फो&lt;/li&gt;
&lt;li&gt;testρ@εχαμπλε.ψομ&lt;/li&gt;
&lt;li&gt;!#$%&amp;amp;’*+-/=?^_`.{|}~@test.com&lt;/li&gt;
&lt;li&gt;user+mailbox/department=shipping@example.com&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Expect from 1 and 2 (which are invalid email addresses in any case), most browsers (expect from Firefox and Chrome – see Note 1) also invalidates 7 (Umlaut), 8 (Chinese), 9 (Hindi) and 10 (Greek). This list is far from complete, there are lots of languages with different writing systems.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://commons.wikimedia.org/wiki/File%3AWorld_alphabets_%26_writing_systems.svg&quot; title=&quot;By George Tsiagalakis [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/World_alphabets_%26_writing_systems.svg/1000px-World_alphabets_%26_writing_systems.svg.png&quot; alt=&quot;World alphabets &amp;amp; writing systems&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Image by George Tsiagalakis [&lt;a href=&quot;http://creativecommons.org/licenses/by-sa/3.0&quot;&gt;CC BY-SA 3.0&lt;/a&gt;], &lt;a href=&quot;http://commons.wikimedia.org/wiki/File%3AWorld_alphabets_%26_writing_systems.svg&quot;&gt;via Wikimedia Commons&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;* Note 1: Firefox added support for &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=618876&quot;&gt;international emails&lt;/a&gt; in Version 26 and Chrome also supports them (at least since version 56 – couldn’t find exact information when it was added).&lt;/p&gt;
&lt;h3 id=&quot;unexpected-values&quot;&gt;Unexpected values &lt;a class=&quot;permalink&quot; href=&quot;#unexpected-values&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In the latest Chrome version (56) international email addresses are now supported, but Chrome handles it different from Firefox. Chrome is transforming international email addresses to punycode, so if the input value is &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; the value will be &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can test it yourself in this &lt;a href=&quot;http://jsbin.com/nuqovod/2/edit?html,js,console,output&quot;&gt;jsbin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This can lead to a lot of trouble, imagine a user registers with &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; in Chrome, you will save &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; as the email in the database. Now, the next time the user is using Firefox to login to your site using &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; and the correct password, access will be denied as in Firefox the value send is &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt; (which you don’t know about) and not &lt;a href=&quot;mailto:test@xn--nda.at&quot;&gt;test@ö.at&lt;/a&gt;. The only way this can be solved is by checking if the value contains punycode on the server side and decode it there.&lt;/p&gt;
&lt;p&gt;As far as I interpret the &lt;a href=&quot;https://www.w3.org/TR/html5/forms.html#e-mail-state-(type=email)&quot;&gt;Specification&lt;/a&gt; the way Chrome is handling it is correct, but I may misread this.&lt;/p&gt;
&lt;p&gt;In any case we have different behaviours in different browsers at the moment and if you don’t want to handle it on the server side you better avoid &lt;code&gt;input type=&amp;quot;email&amp;quot;&lt;/code&gt; for the time being.&lt;/p&gt;
&lt;h3 id=&quot;a-regex-a-day%E2%80%A6&quot;&gt;A regex a day… &lt;a class=&quot;permalink&quot; href=&quot;#a-regex-a-day%E2%80%A6&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you want to validate against international email addresses and exclude domains with no TLD input type=”email” is not really our best bet. So, RegExp to the rescue you may say. Well, I thought so too but soon realized that a regular expression for this is way over my head. So, I asked &lt;a href=&quot;https://twitter.com/mathias&quot;&gt;Mathias Bynens&lt;/a&gt; for help on twitter and he pointed me to a &lt;a href=&quot;http://stackoverflow.com/questions/27829640/how-to-match-unicode-by-writing-system-script/27858354#27858354&quot;&gt;StackOverflow answer&lt;/a&gt; where he shows how to generate regular expression for different Unicode writing styles.&lt;/p&gt;
&lt;p&gt;While in theory it is probably possible to generate a Regex which matches every valid international email address I won’t still not trust it. Which brings me to the following conclusion – please do not use a pattern for email validation. Every regular expression for email validation is missing something. Lots of people gone through the process with the conclusion, that it is nearly impossible to get a perfect validation. If you don’t care about international email addresses use type=”email” without the pattern attribute.&lt;/p&gt;
&lt;p&gt;For reference here is the regular expression defined by the W3C for a valid email address (this does not include international email addresses):&lt;/p&gt;
&lt;p&gt;/^[a-zA-Z0-9.!#$%&amp;amp;’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;From my part, I will not use input type=”email” anymore in any of my projects. Preventing potential users for signing up with their email address (which may contain umlaut, non-latin characters…) is for me more important than semantic, validation and the @ on some virtual keyboards.&lt;/p&gt;
&lt;p&gt;If you would like to see international email address validation for input[type=email] in Microsoft Edge, please vote for it &lt;a href=&quot;https://windows.uservoice.com/forums/285214-microsoft-edge/suggestions/7855248-support-international-email-address-validation-for&quot;&gt;on Windows Uservoice&lt;/a&gt;, thanks!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 05/2015</title>
							<link>https://justmarkup.com/log/2015/02/browsers-and-bugs-052015/</link>
							<pubDate>2015-02-06T12:05:00+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/browsers-and-bugs-052015/</guid>
							<description>&lt;p&gt;Welcome to issue 5 of Browsers and Bugs. Happy testing!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;display%3A-contents&quot;&gt;&lt;a href=&quot;https://groups.google.com/forum/m/#!topic/mozilla.dev.platform/G2BkcDWptHQ&quot;&gt;display: contents&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#display%3A-contents&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Intent to ship: CSS display:contents in Firefox&lt;/p&gt;
&lt;h3 id=&quot;a-message-from-opera-to-google&quot;&gt;&lt;a href=&quot;https://github.com/operasoftware/browserjs/blob/master/OPRdesktop/browserjs-25.0.js#L252&quot;&gt;A message From Opera to Google&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#a-message-from-opera-to-google&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;security-bug-in-ie11&quot;&gt;&lt;a href=&quot;http://arstechnica.com/security/2015/02/serious-bug-in-fully-patched-internet-explorer-puts-user-credentials-at-risk/&quot;&gt;Security Bug in IE11&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#security-bug-in-ie11&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Serious bug in fully patched Internet Explorer puts user credentials at risk&lt;/p&gt;
&lt;h3 id=&quot;chrome-continues-to-fall-apart-at-brisk-pace&quot;&gt;&lt;a href=&quot;http://www.quirksmode.org/blog/archives/2015/02/chrome_continue.html&quot;&gt;Chrome continues to fall apart at brisk pace&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#chrome-continues-to-fall-apart-at-brisk-pace&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are loads of different &lt;a href=&quot;http://www.quirksmode.org/blog/archives/2015/02/counting_chromi.html&quot;&gt;Chromium-based Android default browsers&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;windows-substitutes-helvetica-for-arial&quot;&gt;&lt;a href=&quot;http://snook.ca/archives/html_and_css/windows-subs-helvetica-arial&quot;&gt;Windows Substitutes Helvetica for Arial&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#windows-substitutes-helvetica-for-arial&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;introducing-node-firefox&quot;&gt;&lt;a href=&quot;https://hacks.mozilla.org/2015/02/introducing-node-firefox/&quot;&gt;Introducing node-firefox&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#introducing-node-firefox&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A post explaining what node-firefox is and how can it help you superturbocharge your Firefox OS app development&lt;/p&gt;
&lt;h3 id=&quot;web-accessibility-toolbar&quot;&gt;&lt;a href=&quot;https://github.com/ThePacielloGroup/WebAccessibilityToolbar&quot;&gt;Web Accessibility Toolbar&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#web-accessibility-toolbar&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A new release of the Web Accessibility Toolbar for Internet Explorer&lt;/p&gt;
&lt;h3 id=&quot;empty-cache-%26-hard-reload-options-in-chrome&quot;&gt;&lt;a href=&quot;https://twitter.com/addyosmani/status/563130061231235072&quot;&gt;Empty Cache &amp;amp; Hard Reload options in Chrome&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#empty-cache-%26-hard-reload-options-in-chrome&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;the-curious-case-of-the-disappearing-polish-s&quot;&gt;&lt;a href=&quot;https://medium.com/medium-eng/the-curious-case-of-disappearing-polish-s-fa398313d4df&quot;&gt;The curious case of the disappearing Polish S&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#the-curious-case-of-the-disappearing-polish-s&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;One keyboard bug three decades in the making&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Prioritize loading of background images</title>
							<link>https://justmarkup.com/log/2015/02/prioritize-loading-of-background-images/</link>
							<pubDate>2015-02-02T16:37:47+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/02/prioritize-loading-of-background-images/</guid>
							<description>&lt;p&gt;Last Update: 12.05.2015&lt;/p&gt;
&lt;p&gt;Initially, I wanted to find a way to lazy-load background images, but all my tests confused me completely and I thought I should better move on with my daily tasks. Some days later, however, I was reading an article on &lt;a href=&quot;http://medium.com/&quot;&gt;medium.com&lt;/a&gt; and while the page was loading I recognized that the big background image was not appearing until the page has loaded completely. And there it hits me, is there a way to prioritize the loading of a background image so it will be shown earlier? So, I set up some more test and found out there is indeed a solution for it.&lt;/p&gt;
&lt;h3 id=&quot;tests%2C-tests%2C-tests&quot;&gt;Tests, Tests, Tests &lt;a class=&quot;permalink&quot; href=&quot;#tests%2C-tests%2C-tests&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I made all in all 9 &lt;a href=&quot;https://justmarkup.com/testtest/prio-bg-img/results.html&quot;&gt;tests&lt;/a&gt; and ran each one against 5 different browser/bandwidth combinations on Webpagetest (Chrome on Cable, Chrome on 3G, IE10 on DSL, Firefox on Cable and Chrome Mobile on 3G). I put together a site with all the &lt;a href=&quot;https://justmarkup.com/testtest/prio-bg-img/results.html&quot;&gt;results&lt;/a&gt; and details about every test.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/02/filmstrip-chrome-cable.png&quot; alt=&quot;Filmstrip of test&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;how-it-works&quot;&gt;How it works &lt;a class=&quot;permalink&quot; href=&quot;#how-it-works&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s have a look at some code to see how prioritizing the loading of background images works.&lt;/p&gt;
&lt;p&gt;Here is the HTML for the header image:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;header-img&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token style-attr&quot;&gt;&lt;span class=&quot;token attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;images/header-img.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And here is the CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.header-img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 500px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cover&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;images/header-img.jpg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First of all we insert an image element and set the src attribute to the same image file as the background image we want to use. We also hide the image with display: none;. This avoids that the image gets shown visually while still ensuring that the image gets requested by the browser. This means that the image is already available before any other background image gets loaded. Thanks to the browser preloader!&lt;/p&gt;
&lt;h3 id=&quot;video-comparison&quot;&gt;Video comparison &lt;a class=&quot;permalink&quot; href=&quot;#video-comparison&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here is one of the video comparison from my tests, the one in the middle (test2) uses the »preload background image via img« approach and as you can see the image is visually completed before the others.&lt;/p&gt;
&lt;p&gt;.embed-container { position: relative; padding-bottom: 33%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;What I like most about this approach is that no JavaScript is needed. You can like or hate the trend of showing big background images on websites but if you use it and want to make it visible as fast as possible this technique may be the solution. Furthermore, it seems that this technique also improves overall performance of page load – have to test this in more detail though.&lt;/p&gt;
&lt;p&gt;I hope this technique is reasonably and that I haven’t missed anything. Otherwise, please let &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;me&lt;/a&gt; know.&lt;/p&gt;
&lt;h3 id=&quot;update-12.05.2015-%E2%80%93-adding-responsive-image-example&quot;&gt;Update 12.05.2015 – adding responsive image example &lt;a class=&quot;permalink&quot; href=&quot;#update-12.05.2015-%E2%80%93-adding-responsive-image-example&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As &lt;a href=&quot;https://twitter.com/clmnsk/status/598114917590401024&quot;&gt;@clmnsk&lt;/a&gt; mentioned on twitter, this technique can also be used in combination with responsive images, more accurately by using srcset and media queries. Here is the example from above using three different images for three different screen sizes:&lt;/p&gt;
&lt;p&gt;Here is the HTML for the header image:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;images/header-img_small.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;srcset&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;images/header-img_small.jpg 600w, images/header-img_medium.jpg 900w, images/header-img_large.jpg 1200w&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And here is the CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.header-img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 500px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cover&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;images/header-img_small.jpg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token selector&quot;&gt;.header-img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;images/header-img_medium.jpg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; all &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 900px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token selector&quot;&gt;.header-img&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;images/header-img_large.jpg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 04/2015</title>
							<link>https://justmarkup.com/log/2015/01/browsers-and-bugs-042015/</link>
							<pubDate>2015-01-30T11:09:09+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/browsers-and-bugs-042015/</guid>
							<description>&lt;p&gt;Hello and welcome to the fourth issue of Browsers and Bugs. The biggest news this week definitely was the announcement of “Project Spartan”, a great move in the right direction from Microsoft. Happy debugging!&lt;/p&gt;
&lt;h2 id=&quot;browsers%2C-bugs-and-workarounds&quot;&gt;Browsers, Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#browsers%2C-bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;project-spartan&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/01/22/project-spartan-and-the-windows-10-january-preview-build.aspx&quot;&gt;Project Spartan&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#project-spartan&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Microsoft announced that Windows 10 will ship with a brand new browser, codenamed “Project Spartan.” You can test it on &lt;a href=&quot;https://remote.modern.ie/&quot;&gt;modern.ie&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;changeset-179132&quot;&gt;&lt;a href=&quot;http://trac.webkit.org/changeset/179132&quot;&gt;Changeset 179132&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#changeset-179132&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;WebKit fixed the issue with querySelectorAll and camelCase elements like SVG’s linearGradient.&lt;/p&gt;
&lt;h3 id=&quot;issue-446584%3A-sequential-navigation-failure-for-negative-tabindex-on-shadowhost&quot;&gt;&lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=446584&quot;&gt;Issue 446584: sequential navigation failure for negative tabindex on ShadowHost&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#issue-446584%3A-sequential-navigation-failure-for-negative-tabindex-on-shadowhost&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;firefox-bug-1052417&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1052417&quot;&gt;Firefox Bug 1052417&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-bug-1052417&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Default `sizes` attribute value for `srcset` should be 100vw&lt;/p&gt;
&lt;h3 id=&quot;vivaldi&quot;&gt;&lt;a href=&quot;http://www.cnet.com/news/ex-opera-ceo-launches-new-browser-vivaldi/&quot;&gt;Vivaldi&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#vivaldi&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Ex-Opera CEO composes Vivaldi, a new Web browser&lt;/p&gt;
&lt;h3 id=&quot;all-of-this-has-happened-before-and-will-happen-again&quot;&gt;&lt;a href=&quot;http://blog.adrianroselli.com/2015/01/all-of-this-has-happened-before-and.html&quot;&gt;All of This Has Happened Before and Will Happen Again&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#all-of-this-has-happened-before-and-will-happen-again&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The horror of a WebKit-only world.&lt;/p&gt;
&lt;h3 id=&quot;how-browsers-work%3A-behind-the-scenes-of-modern-web-browsers&quot;&gt;&lt;a href=&quot;http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/&quot;&gt;How Browsers Work: Behind the scenes of modern web browsers&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#how-browsers-work%3A-behind-the-scenes-of-modern-web-browsers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A must-read for every web developer&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;f12-developer-tools&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/01/27/updates-for-the-f12-developer-tools-in-the-windows-10-january-technical-preview.aspx&quot;&gt;F12 developer tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#f12-developer-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Updates for the F12 developer tools in the Windows 10 January Technical Preview&lt;/p&gt;
&lt;h3 id=&quot;using-aria-1.0-and-the-webkit-accessibility-node-inspector&quot;&gt;&lt;a href=&quot;https://www.webkit.org/blog/3302/aria_and_accessibility_inspector/&quot;&gt;Using ARIA 1.0 and the WebKit Accessibility Node Inspector&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#using-aria-1.0-and-the-webkit-accessibility-node-inspector&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;using-the-firefoxdevtools-to-understand-css-demos&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=eYYTKEIS6zw&quot;&gt;Using the FirefoxDevTools to understand CSS demos&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#using-the-firefoxdevtools-to-understand-css-demos&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;the-5-stages-of-debugging&quot;&gt;&lt;a href=&quot;https://twitter.com/abt_programming/status/556088278886383617/photo/1&quot;&gt;The 5 Stages of Debugging&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#the-5-stages-of-debugging&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B7efV9xIYAAAisB.jpg:large&quot; alt=&quot;The 5 Stages of Debugging&quot;&gt;&lt;br&gt;
via [@abt_programming](via &lt;a href=&quot;https://twitter.com/abt_programming/status/556088278886383617/photo/1&quot;&gt;https://twitter.com/abt_programming/status/556088278886383617/photo/1&lt;/a&gt;)&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Restart CSS Animation (using CSS to trigger a reflow)</title>
							<link>https://justmarkup.com/log/2015/01/restart-css-animation-using-css-to-trigger-a-reflow/</link>
							<pubDate>2015-01-26T18:13:34+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/restart-css-animation-using-css-to-trigger-a-reflow/</guid>
							<description>&lt;p&gt;Lately, I wanted to run an animation on page load and the same animation again on :hover. After some debugging I figured out this doesn’t work as expected.&lt;/p&gt;
&lt;p&gt;Here is the simplified CSS showing my problem:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* a simple animation */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@keyframes&lt;/span&gt; test&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;0%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; blue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; test 4s ease-out&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* run the animation again on hover, won&#39;t work this way */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; test 4s ease-out&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After a quick search, I came across this &lt;a href=&quot;http://css-tricks.com/restart-css-animation/&quot;&gt;article on css-tricks.com&lt;/a&gt; where Chris and Oli show techniques to solve this problem. The conclusion is that you can either use JavaScript or as Oli Studholme &lt;a href=&quot;http://dabblet.com/gist/1656494&quot;&gt;researched&lt;/a&gt;, use an identical @keyframes animation with a different name for :hover. As the article and research are quite old (in terms of web development 4 years is actually really old) I started a new jsbin and tried to find a different solution. After some trial and error, I found another way using CSS.&lt;/p&gt;
&lt;p&gt;So here it is:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* a simple animation */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@keyframes&lt;/span&gt; test&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;0%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; blue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* Trigger reflow */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@-webkit-keyframes&lt;/span&gt; test1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token selector&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; test 4s ease-out&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token comment&quot;&gt;/* run the animation again and again on hover, check! */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;div:hover&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token property&quot;&gt;animation-name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; test1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The trick is to add a second animation, which animates the width (can also be auto as you can see, so the width won’t change actually) to trigger reflow, to :hover. Try it out on &lt;a href=&quot;http://jsbin.com/fafedu/1/edit?html,css,output&quot;&gt;jsbin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It’s working in Firefox, Opera, Chrome and IE10 upwards.&lt;/p&gt;
&lt;p&gt;Any question? Contact &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;me&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 03/2015</title>
							<link>https://justmarkup.com/log/2015/01/browsers-and-bugs-032015/</link>
							<pubDate>2015-01-22T15:33:35+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/browsers-and-bugs-032015/</guid>
							<description>&lt;p&gt;As I will be in Oslo this weekend starting from tomorrow, you can enjoy this weeks Browsers and Bugs already on Thursday. Happy bug fixing!&lt;/p&gt;
&lt;h2 id=&quot;bugs-and-workarounds&quot;&gt;Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;filing-browser-bugs&quot;&gt;&lt;a href=&quot;http://www.paciellogroup.com/blog/2014/06/filing-bugs/&quot;&gt;Filing browser bugs&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#filing-browser-bugs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;by &lt;a href=&quot;https://twitter.com/stevefaulkner&quot;&gt;Steve Faulkner&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;parallel-js&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1117724&quot;&gt;Parallel JS&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#parallel-js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;PJS will be removed from the SpiderMonkey code base&lt;/p&gt;
&lt;h3 id=&quot;we-have-fixed-the-crazy-fixed-background-scrolling-jitters-bug-in-internet-explorer.&quot;&gt;&lt;a href=&quot;http://stackoverflow.com/questions/27966735/why-background-image-is-moving-when-scroll-at-ie/27971445#27971445&quot;&gt;We have fixed the crazy fixed-background scrolling-jitters bug in Internet Explorer.&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#we-have-fixed-the-crazy-fixed-background-scrolling-jitters-bug-in-internet-explorer.&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;via &lt;a href=&quot;https://twitter.com/jonathansampson&quot;&gt;@jonathansampson&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;force-page-zoomability-via-settings-on-firefox-for-android&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=852247&quot;&gt;Force page zoomability via settings on Firefox for Android&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#force-page-zoomability-via-settings-on-firefox-for-android&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;bugzilla-and-the-future-of-firefox-development&quot;&gt;&lt;a href=&quot;http://gregoryszorc.com/blog/2015/01/16/bugzilla-and-the-future-of-firefox-development/&quot;&gt;Bugzilla and the Future of Firefox Development&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bugzilla-and-the-future-of-firefox-development&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h3 id=&quot;new-opera-beta-for-linux&quot;&gt;&lt;a href=&quot;http://linux.softpedia.com/blog/New-Opera-Beta-for-Linux-Fixes-Facebook-Annoying-Bug-470030.shtml&quot;&gt;New Opera Beta for Linux&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#new-opera-beta-for-linux&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Mostly minor changes and a fix for an annoying Facebook bug&lt;/p&gt;
&lt;h2 id=&quot;debugging%2C-testing-and-more&quot;&gt;Debugging, Testing and more &lt;a class=&quot;permalink&quot; href=&quot;#debugging%2C-testing-and-more&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;discover-devtools&quot;&gt;&lt;a href=&quot;http://discover-devtools.codeschool.com/&quot;&gt;Discover DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#discover-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Interactive course for Chrome DevTools&lt;/p&gt;
&lt;h3 id=&quot;new-in-firefox-nightly-devtools&quot;&gt;&lt;a href=&quot;https://twitter.com/jsantell/status/555790131571871744/photo/1&quot;&gt;New in Firefox Nightly DevTools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#new-in-firefox-nightly-devtools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;View scheduled AudioParam automation values&lt;/p&gt;
&lt;h3 id=&quot;what-bug%3F-there-is-no-bug&quot;&gt;&lt;a href=&quot;http://www.commitstrip.com/en/2015/01/16/what-bug-there-is-no-bug/&quot;&gt;What bug? There is no bug&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#what-bug%3F-there-is-no-bug&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;via &lt;a href=&quot;https://twitter.com/CommitStrip&quot;&gt;@CommitStrip&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Load module-dependent JavaScript with basket.js</title>
							<link>https://justmarkup.com/log/2015/01/load-module-dependent-javascript-with-basket-js/</link>
							<pubDate>2015-01-19T14:13:11+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/load-module-dependent-javascript-with-basket-js/</guid>
							<description>&lt;p&gt;I tried different scripts, here is a &lt;a href=&quot;https://spreadsheets.google.com/lv?key=tDdcrv9wNQRCNCRCflWxhYQ&quot;&gt;spreadsheet&lt;/a&gt; of some of the JavaScript loaders available, but in the end I went with &lt;a href=&quot;http://addyosmani.github.io/basket.js/&quot;&gt;basket.js&lt;/a&gt;. Mostly because it uses local storage, it can order dependencies and supports loading of multiple scripts.&lt;/p&gt;
&lt;h3 id=&quot;code&quot;&gt;Code &lt;a class=&quot;permalink&quot; href=&quot;#code&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here is my approach to load JavaScript for page modules:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; version &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;  isModern &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;querySelector&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;localStorage&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;addEventListener&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;isModern&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;/* &quot;HTML5&quot; browsers */&lt;/span&gt;&lt;br&gt;  document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;/* load scripts/libs necessary for all pages */&lt;/span&gt;&lt;br&gt;    basket&lt;br&gt;      &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;url&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;dist/js/base.min.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; unique&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; version&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;          &lt;span class=&quot;token comment&quot;&gt;/* load fonts, see http://bdadam.com/blog/loading-webfonts-with-high-performance.html */&lt;/span&gt;&lt;br&gt;          basket&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;url&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;dist/js/fonts.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; unique&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; version&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;br&gt;          &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.js-module&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token comment&quot;&gt;/* load js for every module present on the current page&lt;br&gt;            * example: class=&quot;js-module js-module-gallery&quot; data-module-name=&quot;module-gallery&quot;&lt;br&gt;            */&lt;/span&gt;&lt;br&gt;            &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;dist/js/modules/&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataset&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;moduleName &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;            basket&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;url&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; src&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; unique&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; version&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;          &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token comment&quot;&gt;/* &quot;HTML4&quot; browsers */&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is what the HTML looks like for a module (in this case an embed tweet).&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;js-module js-module-twitter&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-module-name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;module-twitter&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;blockquote&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;twitter-tweet&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;DevTools Wishlist: emulate (low) RAM, GPU and CPU&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;    Michael (@justmarkup) &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;https://twitter.com/justmarkup/status/555801249866854400&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;January 15, 2015&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;blockquote&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And in the JavaScript file dist/js/modules/module-twitter.js the widgets.js from Twitter will be loaded to change the static blockquote into the interactive tweet version.&lt;/p&gt;
&lt;h3 id=&quot;advantages&quot;&gt;Advantages &lt;a class=&quot;permalink&quot; href=&quot;#advantages&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;JavaScript is loaded async&lt;/li&gt;
&lt;li&gt;On repeated view the scripts are served from local storage (decreases requests)&lt;/li&gt;
&lt;li&gt;Module-dependent JavaScript only gets loaded if module is visible on the page (Eg. you probably don’t need the twitter embed widget on every site)&lt;/li&gt;
&lt;li&gt;Progressive enhanced (if a user uses an old browser, JavaScript is not available or fails to load you still get to see the content)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;further-improvements&quot;&gt;Further improvements &lt;a class=&quot;permalink&quot; href=&quot;#further-improvements&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you use modules with a lot of extra CSS, you may also want to load this CSS dependent on your module, here is an &lt;a href=&quot;https://github.com/andrewwakeling/basket-css-example&quot;&gt;example&lt;/a&gt; showing how you can achieve this with basket.js.&lt;/p&gt;
&lt;h3 id=&quot;what-do-you-think%3F&quot;&gt;What do you think? &lt;a class=&quot;permalink&quot; href=&quot;#what-do-you-think%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I am really curious what you think about my way of loading JavaScript for page modules. Are there any disadvantages I miss? Let &lt;a href=&quot;http://www.twitter.com/justmarkup&quot;&gt;me&lt;/a&gt; know!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 02/2015</title>
							<link>https://justmarkup.com/log/2015/01/browsers-and-bugs-022015/</link>
							<pubDate>2015-01-16T10:29:17+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/browsers-and-bugs-022015/</guid>
							<description>&lt;p&gt;It’s Friday and this means a new roundup of Browsers and Bugs. Happy debugging!&lt;/p&gt;
&lt;h2 id=&quot;bugs-and-workarounds&quot;&gt;Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;letterspacing-disables-opentype-features-in-chrome-and-opera&quot;&gt;&lt;a href=&quot;http://codepen.io/bramstein/full/rajYEj/&quot;&gt;Letterspacing disables OpenType features in Chrome and Opera&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#letterspacing-disables-opentype-features-in-chrome-and-opera&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Demo and explanation on &lt;a href=&quot;http://codepen.io/bramstein/full/rajYEj/&quot;&gt;Codepen&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;firefox-35-was-released&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/Firefox/Releases/35&quot;&gt;Firefox 35 was released&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#firefox-35-was-released&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Besides lots of bug fixes it comes with support for WOFF2 fonts and the CSS Font Loading API (although still behind a flag)&lt;/p&gt;
&lt;h3 id=&quot;bug-life-cycle-and-reporting-guidelines&quot;&gt;&lt;a href=&quot;http://www.chromium.org/for-testers/bug-reporting-guidelines&quot;&gt;Bug Life Cycle and Reporting Guidelines&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bug-life-cycle-and-reporting-guidelines&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Tips for reporting bugs in Chromium&lt;/p&gt;
&lt;h3 id=&quot;a11y.js&quot;&gt;&lt;a href=&quot;https://github.com/medialize/ally.js&quot;&gt;a11y.js&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#a11y.js&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;ally.js by &lt;a href=&quot;https://twitter.com/rodneyrehm&quot;&gt;Rodney Rehm&lt;/a&gt; is a library to help applications with accessibility concerns. Among other things it includes fixes for &lt;a href=&quot;https://github.com/medialize/ally.js#working-around-browser-bugs&quot;&gt;working around browser bugs&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;sad-bugreporter-of-the-week&quot;&gt;&lt;a href=&quot;https://twitter.com/anna_debenham/status/553663446898991105?s=09&quot;&gt;Sad Bugreporter of the week&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#sad-bugreporter-of-the-week&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/anna_debenham/status/553663446898991105?s=09&quot;&gt;&lt;img src=&quot;http://justmarkup.com/log/wp-content/uploads/2015/01/bug-fix-sad-022015.png&quot; alt=&quot;bug-fix-sad-022015&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;debugging-and-testing&quot;&gt;Debugging and Testing &lt;a class=&quot;permalink&quot; href=&quot;#debugging-and-testing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;accessibility-developer-tools&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/accessibility-developer-t/fpkknkljclfencbdbgkenhalefipecmb&quot;&gt;Accessibility Developer Tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#accessibility-developer-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;An Addon for Chrome DevTools&lt;/p&gt;
&lt;h3 id=&quot;understanding-your-website-through-the-ie11-f12-tools&quot;&gt;&lt;a href=&quot;http://vimeo.com/97537017&quot;&gt;Understanding your website through the IE11 F12 tools&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#understanding-your-website-through-the-ie11-f12-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Conference talk by &lt;a href=&quot;https://twitter.com/thebeebs&quot;&gt;Martin Beeby&lt;/a&gt; about DevTools in Internet Explorer&lt;/p&gt;
&lt;h3 id=&quot;new-animation-inspector-panel-in-firefox-37&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=3UZdsbmYduQ&quot;&gt;New animation inspector panel in Firefox 37&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#new-animation-inspector-panel-in-firefox-37&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Firefox will integrate animation inspector into DevTools starting with version 37.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> The download attribute</title>
							<link>https://justmarkup.com/log/2015/01/the-download-attribute/</link>
							<pubDate>2015-01-13T08:38:38+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/the-download-attribute/</guid>
							<description>&lt;p&gt;The download attribute indicates the browser that a link should trigger the “Save as…” dialog instead of opening the file directly in the browser.&lt;/p&gt;
&lt;p&gt;Here is an example:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/363946739467/64634.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;download&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;custom-filename&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Link&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see you can specifiy the filename (in the example custom-filename) the file should be saved as, the extension will be added automatically.&lt;/p&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use cases &lt;a class=&quot;permalink&quot; href=&quot;#use-cases&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are various handy ways to use this attribute. You can use if for pdf files (which in some browsers get opened directly in browsers), which you want to be saved locally, eg. tickets. Another use case could be a Download-Section for your logos or link to music files. It is also great if you have a gallery and want to offer a “download fullsize image” link.&lt;/p&gt;
&lt;h3 id=&quot;demo&quot;&gt;Demo &lt;a class=&quot;permalink&quot; href=&quot;#demo&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/images/layout/logo.png&quot;&gt;Demo-Link without download attribute&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://justmarkup.com/images/layout/logo.png&quot;&gt;Demo-Link with download attribute (filename set to justmarkup)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2015/01/saveas.png&quot; alt=&quot;screenshot from save as modal&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;browser-support&quot;&gt;Browser Support &lt;a class=&quot;permalink&quot; href=&quot;#browser-support&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;See support on &lt;a href=&quot;http://caniuse.com/#feat=download&quot;&gt;Can I use&lt;/a&gt;. It’s currently (Jan 2015) not supported in Internet Explorer (&lt;a href=&quot;https://status.modern.ie/adownloadattribute&quot;&gt;Under Consideration&lt;/a&gt;) and Safari and there are some problems on Linux (&lt;a href=&quot;http://caniuse.com/#feat=download&quot;&gt;Known issues&lt;/a&gt;). But as it’s not breaking anything if a browser doesn’t support it, you can use it safely today.&lt;/p&gt;
&lt;h3 id=&quot;show-filesize&quot;&gt;Show filesize &lt;a class=&quot;permalink&quot; href=&quot;#show-filesize&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When providing a Download-Link you should also consider showing the size of the file. This will help the user to decide if it’s worth to download the file. Always remember that a user may use Roaming (and yes also on &lt;a href=&quot;http://www.smashingmagazine.com/smashing-newsletter-issue-128/&quot;&gt;Laptops&lt;/a&gt;) and don’t want to waste his limited bandwidth. Detecting the file size is not possible on the client-side but can easily be done server-side.&lt;br&gt;
Here is an example for php:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;filesize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$filename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token delimiter important&quot;&gt;?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And if you use Node.js you can use the following code:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;getFilesizeInBytes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; stats &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; fs&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;statSync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;filename&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; fileSizeInBytes &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; stats&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; fileSizeInBytes&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The download attribute is really helpful and can be used in many ways to enhance the user experience. You should consider using it when linking to big files or files which should be downloaded.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Browsers and Bugs 01/2015</title>
							<link>https://justmarkup.com/log/2015/01/browsers-and-bugs-012015/</link>
							<pubDate>2015-01-09T08:24:41+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/browsers-and-bugs-012015/</guid>
							<description>&lt;p&gt;There are probably more browser bugs than real bugs so I thought why not collect them and give a shout-out to the best ones crossing my way. So, this marks the beginning of a weekly roundup of my favorite browser bugs, best workarounds and other browser bugs related issues. Enjoy! As an extra, I will share tips/features/improvements for testing at the end.&lt;/p&gt;
&lt;h2 id=&quot;bugs-and-workarounds&quot;&gt;Bugs and Workarounds &lt;a class=&quot;permalink&quot; href=&quot;#bugs-and-workarounds&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;flexbugs&quot;&gt;&lt;a href=&quot;http://philipwalton.com/articles/normalizing-cross-browser-flexbox-bugs&quot;&gt;Flexbugs&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#flexbugs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s start with a fantastic list of cross-browser flexbox issues and their known workarounds by Philip Walton.&lt;br&gt;
&lt;a href=&quot;http://philipwalton.com/articles/normalizing-cross-browser-flexbox-bugs&quot;&gt;Article&lt;/a&gt; and &lt;a href=&quot;https://github.com/philipwalton/flexbugs&quot;&gt;Github Repo&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;the-chrome-css-bug-that-crashed-our-site&quot;&gt;&lt;a href=&quot;http://hackingui.com/front-end/chrome-box-shadow-bug-that-crashed-our-site/&quot;&gt;The Chrome CSS Bug That Crashed Our Site&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#the-chrome-css-bug-that-crashed-our-site&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Chrome has issue calculating inset box-shadows with large numbers. &lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=437128&quot;&gt;Fix&lt;/a&gt; will probably land in Chrome 40.&lt;/p&gt;
&lt;h3 id=&quot;bug-writing-guidelines-for-firefox&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines&quot;&gt;Bug writing guidelines for Firefox&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bug-writing-guidelines-for-firefox&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Effective bug reports are the most likely to be fixed. These guidelines explain how to write such reports.&lt;/p&gt;
&lt;h3 id=&quot;bugreport-from-the-past-(still-open)&quot;&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=129986&quot;&gt;Bugreport from the past (still open)&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bugreport-from-the-past-(still-open)&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Bug 129986 (from 2002) – Cached Gif animations don’t reset on reload.&lt;/p&gt;
&lt;h3 id=&quot;happy-bugreporter-of-the-week&quot;&gt;&lt;a href=&quot;https://twitter.com/stevefaulkner/status/551030318187417600&quot;&gt;Happy Bugreporter of the week&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#happy-bugreporter-of-the-week&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/stevefaulkner/status/551030318187417600&quot;&gt;&lt;img src=&quot;http://justmarkup.com/log/wp-content/uploads/2015/01/bug-fix-happy-012015.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;debugging-and-testing&quot;&gt;Debugging and Testing &lt;a class=&quot;permalink&quot; href=&quot;#debugging-and-testing&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;animation-controls-in-devtools-(chrome-canary)&quot;&gt;&lt;a href=&quot;http://www.valhead.com/2015/01/06/quick-tip-chrome-animation-controls/&quot;&gt;Animation controls in Devtools (Chrome Canary)&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#animation-controls-in-devtools-(chrome-canary)&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/vlh&quot;&gt;Val Head&lt;/a&gt; shares a sceencast showing how to use the animation play/pause and speed control in Devtools.&lt;/p&gt;
&lt;h3 id=&quot;ie-test-vms-on-modern.ie-get-a-refresh&quot;&gt;&lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2015/01/06/ie-test-vms-on-modern-ie-get-a-refresh.aspx&quot;&gt;IE test VMs on modern.IE get a refresh&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#ie-test-vms-on-modern.ie-get-a-refresh&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;VMs to help web developers test versions of Internet Explorer&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Give forms some extra attention</title>
							<link>https://justmarkup.com/log/2015/01/give-forms-some-extra-attention/</link>
							<pubDate>2015-01-06T09:24:20+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2015/01/give-forms-some-extra-attention/</guid>
							<description>&lt;p&gt;Some weeks ago I saw a great &lt;a href=&quot;https://dash.readme.io/login&quot;&gt;example&lt;/a&gt; of a login form with a lovely extra. On this login site, once the password field is focused, the owl, sitting on top of the form, hides her eyes, showing that the password can not be seen by others and therefore is private. I had to grin the first time I saw it and I am still impressed by the perfect association with privacy.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://justmarkup.com/log/wp-content/uploads/2014/12/readme_login_form.gif&quot;&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2014/12/readme_login_form.gif&quot; alt=&quot;Example of login form on readme.io&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thinking about other ways to enhance an input experience I came up with some ideas by myself.&lt;/p&gt;
&lt;h3 id=&quot;show-a-special-cursor&quot;&gt;Show a special cursor &lt;a class=&quot;permalink&quot; href=&quot;#show-a-special-cursor&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We can use the cursor property to show a “closed” eye once you hover over the password field. This can be done with the following CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.field-password&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;    &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;https://justmarkup.com/images/journal/eye-blocked.png&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the example on &lt;a href=&quot;http://jsbin.com/julutemoke/1/edit?html,css,output&quot;&gt;jsbin&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;show-fun-facts&quot;&gt;Show fun facts &lt;a class=&quot;permalink&quot; href=&quot;#show-fun-facts&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s say you have a sport site where users have to register to interact (eg. to comment on an article). Also assume you have a field for birthday in your form. Wouldn’t it be great if you could use a database of famous athletes and their birthdays (which you may already have) and once the user inserts his birthday, you could show a hint like “You are born the same day as Michael Jordan”. It’s a great association with the interest of your site and the user and furthermore gives the form some personality.&lt;/p&gt;
&lt;h3 id=&quot;show-days-until-next-birthday&quot;&gt;Show days until next birthday &lt;a class=&quot;permalink&quot; href=&quot;#show-days-until-next-birthday&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I have seen this already somewhere on a live site, but couldn’t remember where (if you know of an example, please let me know). The idea is to show the user the amount of days until her/his next birthday. You could use for example JavaScript to calculate the days and show it in a little hint after the user inserts the date of birth. You could even take this one step further and show a little birthday animation if the day really happens to be the birthday of the user.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As you can see there a many ways to enhance forms. It’s the &lt;a href=&quot;http://littlebigdetails.com/&quot;&gt;little big details&lt;/a&gt; that will make your site outstanding.&lt;br&gt;
I think it’s really worth to go the extra mile and enhance your form with a nice feature. We all have to enter data into forms every day and all know how boring this can be. Giving your forms an outstanding characteristic will make them unique, more fun and pleasant to use.&lt;/p&gt;
&lt;p&gt;If you know any other forms with a neat extra, please let me know &lt;a href=&quot;https://twitter.com/justmarkup&quot;&gt;@justmarkup&lt;/a&gt;&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Share quotes via twitter</title>
							<link>https://justmarkup.com/log/2014/12/share-quotes-via-twitter/</link>
							<pubDate>2014-12-18T12:08:19+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2014/12/share-quotes-via-twitter/</guid>
							<description>&lt;p&gt;Some days ago Christian Heilmann (@codepo8) wrote &lt;a href=&quot;https://medium.com/@codepo8/great-publishing-works-with-the-medium-not-against-it-fc7e66bbac88&quot;&gt;“Great publishing works with the medium, not against it”&lt;/a&gt;, where he argues against posting images with quotes on twitter. I totally agree with him, images with text included are a bad way to spread the word.&lt;/p&gt;
&lt;p&gt;This reminded me about an idea I had some months ago. The idea is to have a classic tweet link (&lt;a href=&quot;http://www.twitter.com/share&quot;&gt;http://www.twitter.com/share&lt;/a&gt;) at the bottom of the page and once you select a text, the text gets highlighted and you see a share button above the text.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2014/12/sharebutton.png&quot; alt=&quot;Share button above selected text&quot;&gt;&lt;/p&gt;
&lt;p&gt;After clicking “Tweet” you will get redirected to twitter with the selected text filled in the textarea. Furthermore you will notice that after selecting a text, the text will be added to the hash of the url. This way I can later reference the tweet with the text you selected, even if you decide to shorten/change the text of your tweet.&lt;/p&gt;
&lt;h3 id=&quot;where-is-the-quote%3F&quot;&gt;Where is the quote? &lt;a class=&quot;permalink&quot; href=&quot;#where-is-the-quote%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This is in fact not a new idea, &lt;a href=&quot;http://medium.com/&quot;&gt;medium.com&lt;/a&gt; and feedly, just to name two, already use similar share buttons. The new part about my script happens once somebody clicks the link you posted on twitter. After the page opens, the script grabs the quote from the hash, highlights the text and scrolls directly to the emphasized text. This way you can share quotes without the need of making a screenshot of the selected text and posting that as an image. Pretty neat, eh?&lt;/p&gt;
&lt;p&gt;The nice thing is that the &lt;a href=&quot;https://justmarkup.com/texttweet/index.html#If+you+use+an+old+browser+or+JavaScript+is+not+available+the+tweet+button+at+the+bottom+is+still+usable%2E&quot;&gt;highlight part&lt;/a&gt; works in almost every browser (if JavaScript is available).&lt;/p&gt;
&lt;p&gt;Furthermore if you are on a touch device or any older browser where the selection is not available there is still the tweet button sitting at the bottom ready to use.&lt;/p&gt;
&lt;p&gt;It needs more testing though, but I am quite happy with the current state, here is an &lt;a href=&quot;https://justmarkup.com/texttweet/index.html&quot;&gt;example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The code is on &lt;a href=&quot;https://github.com/justmarkup/texttweet.js&quot;&gt;Github&lt;/a&gt; and any help is more than welcome. Especially tests for older browsers, ways to get the selection part working on touch devices and accessibility improvements.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Reverse order of elements with CSS</title>
							<link>https://justmarkup.com/log/2014/11/reverse-order-of-elements-with-css/</link>
							<pubDate>2014-11-28T11:41:11+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2014/11/reverse-order-of-elements-with-css/</guid>
							<description>&lt;h3 id=&quot;reverse-with-transform&quot;&gt;Reverse with transform &lt;a class=&quot;permalink&quot; href=&quot;#reverse-with-transform&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This is done by setting transform: rotate(180deg); for the ol, and transform: rotate(-180deg); for every li element.&lt;/p&gt;
&lt;p&gt;Transform was certainly not build for this task, but it is animatable and browser support is very good.&lt;/p&gt;
&lt;p&gt;Specification: &lt;a href=&quot;http://www.w3.org/TR/css3-transforms/&quot;&gt;W3C Working Draft&lt;/a&gt;&lt;br&gt;
Browsersupport: &lt;a href=&quot;http://caniuse.com/#feat=transforms2d&quot;&gt;Can I use&lt;/a&gt;&lt;br&gt;
Animatable: yes&lt;br&gt;
Example (hover over list to reverse order): &lt;a href=&quot;http://jsbin.com/diqata/1/edit?output&quot;&gt;http://jsbin.com/diqata/1&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;reverse-with-flex-direction&quot;&gt;Reverse with flex-direction &lt;a class=&quot;permalink&quot; href=&quot;#reverse-with-flex-direction&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After posting my example with transform on twitter, &lt;a href=&quot;http://www.twitter.com/maddesigns&quot;&gt;Sven Wolfermann&lt;/a&gt; suggested using flexbox, more specific flex-direction: column-reverse; for this task.&lt;/p&gt;
&lt;p&gt;I haven’t used flexbox very often and obviously not thought about it. If you look it up on MDN it says » Behaves the same as row but the main-start and main-end points are permuted. « . Exactly what we want, no hack involved and thus perfect for our use case.&lt;/p&gt;
&lt;p&gt;But it also has some disadvantages: It isn’t animatable and browser support is currently not as good (IE10+) as for transforms.&lt;/p&gt;
&lt;p&gt;Specification: &lt;a href=&quot;http://www.w3.org/TR/css3-flexbox/#propdef-flex-direction&quot;&gt;W3C Working Draft&lt;/a&gt;&lt;br&gt;
Browsersupport: &lt;a href=&quot;http://caniuse.com/#feat=flexbox&quot;&gt;Can I use&lt;/a&gt;&lt;br&gt;
Animatable: no&lt;br&gt;
Example (hover over list to reverse order): &lt;a href=&quot;http://jsbin.com/girape/1/edit?output&quot;&gt;http://jsbin.com/diqata/1&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you are already using flexbox, flex-direction is probably the right choice. Though, if you want transitions or broader browser support the transform trick is a good alternative.&lt;/p&gt;
&lt;p&gt;Know any other ways to reverse order with CSS, please let me know.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Overview of Static Map solutions</title>
							<link>https://justmarkup.com/log/2014/05/overview-of-static-map-solutions/</link>
							<pubDate>2014-05-27T07:53:57+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2014/05/overview-of-static-map-solutions/</guid>
							<description>&lt;p&gt;For a recent redesign we mananged to reduce the page size to under 500kB for almost every part, expect the sections where we included a dynamic map. The size of an average dynamic map was about 600kbB, thus we had to find different ways to show a map and came across Static Maps, which turned out to be the perfect solution for us.&lt;/p&gt;
&lt;p&gt;Static Maps are relatively lightweight, can be customized and are the ideal candidate for progressive enhancement.&lt;/p&gt;
&lt;p&gt;I found the following solutions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#google&quot;&gt;Google Maps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#openstreetmap&quot;&gt;OpenStreetMap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#nokia&quot;&gt;Nokia HERE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#yandex&quot;&gt;Yandex&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;google-maps&quot;&gt;Google Maps &lt;a class=&quot;permalink&quot; href=&quot;#google-maps&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First of all, Google Maps. As described in the &lt;a href=&quot;https://developers.google.com/maps/documentation/staticmaps/index&quot;&gt;Developer Guide&lt;/a&gt; there are quite a few options to change the style of the map, add markers, paths and polygons. There are also &lt;a href=&quot;http://staticmapmaker.com/&quot;&gt;various&lt;/a&gt; &lt;a href=&quot;http://www.solvium.de/static-map/&quot;&gt;Map Generators&lt;/a&gt; available to help get you started.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&amp;amp;zoom=13&amp;amp;size=600x300&amp;amp;maptype=roadmapmarkers=color:blue%7Clabel:S%7C40.702147,-74.015794&amp;amp;markers=color:green%7Clabel:G%7C40.711614,-74.012318&amp;amp;markers=color:red%7Clabel:C%7C40.718217,-73.998284&amp;amp;sensor=false&quot; alt=&quot;static map image of downtown New York City&quot;&gt;&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&amp;amp;zoom=13&amp;amp;size=600x300&amp;amp;maptype=roadmap&lt;br&gt;&amp;amp;markers=color:blue%7Clabel:S%7C40.702147,-74.015794&amp;amp;markers=color:green%7Clabel:G%7C40.711614,-74.012318&lt;br&gt;&amp;amp;markers=color:red%7Clabel:C%7C40.718217,-73.998284&amp;amp;sensor=false&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;restrictions&quot;&gt;Restrictions &lt;a class=&quot;permalink&quot; href=&quot;#restrictions&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The maximum image size is 640×640 (or 1280×1280 if you use scale=2) for the free version and 2048×2048 for the Business version.&lt;/p&gt;
&lt;p&gt;The maximum quota per day is 1000 Static Maps image requests per IP address per 24 hour period and 25 000 Static Maps image requests per day if you use the &lt;a href=&quot;https://developers.google.com/maps/documentation/business/&quot;&gt;Google Maps API for Business&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;openstreetmap&quot;&gt;OpenStreetMap &lt;a class=&quot;permalink&quot; href=&quot;#openstreetmap&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are different ways to use OpenStreetMap Static Maps. As with Google Map all of these options comes with ways to customize the map. In most cases I would recommend either setting up your own web service or using the free online services available. If you however want to use a very specific map there are also &lt;a href=&quot;https://www.mapbox.com/plans/&quot;&gt;paid plans&lt;/a&gt; available.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;staticMapLite &lt;a href=&quot;http://staticmap.openstreetmap.de/&quot;&gt;PHP webservice&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Tyler &lt;a href=&quot;https://github.com/benbacardi/tyler&quot;&gt;Python webservice&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MapQuest &lt;a href=&quot;http://open.mapquestapi.com/staticmap/&quot;&gt;Online Service (Free)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MapBox &lt;a href=&quot;https://www.mapbox.com/blog/mapbox-static-api/&quot;&gt;Online Service (Free Plan available)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;http://open.mapquestapi.com/staticmap/v4/getmap?key=Kmjtd%7Cluu7n162n1%2C22%3Do5-h61wh&amp;amp;size=600,200&amp;amp;zoom=3¢er=35.60395,-98.906248&amp;amp;type=sat&amp;amp;pois=yellow_1,33.748867,-84.388185,0,0|yellow_1,29.763066,-95.363351,0,0&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;restrictions-1&quot;&gt;Restrictions &lt;a class=&quot;permalink&quot; href=&quot;#restrictions-1&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The solutions staticMapLite and Tyler which you can host on your own server comes with no restrictions.&lt;br&gt;
If you use Mapquest the maximum image size is 3840×3840 and there is no quota as far as I can see.&lt;br&gt;
MapBox has a size limit of 1280×1280 and the quota depends on your plan (3000/month for the free plan).&lt;/p&gt;
&lt;h3 id=&quot;nokia-here&quot;&gt;Nokia HERE &lt;a class=&quot;permalink&quot; href=&quot;#nokia-here&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Nokia HERE also offers a Static Map solution. To use it you have to create an &lt;a href=&quot;http://developer.here.com/get-started&quot;&gt;API Key&lt;/a&gt;.&lt;br&gt;
As you can see in the &lt;a href=&quot;https://developer.here.com/rest-apis/documentation/enterprise-map-image/topics/examples.html&quot;&gt;examples&lt;/a&gt; there are various ways to style a map, including heat maps and picture-in-picture maps.&lt;/p&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2014/05/picture-in-picture-nlp.jpg&quot; alt=&quot;Example of picture in picture&quot;&gt;&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;http://image.maps.cit.api.here.com/mia/1.6/mapview?app_id=DemoAppId01082013GAL&amp;amp;app_code=AJKnXv84fjrb0KIHawS0Tg&amp;amp;c=62.24167616,25.74536193&amp;amp;h=300&amp;amp;w=400&amp;amp;z=8&amp;amp;pip&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;restrictions-2&quot;&gt;Restrictions &lt;a class=&quot;permalink&quot; href=&quot;#restrictions-2&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The free plan has a limit of 10,000 requests / day and as far as I can see there are no restrictions regarding image size.&lt;/p&gt;
&lt;h3 id=&quot;yandex&quot;&gt;Yandex &lt;a class=&quot;permalink&quot; href=&quot;#yandex&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Last but not least also Yandex offers a &lt;a href=&quot;http://api.yandex.com/maps/doc/staticapi/1.x/dg/concepts/input_params.xml&quot;&gt;Static Map API&lt;/a&gt;. It also offers basic options to set markers, define lines and polygons but lacks support for different styles.&lt;/p&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;img src=&quot;https://static-maps.yandex.ru/1.x/?lang=en-US&amp;amp;ll=32.810152,39.889847&amp;amp;%5Csize=450,450&amp;amp;z=10&amp;amp;l=map&amp;amp;pt=32.810152,39.889847,pm2rdl1~32.870152,39.869847,pm2rdl99&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;http://static-maps.yandex.ru/1.x/?lang=en-US&amp;amp;ll=32.810152,39.889847&amp;amp; \ &lt;br&gt;size=450,450&amp;amp;z=10&amp;amp;l=map&amp;amp;pt=32.810152,39.889847,pm2rdl1~32.870152,39.869847,pm2rdl99&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;restrictions-3&quot;&gt;Restrictions &lt;a class=&quot;permalink&quot; href=&quot;#restrictions-3&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The maximum size allowed for the map display is 650×450 pixels and the maximum requests per day is 25,000.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Every solution has pros and cons and it’s up to you which solution works best for you and if you are either willing to pay or can live with the restrictions. If you however want no restrictions and be independent the best way is to host one of the OpenStreetMap solutions by yourself.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Maphancement – progressive enhanced Google Map</title>
							<link>https://justmarkup.com/log/2014/05/maphancement-progressive-enhanced-google-map/</link>
							<pubDate>2014-05-11T11:50:39+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2014/05/maphancement-progressive-enhanced-google-map/</guid>
							<description>&lt;p&gt;For most websites I build these days I have to integrate a map, mostly as a bonus for the contact page. Until now I simple used an Iframe loading a Google Map with the desired address centered. This however comes with a cost, even a realativeley small map loads ~600 KB (See &lt;a href=&quot;http://jsbin.com/xezey/2&quot;&gt;this example of a 400×200 map&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;That’s why I searched for a way to show the address in a visual way without loading unnecessary data and stumbled across &lt;a href=&quot;https://developers.google.com/maps/documentation/staticmaps/&quot;&gt;Static Maps&lt;/a&gt;. Showing the example from above as a static map, we save ~550 KB, which is fantastic for news for performance.&lt;/p&gt;
&lt;p&gt;![Static map of Brooklyn Bridge, New York, USA](&lt;a href=&quot;https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&amp;amp;zoom=13&amp;amp;size=600x300&amp;amp;maptype=roadmap&amp;amp;markers=color:blue%7Clabel:S%7C40.702147,-74.015794&amp;amp;markers=color:green%7Clabel:G%7C40.711614-74.012318&quot;&gt;https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&amp;amp;zoom=13&amp;amp;size=600x300&amp;amp;maptype=roadmap&amp;amp;markers=color:blue|label:S|40.702147,-74.015794&amp;amp;markers=color:green|label:G|40.711614-74.012318&lt;/a&gt; &amp;amp;markers=color:red%7Clabel:C%7C40.718217,-73.998284&amp;amp;sensor=false)&lt;br&gt;
Example of a Static Map&lt;/p&gt;
&lt;p&gt;Ok, problem solved? Well, you could offer an additional link to the full map to give users a way to navigate through the map and you are probably good to go. Thinking about some of clients I know, this isn’t enough, they want a dynamic map directly on their site. And that’s way I created Maphancement (silly play of words from map and enhanced). It is a tiny JavaScript code which converts the static map into a dynamic map once the user interacts (clicks, drags) with the map. This way we still loose ~90% of KB on first page load, whereas we can still offer a dynamic map if desired.&lt;/p&gt;
&lt;p&gt;You can find more infos and the code in the &lt;a href=&quot;https://github.com/justmarkup/maphancement&quot;&gt;Github Repo&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Notify me … the Notification API in use</title>
							<link>https://justmarkup.com/log/2013/09/notification-api/</link>
							<pubDate>2013-09-24T10:14:15+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2013/09/notification-api/</guid>
							<description>&lt;p&gt;In this article I am going to show you the current status of the Notification API, explain different browser implementations and show off how to use the API.&lt;/p&gt;
&lt;h3 id=&quot;browser-support&quot;&gt;Browser Support &lt;a class=&quot;permalink&quot; href=&quot;#browser-support&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;At the moment (August 2013) the following browsers support the Notification API. For further details, check the current status on &lt;a href=&quot;http://caniuse.com/notifications&quot;&gt;caniuse.com&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Firefox 22+&lt;/li&gt;
&lt;li&gt;Chrome 5+&lt;/li&gt;
&lt;li&gt;Safari 6+ (only on Mountain Lion)&lt;/li&gt;
&lt;li&gt;Blackberry 10&lt;/li&gt;
&lt;li&gt;Firefox for Android&lt;/li&gt;
&lt;li&gt;Firefox OS&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;introduction&quot;&gt;Introduction &lt;a class=&quot;permalink&quot; href=&quot;#introduction&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The Notification API allows you to display notifications to users outside of a web page without the need of any interaction by the user. This way you can notify the user even if the browser is currently not in focus, and remind him of new emails, tweets or whatever you may think the user needs to know right now.&lt;/p&gt;
&lt;h3 id=&quot;check-for-support&quot;&gt;Check for support &lt;a class=&quot;permalink&quot; href=&quot;#check-for-support&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Well, if we would only want to know if a browser fulfils the official W3C Specification, we could simple check for&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Notification&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; window&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;, but as old WebKit browsers and Firefox for mobile have different implemenations, the final check is:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; NotificationIsSupported &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification &lt;span class=&quot;token comment&quot;&gt;/* W3C Specification */&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; win&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications &lt;span class=&quot;token comment&quot;&gt;/* old WebKit Browsers */&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;mozNotification &lt;span class=&quot;token comment&quot;&gt;/* Firefox for Android and Firefox OS */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;ask-for-permission&quot;&gt;Ask for permission &lt;a class=&quot;permalink&quot; href=&quot;#ask-for-permission&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2013/07/notification_11.png&quot; alt=&quot;Screenshot showing the request permission dialogue in Firefox 22&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2013/07/Bildschirmfoto-vom-2013-08-22-144003.png&quot; alt=&quot;Permission request on Chrome 28&quot;&gt;&lt;/p&gt;
&lt;p&gt;Before we can show a Notification users have to grant permission. On Firefox OS this can be done within the manifest.webapp by setting the appropriate permssion for Desktop Notifications.&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&quot;permissions&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;&quot;desktop-notification&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;&quot;description&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;To show notifications&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On every other browser we have to attach the requestPermission() function to an event handler, like click or mousedown. It is important to mention, that it is not possible to ask for permission and show notifications without any interaction from the user.&lt;/p&gt;
&lt;p&gt;Altough Chrome 23 supports window.Notification.requestPermission it will break the browser, so we first have to check for the old WebKit implemantation to get it successfully running there. Here is the cross-browser way to ask for permission.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; askForPermission &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;askforpermission&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;br&gt;askForPermission&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;checkPermission&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;		window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;requestPermission&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;requestPermission&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;		window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;requestPermission&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;check-permission-level&quot;&gt;Check permission level &lt;a class=&quot;permalink&quot; href=&quot;#check-permission-level&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After requesting permission we have to check the permission level. There are three possible values we may get after asking for permission:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;0 (WebKit) or “default” (W3C) – User hasn’t reacted yet&lt;/li&gt;
&lt;li&gt;1 (WebKit) or “granted” (W3C) – User allowed us to show notifications&lt;/li&gt;
&lt;li&gt;2 (WebKit) or “denied” (W3C) – User did NOT allow us to show noticiations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can see, the values in old WebKit implementations are quite different. Therefore and since the permission on Firefox OS will always be granted our final check looks like this.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;PERMISSION_DEFAULT&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;default&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token constant&quot;&gt;PERMISSION_GRANTED&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;granted&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token constant&quot;&gt;PERMISSION_DENIED&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;denied&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token constant&quot;&gt;PERMISSION&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PERMISSION_GRANTED&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;PERMISSION_DEFAULT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;PERMISSION_DENIED&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;checkPermission&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; permission&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;checkPermission&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		permission &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;PERMISSION&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;checkPermission&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;mozNotification&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;		permission &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;PERMISSION_GRANTED&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;permission&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;		permission &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;permission&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; permission&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;show-the-notification&quot;&gt;Show the notification &lt;a class=&quot;permalink&quot; href=&quot;#show-the-notification&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/log/wp-content/uploads/2013/07/Bildschirmfoto-vom-2013-08-22-161733.png&quot;&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2013/07/Bildschirmfoto-vom-2013-08-22-161733.png&quot; alt=&quot;&quot; title=&quot;Notification in Firefox&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After handling the permission we can finally start showing notifications. Here is the rather long cross-browser code to do so.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;showNotification&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;title&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; notification&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;checkPermission&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;PERMISSION_GRANTED&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;			notification &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Notification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;title&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;				icon&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;icon &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;				body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;				tag&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tag &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br&gt;			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;			notification &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webkitNotifications&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createNotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;icon&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; title&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;			notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;mozNotification&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;			notification &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;mozNotification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createNotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;title&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;icon&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;			notification&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; notification&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;br&gt;&lt;br&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; showNotificationButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;shownotificationbutton&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br&gt;showNotificationButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;	&lt;span class=&quot;token function&quot;&gt;showNotification&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Title&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;br&gt;		body&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Body&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;		icon&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;icon.ico&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br&gt;		tag&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;tag&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;		dir&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ltr&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br&gt;		lang&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;en-US&quot;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let me explain it step by step.&lt;/p&gt;
&lt;p&gt;First of all we define a function (here it is called showNotification), to handle the different browser implementations.&lt;br&gt;
Within this function we first have to make sure that we are able to show notifications by checking against the function checkPermission, defined further above (checkPermission() === PERMISSION_GRANTED).&lt;/p&gt;
&lt;p&gt;If the check is true, we define a new Notification Object, where we pass one or more of the following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Title (necessary)&lt;/li&gt;
&lt;li&gt;Body (optional)&lt;/li&gt;
&lt;li&gt;Icon (optional)&lt;/li&gt;
&lt;li&gt;Tag (optional, only in the W3C Spec)&lt;/li&gt;
&lt;li&gt;Dir (optional, only in the W3C Spec)&lt;/li&gt;
&lt;li&gt;Lang (optional, only in the W3C Spec)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Last step is to attach the function to an event handler and pass the parameters we want to show to the user.&lt;/p&gt;
&lt;h3 id=&quot;r%C3%A9sum%C3%A9&quot;&gt;Résumé &lt;a class=&quot;permalink&quot; href=&quot;#r%C3%A9sum%C3%A9&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The Notification API in his final form is relatively new and therefore browser support is not that great at the moment, but as I see this API only as a nice to have feature, there speaks nothing against not using it today. As the old WebKit implementation and the Firefox OS implementation will be around for a while, I definitely would use a Pollyfill, to avoid the headache I had, trying to get it running on different browser.&lt;/p&gt;
&lt;h3 id=&quot;demo&quot;&gt;Demo &lt;a class=&quot;permalink&quot; href=&quot;#demo&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you want to see it in action check out the &lt;a href=&quot;http://ttsvetko.github.io/HTML5-Desktop-Notifications/&quot;&gt;Demo&lt;/a&gt; made by Tsvetan Tsvetkov.&lt;/p&gt;
&lt;h3 id=&quot;further-reading&quot;&gt;Further reading &lt;a class=&quot;permalink&quot; href=&quot;#further-reading&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/TR/notifications/&quot;&gt;W3C Working Draft&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/notification&quot;&gt;MDN article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caniuse.com/notifications&quot;&gt;Support table&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/ttsvetko/HTML5-Desktop-Notifications&quot;&gt;Pollyfill by Tsvetan Tsvetkov&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Special thanks to Tsvetan Tsvetkov for proofreading the article!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> There is a bug</title>
							<link>https://justmarkup.com/log/2013/06/there-is-a-bug/</link>
							<pubDate>2013-06-24T17:25:09+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2013/06/there-is-a-bug/</guid>
							<description>&lt;p&gt;Almost every day I get emails like “Hey Michael, on site &lt;a href=&quot;http://bla.com/&quot;&gt;bla.com&lt;/a&gt; something looks odd” or “Hello, can you please fix the site &lt;a href=&quot;http://bla.com/&quot;&gt;bla.com&lt;/a&gt;, it looks strange on my computer”. Well, sometimes they are more detailed “Bug Reports” than the ones mentioned, but nevertheless, without getting more details about the OS, Browser, … I mostly couldn’t help them in the first step.&lt;/p&gt;
&lt;p&gt;So I used to respond them, asking what Browser, Browserversion, OS… they are using to reproduce the error they wanted to tell me, but I soon realized that it’s really hard for most people to provide me with all the details and very time consuming for me to ask again and again.&lt;/p&gt;
&lt;p&gt;Therefore I started a little project called “Bugreporter”, which makes it easy for everybody, supplying all the details to me. Nowadays I respond them with “Hey, can you please visit &lt;a href=&quot;http://bugspencer.com/bugreport/&quot;&gt;bugspencer.com/bugreport/&lt;/a&gt;, copy the url and send it back to me”. Once I get the feedback, I simple open the url in my browser and can see all information I want from them.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/log/wp-content/uploads/2013/06/Bug-Report1.jpg&quot;&gt;&lt;img src=&quot;https://justmarkup.com/log/wp-content/uploads/2013/06/Bug-Report1.jpg&quot; alt=&quot;&quot; title=&quot;Bug Report1&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This simple site is not perfect at the moment, as it’s still missing some detection and I haven’t yet tested it in some older browsers, but it’s already a time and frustration saver for me.&lt;/p&gt;
&lt;p&gt;So, if you also get these sort of emails, feel free to fork &lt;a href=&quot;https://github.com/justmarkup/bugreporter&quot;&gt;Bugreporter&lt;/a&gt;, adjust the logo and the style to your corporate identity and get browser details the easy way.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Just my test setup</title>
							<link>https://justmarkup.com/log/2013/02/my-test-setup/</link>
							<pubDate>2013-02-03T15:45:58+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2013/02/my-test-setup/</guid>
							<description>&lt;p&gt;From time to time people ask me on which devices and with which browsers I usually do testing. Simple answer: It depends – There are just too many aspects involved to give a straight answer. Nevertheless, within the last months I defined myself a basic test setup, which works out really well so far. It consists of four parts – Mockups, Design, User Interface and Final Check.&lt;/p&gt;
&lt;h3 id=&quot;mockups&quot;&gt;Mockups &lt;a class=&quot;permalink&quot; href=&quot;#mockups&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To get a first glimpse how the site should look like I usally start by producing Mockups with HTML and CSS. This part is taking place completely in the desktop browser, I prefer Firefox, because I love the “Responsive Design” feature. I usually test them starting from about 280 – 320px up to ~ 1600px. I try to spend not to much time in details in this step, it’s really just to get a basic idea.&lt;/p&gt;
&lt;h3 id=&quot;design&quot;&gt;Design &lt;a class=&quot;permalink&quot; href=&quot;#design&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;With the mockups in place, it’s time to go and do the actual design. That’s the stage where my little device friends enter the game. In my case that’s a Samsung Galaxy Ace running Android 2.2 (The old Droid) an iPad running iOS 6 (The Princess) and a Nexus 7 running Android 4.2 (The Fudge). Adding Firefox and Internet Explorer 7 via Browserstack and my test setup for the design part is complete.&lt;/p&gt;
&lt;p&gt;You may argue that you can to the design part completely in your desktop browser using Responsive Design View and eg. Browserstack as an addition, but by doing so you will for sure overlook many critical design parts. Just think about different pixel densities and screen contrasts. Start testing on real devices early in the process is crucial and avoids the problem of overseeing wrong design decisions, which may be a pain in the ass if you stick to your desktop at this part.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/log/wp-content/uploads/2013/02/opera-tv.png&quot;&gt;&lt;img src=&quot;http://justmarkup.com/log/wp-content/uploads/2013/02/opera-tv-1024x575.png&quot; alt=&quot;Testing with Opera-TV Emulator&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;user-interface&quot;&gt;User Interface &lt;a class=&quot;permalink&quot; href=&quot;#user-interface&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The term Responsive Design may sound that it’s mostly about design, but in fact that’s just a tiny part of the process. Just think about input types – keyboard, mouse, finger, keypad, game controller, remote control, just to name some. Testing a design by actually using different devices, with different input types, shapes and forms is a very important part for everyone.&lt;/p&gt;
&lt;p&gt;My test setup consists of the same as in the design part, but most of the time I add an phone with a Trackwheel and a Keyboard. In some projects I also use the Opera TV Emulator, not just because I like the virtual remote control, but mostly to get a harsh dent what it feels like to surf on such a device. So in summary, in this process I actually do a lot of testing, sometimes I also switch from my personal phone to another for a longer period to get a better feeling of the device.&lt;/p&gt;
&lt;h3 id=&quot;final-check&quot;&gt;Final Check &lt;a class=&quot;permalink&quot; href=&quot;#final-check&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;So, the design looks gorgeous, surfing around the site works like a charm and you are ready to ship the baby. Before releasing a new site however, be sure not to miss the beloved testing fun. I can’t help myself, but I really enjoy the final testing part. That’s the time where I mostly hang around at the &lt;a href=&quot;http://opendevicelab.com/#!odl=198&quot;&gt;Open Device Lab berlin&lt;/a&gt; and spend hours of testing and debugging on as many devices I can get my fingers on. Furthermore I also try to test not only on the pre installed browsers but also on other available browsers, you shouldn’t miss Opera Mini for example. The great thing is that their isn’t so much debugging involved, simple because I already tested a lot the whole way through and fixed issues early.&lt;/p&gt;
&lt;p&gt;So, what is your test setup?&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Responsive Images – what? width! this? no, this! hä?</title>
							<link>https://justmarkup.com/log/2013/01/responsive-images-what-width-this-no-this-ha/</link>
							<pubDate>2013-01-16T20:37:22+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2013/01/responsive-images-what-width-this-no-this-ha/</guid>
							<description>&lt;p&gt;2012, the year where reponsive Images got mainstream and became the rockstar of many dramas just ended some time ago and I am sure you are looking forward to 2013 for the next “responsive Image affair”. I have never planned to attend this show, but just today, while walking through Berlin, I couldn’t think of anything else.&lt;/p&gt;
&lt;p&gt;Why do we deliver images based on the maximal window width and NOT on the actual available container width?&lt;/p&gt;
&lt;p&gt;Do make this more clear, have a look at an &lt;a href=&quot;http://jsbin.com/urivab/1&quot;&gt;example&lt;/a&gt;, showing a simple layout on different resolutions.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/log/wp-content/uploads/2013/01/480w.png&quot;&gt;&lt;img src=&quot;http://justmarkup.com/log/wp-content/uploads/2013/01/480w-300x219.png&quot; alt=&quot;Example Website 500px width&quot; title=&quot;480w&quot;&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://justmarkup.com/log/wp-content/uploads/2013/01/640w.png&quot;&gt;&lt;img src=&quot;http://justmarkup.com/log/wp-content/uploads/2013/01/640w-300x260.png&quot; alt=&quot;Example Site 660 width&quot; title=&quot;640w&quot;&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://justmarkup.com/log/wp-content/uploads/2013/01/1000w.png&quot;&gt;&lt;img src=&quot;http://justmarkup.com/log/wp-content/uploads/2013/01/1000w-300x169.png&quot; alt=&quot;Example Site 1000px width&quot; title=&quot;1000w&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The first one shows a site on a 480x320px screen, the second is 645x415px and the last 1001x514px. Ok, so lets have a look at an example using picturefill:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-picture&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;A giant stone face at The Bayon temple in Angkor Thom, Cambodia&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;small.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;medium.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;     &lt;span class=&quot;token attr-name&quot;&gt;data-media&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;(min-width: 400px)&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;large.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;      &lt;span class=&quot;token attr-name&quot;&gt;data-media&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;(min-width: 640px)&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;extralarge.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-media&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;(min-width: 1000px)&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;&lt;br&gt;    &lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Fallback content for non-JS browsers. Same img src as the initial, unqualified source element. --&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;noscript&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;external/imgs/small.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;A giant stone face at The Bayon temple in Angkor Thom, Cambodia&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;noscript&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;br&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using this, our first screen will get the medium img, the second the large.jpg and the last one the extralarge.jpg. And here is the problem, because the site with 645x415px has only room to show an image which is 386px width, while the smallest resolution (480x320px) can show an 405px width image. Understand my concerns? In a perfect world we should have shown the small.jpg for the 645x415px screen, instead of delivering an way too big image, shouldn’t we?&lt;/p&gt;
&lt;p&gt;I couldn’t find any reference sharing my concerns, there is nothing about it in the &lt;a href=&quot;https://dvcs.w3.org/hg/html-proposals/raw-file/9443de7ff65f/responsive-images/responsive-images.html&quot;&gt;W3C draft&lt;/a&gt; nor could I find any post in the &lt;a href=&quot;http://www.w3.org/community/respimg/&quot;&gt;Respimg Group&lt;/a&gt;. I couldn’t be the first one thinking about this problem, and I am sure many people shared there thoughts – so please tell me where I can find references, discussions, … as I would like to know the advantages and disadvantages of checking for window/container width. Thanks.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Every web design is broken</title>
							<link>https://justmarkup.com/log/2013/01/every-web-design-is-broken/</link>
							<pubDate>2013-01-08T08:58:42+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2013/01/every-web-design-is-broken/</guid>
							<description>&lt;p&gt;What an attention-grabbing title, isn’t it. Actually it’s how the web works, belief it or not. Just to be clear, I don’t talk about websites looking different on different browsers, OS, screen resolution – whatever, a website looking different is actually a great thing, every website should look diverse on different platforms. Point.&lt;/p&gt;
&lt;p&gt;What I mean is, that every single website out there is broken in one or another browser, just because you will never ever be able to test on every single browser still in use. At the latest after looking at this &lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/7/74/Timeline_of_web_browsers.svg&quot;&gt;diagram of web browsers&lt;/a&gt; it should be clear, even if you only want to test on all browsers released in the past 3 years, 24 hours a day won’t be sufficient.&lt;/p&gt;
&lt;h3 id=&quot;hey%2C-i-am-the-web%2C-i-change-my-clothes-more-often-than-madonna&quot;&gt;Hey, I am the web, I change my clothes more often than Madonna &lt;a class=&quot;permalink&quot; href=&quot;#hey%2C-i-am-the-web%2C-i-change-my-clothes-more-often-than-madonna&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Last year, Brad Frost shared a screenshot showing &lt;a href=&quot;http://google.com/&quot;&gt;google.com&lt;/a&gt; on &lt;a href=&quot;http://www.flickr.com/photos/brad_frost/7030374923/sizes/m/in/photostream/&quot;&gt;loads of different android browsers&lt;/a&gt;, and as you can see, even a simple page like &lt;a href=&quot;http://google.com/&quot;&gt;google.com&lt;/a&gt; looks broken on one browser, in this case Skyfire. So, hey if even a global player like Google, serves a broken landingpage to one or another browser.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://farm8.staticflickr.com/7122/7030374923_1a1e649891.jpg&quot; alt=&quot;Screenshot showing google.com rendered on different android browsers&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;works-on-all-devices-is-plain-bullshit&quot;&gt;Works on all devices is plain bullshit &lt;a class=&quot;permalink&quot; href=&quot;#works-on-all-devices-is-plain-bullshit&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Thinking of 2012, this is probably the most stupid marketing slogan I heard. Every time someone claims this, I opened up the site/app/whatevermarketingguyscallit on Opera Mini and boom, in 90% of all cases, it didn’t work. Ah, I thought, that’s marketing language, “all” means iOS and Android Stock Browser only, ah how stupid of me thinking that “all”, actually means “all”, you know, marketing is not my passion I guess.&lt;/p&gt;
&lt;h3 id=&quot;but%2C-eehm%2C-shouldn%E2%80%99t-we-change-this&quot;&gt;But, eehm, shouldn’t we change this &lt;a class=&quot;permalink&quot; href=&quot;#but%2C-eehm%2C-shouldn%E2%80%99t-we-change-this&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As the article comes to an end, and you probably learned nothing, besides that I am not the best friend of marketing slogans, I don’t want to leave you back without some simple advices. The web is unpredictable, is moving forward faster than a spaceship while still being the good old companion we loved, hated and loved again for ages. Your web design is broken and will broke again and again. New browsers emerge, while old for year outdated browsers are still in use. You can’t change this, but you can make the most out of it.&lt;/p&gt;
&lt;p&gt;The best way, to reduce the amount of browsers, where something may be broken, is building a website in a &lt;a href=&quot;http://futurefriend.ly/&quot;&gt;future-friendly&lt;/a&gt; way, using progressive enhancement and accessibility always in mind. And, please don’t blame users using an old browser or a tiny screen. The only one you can blame, is yourself, if you look out browsers using ua sniffing or whatever, yes I am looking at you &lt;a href=&quot;http://mashable.com/2013/01/05/google-maps-windows-phone/&quot;&gt;Google Maps&lt;/a&gt;. And now, after reading a lot of words for a simple thought, go out there and make the &lt;a href=&quot;http://theawesomeweb.com/&quot;&gt;awesome web&lt;/a&gt; even more awesome.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Be carefull when using input type=”url”</title>
							<link>https://justmarkup.com/log/2012/12/input-url/</link>
							<pubDate>2012-12-28T17:56:30+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/12/input-url/</guid>
							<description>&lt;p&gt;Over the last weeks I became somehow frustrated with the HTML input type “url”. While going through registration forms, I often got the error message “Please enter a valid url” after filling in &lt;a href=&quot;http://www.justmarkup.com/&quot;&gt;www.justmarkup.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As a developer, I immediately looked at the source code and was not surprised to find that they used the required attribute in combination with type=”url”.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Url:&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-required&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;true&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;what%E2%80%99s-going-on-here&quot;&gt;What’s going on here &lt;a class=&quot;permalink&quot; href=&quot;#what%E2%80%99s-going-on-here&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As I was curious now, I opened the form with Opera (the browser with the most advanced HTML5 Forms Support) and found out that &lt;a href=&quot;http://www.justmarkup.com/&quot;&gt;www.justmarkup.com&lt;/a&gt; validates just fine. (Note: By checking the &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/#validitystate&quot;&gt;ValidityState&lt;/a&gt; via “element.validity.typeMismatch” it returns true in Opera as well.). Therefore I tried to find some tests about how browsers handle validation of input type=”url” in combination with required, and as I couldn’t find one I made some by myself, which can be found &lt;a href=&quot;http://jsbin.com/eveqor/3&quot;&gt;here.&lt;/a&gt;. All tested browsers won’t validate “url”, “&lt;a href=&quot;http://url.de/&quot;&gt;url.de&lt;/a&gt;” and “&lt;a href=&quot;http://www.url.de/&quot;&gt;www.url.de&lt;/a&gt;”, but all the other tested values, strangely also “url:”.&lt;/p&gt;
&lt;p&gt;I couldn’t find any reference in the w3 docs about when an url is defined as valid or invalid. If you found one, please let me know via &lt;a href=&quot;http://www.twitter.com/&quot;&gt;twitter&lt;/a&gt; as I would be highly interested if the browser manufacturer have integrated it the wrong way or if the spec may be misleading.&lt;/p&gt;
&lt;h3 id=&quot;let%E2%80%99s-fix-this&quot;&gt;Let’s fix this &lt;a class=&quot;permalink&quot; href=&quot;#let%E2%80%99s-fix-this&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Fortunately we can quite easily fix the wrong browser behaviour by adding a &lt;a href=&quot;http://dev.w3.org/html5/markup/input.url.html#form.data.pattern_xref4&quot;&gt;pattern attribute&lt;/a&gt;. I am sure there may be a better Regex, but mine is “^(https?://)?([a-zA-Z0-9]([a-zA-ZäöüÄÖÜ0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$”. The main part is from &lt;a href=&quot;http://html5pattern.com/&quot;&gt;html5pattern.com&lt;/a&gt;, I just added the (https?://)? part and support for “umlaute”. I made a &lt;a href=&quot;http://jsbin.com/eveqor/2&quot;&gt;test&lt;/a&gt; here and as you can see it validates all the values I want it to. If you have a better Regex please share it in the comments.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Url:&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-required&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;true&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;^(https?://)?([a-zA-Z0-9]([a-zA-ZäöüÄÖÜ0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;All in all it’s really annoying that we, as developers, have to fix, in my opinion “wrong” browser behaviour. Thankfully, it’s easy to change the behaviour and I really encourage everybody to add the pattern part to avoid frustration for your users.&lt;/p&gt;
&lt;h3 id=&quot;update-07-01-13&quot;&gt;Update 07-01-13 &lt;a class=&quot;permalink&quot; href=&quot;#update-07-01-13&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://www.twitter.com/rodneyrehm&quot;&gt;Rodney Rehm&lt;/a&gt; just commented a way better and safer &lt;a href=&quot;http://rodneyrehm.de/t/url-regex.html#imme_emosol&quot;&gt;regular expression&lt;/a&gt; than the one I used. Thanks.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Clean up – random thoughts</title>
							<link>https://justmarkup.com/log/2012/12/clean-up-random-thoughts/</link>
							<pubDate>2012-12-07T13:04:40+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/12/clean-up-random-thoughts/</guid>
							<description>&lt;p&gt;To be honest I never really liked my old design but at that time I just wanted to push it live, so I can start blogging and show something off. After several month of doing nothing I finally had the time to rebuild everything from scratch. This year I learned a lot about building websites, how to test, optimize and build for different devices. This site is not at all perfect and probably, like in my opinion every other page, will never be, but right now I am totally happy delivering it, as it is. If you have feedback, good or bad, I would be very pleased if you yould either &lt;a href=&quot;http://www.twitter.com/justmarkup&quot;&gt;Tweet me&lt;/a&gt; or write me an &lt;a href=&quot;mailto:hallo@justmarkup.com&quot;&gt;Email&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;webdesign&quot;&gt;Webdesign &lt;a class=&quot;permalink&quot; href=&quot;#webdesign&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This site uses a really elementary layout and no fancy JavaScript, it’s simple and clean. If you build such a site nowadays and don’t build it responsive, you may better look for another job, seriously. Don’t get me wrong, I know that it is really hard work to get a sophisticated site using a complex layouts and tons of JavaScript responsive, but for simple sites it has to be the standard way, no the only way. And as a side note, if an user zooms your site and the design breaks, your site is not responsive, or in other words, avoid fixed units, please try to avoid it.&lt;/p&gt;
&lt;h2 id=&quot;optimize&quot;&gt;Optimize &lt;a class=&quot;permalink&quot; href=&quot;#optimize&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On of the best giveaways of responsive design is that people more and more become aware of, that websites should not only look great, but which is in my opinion much more important, should be lightweight and accessible. So, when talking about optimization, the first thing everyone should do, is compressing all images. This is such an easy step, with tools like jpegoptim or tinypng, you can reduce the overall size, in most cases, dramatically. You may argue now, that everybody is aware of this, but it can’t be repeated too often until everybody really does it.&lt;/p&gt;
&lt;p&gt;An even easier step is to use a proper .htaccess. I mostly go with the one from the &lt;a href=&quot;https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess&quot;&gt;HTML5 Boilerplate&lt;/a&gt; and it works like a charm. With this simple steps in place, head over to &lt;a href=&quot;https://developers.google.com/speed/pagespeed/insights&quot;&gt;Google Pagespeed&lt;/a&gt;, if your score is above 90, well done, otherwise follow the advises until you are at this level.&lt;/p&gt;
&lt;h2 id=&quot;testing-is-fun%2C-fun%2C-fun&quot;&gt;Testing is fun, fun, fun &lt;a class=&quot;permalink&quot; href=&quot;#testing-is-fun%2C-fun%2C-fun&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I love testing, man I really love testing. Firing up a website on dozens of different browsers and platforms to see if your code actually works as expected, is fantastic. At the start of every project I usually define one device as “The old man standing”, a device which still has quite a big user base, but has lots of limitations according to CSS, Html and JavaScript and comes with quite a small screen (like 280 x 400 for example).&lt;/p&gt;
&lt;p&gt;I normally test my code concurrently while coding in “The old man standing”, Firefox with responsive View enabled, one average Android and iOS phone/tablet. By checking your site all the time on different platforms, while working on it, wrong decisions can be detected right away and therefore rebuild for the better. If you go the other way and test your site only at the end of the build process you most probably end up, with a lot of time consuming debugging, with a bunch of ugly bugfixes and all together with messier code, as if you would have by testing from the first day.&lt;/p&gt;
&lt;h2 id=&quot;performance-is-the-key&quot;&gt;Performance is the key &lt;a class=&quot;permalink&quot; href=&quot;#performance-is-the-key&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Tim Kadlec wrote exactly whats in my mind since month in his article &lt;a href=&quot;http://24ways.org/2012/responsive-responsive-design/&quot;&gt;Responsive Responsive Design&lt;/a&gt;. Your site may be the best looking site ever, but if it takes ages to load, it may also be the worst site ever. As already said above, optimization is in many ways really easy to achieve, and there is no excuse to load unoptimized content.&lt;/p&gt;
&lt;h2 id=&quot;random-thoughts-at-the-end&quot;&gt;Random thoughts at the end &lt;a class=&quot;permalink&quot; href=&quot;#random-thoughts-at-the-end&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;After one year reading, writing, learning about responsive Design I personally more and more get the feeling, that many people don’t get the idea of responsive Design. Every time I see a iphone.css I really have to force myself not flipping out and telling the developer really bad words. There are so many smart people telling us that we shouldn’t develop for devices but for content, that responsive design doesn’t work without optimization, and still there are so many “Webdevelopers”, which seems like, never heard of all this.&lt;/p&gt;
&lt;p&gt;I often get upset when seeing “crimes”, like the iphone.css and in the future I often shouted at them and telling them “Your are doing everything wrong!!!”, but I realized that this doesn’t help anybody. Therefore I have a new tactic now, every time I see a bad developed site, I simple write them an email, addressing my concerns, pointing out errors made and most important telling them how they can fix it. So the next time you shake your head after seeing some sourcecode, write them an email and say them what they did wrong and how this can be changed, thanks.&lt;/p&gt;
&lt;p&gt;Want to be the first hearing about new posts here, you may &lt;a href=&quot;http://www.twitter.com/justmarkup&quot;&gt;follow me&lt;/a&gt; or grab the &lt;a href=&quot;http://justmarkup.com/log/feed/&quot;&gt;Rss feed&lt;/a&gt;.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Testing your responsive site – using Ubuntu</title>
							<link>https://justmarkup.com/log/2012/08/rwd-testing/</link>
							<pubDate>2012-08-23T10:12:35+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/08/rwd-testing/</guid>
							<description>&lt;p&gt;This post is all about setting up and using tools and extensions, useful for testing your Responsive Design. I work with Ubuntu, so most of the instructions will be for Ubuntu, but I guess everyone else will get the idea.&lt;/p&gt;
&lt;h2 id=&quot;browsers&quot;&gt;Browsers &lt;a class=&quot;permalink&quot; href=&quot;#browsers&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;firefox&quot;&gt;Firefox &lt;a class=&quot;permalink&quot; href=&quot;#firefox&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The current Firefox Nightly comes with a fantastic tool for testing your Mediaqueries. They call it “Responsive Design View”, and you name it, it’s for testing a site on different screen resolutions. With this tool you can easily resize your site both vertically and horizontally or choose one of the redefined screen sizes to test the most common ones. Sooner or later this tool will be build in Firefox Stable, but until then you can download &lt;a href=&quot;http://nightly.mozilla.org/&quot;&gt;Firefox Nightly&lt;/a&gt;, which runs site by site with the stable Version.&lt;/p&gt;
&lt;p&gt;Furthermore you can install Firefox Fennec, downloadable &lt;a href=&quot;http://www.mozilla.org/projects/fennec/1.0a2/releasenotes/&quot;&gt;on mozilla.org&lt;/a&gt;. There you will find handy install instructions, to get it running within minutes. I don’t use Fennec that often anymore, as I use Firefox Nightly now for testing initial mockups, but it’s a great browser for testing “touch”, as there is, for example, no hover event.&lt;/p&gt;
&lt;h3 id=&quot;opera&quot;&gt;Opera &lt;a class=&quot;permalink&quot; href=&quot;#opera&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Opera offers Emulators for &lt;a href=&quot;http://www.omgubuntu.co.uk/2010/08/install-opera-mobile-in-ubuntu-deb&quot;&gt;Opera Mobile&lt;/a&gt; and &lt;a href=&quot;http://www.omgubuntu.co.uk/2010/07/how-to-run-opera-mini-in-ubuntu&quot;&gt;Opera Mini&lt;/a&gt;. Especially the Opera Mini Emulator is great, as the the browser is not only used by many feature phones user, but also has some JavaScript limitations you should be aware of.&lt;/p&gt;
&lt;p&gt;Opera not only has browsers for desktop and mobile, but also serves the needs for TV consumers – Opera TV. You can find more out about setting it up in this &lt;a href=&quot;http://dev.opera.com/articles/view/opera-tv-emulator-getting-started/&quot;&gt;post&lt;/a&gt;. I don’t use the emulator on a daily basis, but playing around with a web-based remote control is not just pure debugging fun, but more important, gives you a good feeling about another available input control.&lt;/p&gt;
&lt;h2 id=&quot;remote-web-inspector&quot;&gt;Remote Web Inspector &lt;a class=&quot;permalink&quot; href=&quot;#remote-web-inspector&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;weinre&quot;&gt;Weinre &lt;a class=&quot;permalink&quot; href=&quot;#weinre&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you are into mobile development you probably heard of &lt;a href=&quot;http://labs.adobe.com/technologies/shadow/&quot;&gt;Adobe Shadow&lt;/a&gt;. There is no Linux Version, but we can instead simply use &lt;a href=&quot;http://people.apache.org/~pmuellr/weinre/docs/latest/&quot;&gt;Weinre&lt;/a&gt;, the package, Adobe is using under his hat. You only need node.js running on your computer, the program itself can installed via the &lt;a href=&quot;http://people.apache.org/~pmuellr/weinre/docs/latest/Installing.html&quot;&gt;npm package manager&lt;/a&gt;. Once everything is done, you can remotely debug any webkit-based browser (Android, iOs, Blackberry …). It’s awesome – use it!&lt;/p&gt;
&lt;h3 id=&quot;firefox-mobile&quot;&gt;Firefox mobile &lt;a class=&quot;permalink&quot; href=&quot;#firefox-mobile&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Not long ago, Firefox implemented an &lt;a href=&quot;https://hacks.mozilla.org/2012/08/remote-debugging-on-firefox-for-android/&quot;&gt;easy way&lt;/a&gt; to debug Firefox Mobile remotely. Check out the &lt;a href=&quot;http://www.youtube.com/watch?feature=player_embedded&amp;amp;v=Znj_8IFeTVs&quot;&gt;Demo&lt;/a&gt; as well.&lt;/p&gt;
&lt;h3 id=&quot;chrome&quot;&gt;Chrome &lt;a class=&quot;permalink&quot; href=&quot;#chrome&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Directly with the start of Chrome for Mobile they added the possibility to debug remotely. The latest Android Version ships with Chrome as the default browser, so their will be a big crowd using it in the near future. It’s elementary to set it up &lt;a href=&quot;https://developers.google.com/chrome/mobile/docs/debugging&quot;&gt;with some simple steps&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;opera-mobile&quot;&gt;Opera Mobile &lt;a class=&quot;permalink&quot; href=&quot;#opera-mobile&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Last but not least is Opera. Remote debugging for Opera is already around since 2008, as far as I can see. Definitely another awesome option to test your responsive Design. You can find instructions about the set up &lt;a href=&quot;http://dev.opera.com/articles/view/remote-debugging-with-opera-dragonfly/&quot;&gt;in this post&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you can see, there are already fantastic tools lying around to debug your site remotely, as well as testing your responsive design on your desktop, and I am pretty sure there will be even more possibilities in the near future. I love testing, and with this tools in my hand it’s even more awesome. You can also see, that it’s not a big deal to set up most of the tools presented, and that there is something for almost every browser engine out there, although I don’t know about any tools to debug on windows mobile, anyone?&lt;/p&gt;
&lt;p&gt;If you know of any other tool, useful for testing a responsive site, please let me know in the comments.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Responsive Multi Level Navigation – let’s try.</title>
							<link>https://justmarkup.com/log/2012/06/responsive-multi-level-navigation/</link>
							<pubDate>2012-06-19T15:16:59+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/06/responsive-multi-level-navigation/</guid>
							<description>&lt;p&gt;Lots of fantastic people already put their hands on building a responsive navigation, and they came up with sweet ideas, like this &lt;a href=&quot;http://www.netmagazine.com/tutorials/build-smart-mobile-navigation-without-hacks&quot;&gt;Tutorial on .net&lt;/a&gt; by Aaron Gustafson.&lt;/p&gt;
&lt;p&gt;And there is also a neat overview about “all” &lt;a href=&quot;http://bradfrostweb.com/blog/web/responsive-nav-patterns/&quot;&gt;responsive navigation patterns&lt;/a&gt; by Brad Frost where he points out the cons and pros in a detailed way.&lt;/p&gt;
&lt;p&gt;However most of these patterns are not really applicably when dealing with “large” navigations or multi-level navigations and thus I tried to develop one which also doesn’t need JavaScript.&lt;/p&gt;
&lt;p&gt;If you are wondering, the navigation structure is the one used on a &lt;a href=&quot;http://www.zeit.de/&quot;&gt;german newspaper&lt;/a&gt;, as I wanted to test it with a real world example.&lt;/p&gt;
&lt;p&gt;Before finally diving into my example, I have to admit that I am still searching for a “perfect” solution, as each of the following has some drawbacks, you may see as a deal breaker in your project.&lt;/p&gt;
&lt;h3 id=&quot;the-%E2%80%9Ci-don%E2%80%99t-care%E2%80%9D-or-%E2%80%9Cdo-nothing%E2%80%9D-pattern&quot;&gt;The “I don’t care” or “Do nothing” pattern &lt;a class=&quot;permalink&quot; href=&quot;#the-%E2%80%9Ci-don%E2%80%99t-care%E2%80%9D-or-%E2%80%9Cdo-nothing%E2%80%9D-pattern&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s start with the simplest pattern you can imagine, which is in other words doing nothing. Surprisingly there are also some advantages, especially that it works in nearly every browser.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/lab/juma/nav/example1/&quot;&gt;Have a look at the demo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/lab/juma/nav/example1&quot;&gt;&lt;img src=&quot;https://justmarkup.com/lab/juma/nav/images/phone_example1.png&quot; alt=&quot;&quot; title=&quot;Screenshot of example 1 on an android 2.2 &quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&quot;advantages&quot;&gt;Advantages &lt;a class=&quot;permalink&quot; href=&quot;#advantages&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;The top level navigation is accessible with one click/tap for almost every browser&lt;/li&gt;
&lt;li&gt;It doesn’t depend on JavaScript&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;disadvantges&quot;&gt;Disadvantges &lt;a class=&quot;permalink&quot; href=&quot;#disadvantges&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Sub-Navigation is only accessible at once by non-touch devices, but as we show the current Sub-Navigation for all browsers, you can reach the sub navigation with two clicks on touch devices as well.&lt;/li&gt;
&lt;li&gt;Especially on small screens lots of space is “wasted”&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-%E2%80%9Cpriority%E2%80%9D-pattern&quot;&gt;The “Priority” pattern &lt;a class=&quot;permalink&quot; href=&quot;#the-%E2%80%9Cpriority%E2%80%9D-pattern&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Next I want to show you the “Priority” pattern, which tries to reduce the wasted space, but is nevertheless still not able to give “everybody” direct access to sub level elements.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/lab/juma/nav/example2/&quot;&gt;Have a look at the demo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/lab/juma/nav/example2&quot;&gt;&lt;img src=&quot;https://justmarkup.com/lab/juma/nav/images/phone_example2.png&quot; alt=&quot;&quot; title=&quot;Screenshot of example 2 on an android 2.2 &quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;These technique basically has the same advantages and disadvantages as the previous one, but comes with the great benefit not wasting that much space.&lt;/p&gt;
&lt;h3 id=&quot;the-%E2%80%9Cpriority-%2B%E2%80%9D-pattern&quot;&gt;The “Priority +” pattern &lt;a class=&quot;permalink&quot; href=&quot;#the-%E2%80%9Cpriority-%2B%E2%80%9D-pattern&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Going one step further I tried to improve the previous example by making the Sub-Navigation also available with one click/tap, but came to the conclusion that it’s not really possible by just using CSS. If you expand the top navigation to all elements and try to access the Sub-Navigation via [+] all the “less-prio” list-items will be hidden again. You may can avoid it by using some fake elements and the nth-child() selector but I didn’t really want to go that nasty.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/lab/juma/nav/example3/&quot;&gt;Have a look at the demo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://justmarkup.com/lab/juma/nav/example3&quot;&gt;&lt;img src=&quot;https://justmarkup.com/lab/juma/nav/images/phone_example3.png&quot; alt=&quot;&quot; title=&quot;Screenshot of example 3 on an android 2.2 &quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As already mentioned in the beginning I couldn’t really find the clever solution, but I personally would use the “Priority” pattern as it’s a clean way with great browser support, although you get to see the Sub-Navigation only after taping twice on touch devices. The “Priority +” pattern somehow solves the “double tap problem”, but is on the other hand irritating and not really user friendly.&lt;/p&gt;
&lt;p&gt;That said, I would in the end use some JavaScript to imitate the :hover Effect for touch devices, as it’s, as far as I can see, the only way to make that work in a clean way.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Should we really worry that much.</title>
							<link>https://justmarkup.com/log/2012/04/should-we-really-worry-that-much/</link>
							<pubDate>2012-04-05T11:58:42+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/04/should-we-really-worry-that-much/</guid>
							<description>&lt;p&gt;As soon as the new Ipad was released, many people started thinking about the best way to serve high-resolution images to it.&lt;/p&gt;
&lt;p&gt;Apple itself implemented this &lt;a href=&quot;http://blog.cloudfour.com/how-apple-com-will-serve-retina-images-to-new-ipads/&quot;&gt;technique&lt;/a&gt;, which has not been thought through, mainly because of the increased total size. When surfing &lt;a href=&quot;http://apple.com/&quot;&gt;apple.com&lt;/a&gt; with your shiny new Ipad you have to download 2.13MB instead of 502.90K, or in other words 4x the size. This may be fine if you are using WIFI or LTE (which is not usable at all in many countries), but not for people surfing on low bandwidth.&lt;/p&gt;
&lt;h3 id=&quot;speed-me-up&quot;&gt;Speed me up &lt;a class=&quot;permalink&quot; href=&quot;#speed-me-up&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;So is it really worth to worry about serving high-resolution images until we can reliable get the connections details. I definitely say no, just think about the following case.&lt;/p&gt;
&lt;p&gt;” Someone surfs &lt;a href=&quot;http://apple.com/&quot;&gt;apple.com&lt;/a&gt; with the new Ipad, but has to rely on EDGE. It will take up to 10 seconds just to download the images. I guess lots of people will already cancel way before the 10 seconds, and before even seeing a glimpse of your high-resolution images. ”&lt;/p&gt;
&lt;p&gt;And this will not just happen to 1% of your Ipad users, but probably for many, many more. While travelling through Germany, you see many people surfing on their Ipad, and if you count in the low bandwidth they are relying on, it gets clear why speed should be one of your highest priorities in all your web projects.&lt;/p&gt;
&lt;h3 id=&quot;is-there-a-solution&quot;&gt;Is there a solution &lt;a class=&quot;permalink&quot; href=&quot;#is-there-a-solution&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In my opinion Apple has failed in this case. What they did, can be compared to shipping a new “resolutinary” television screen, without thinking about that their will be no films available at this point, which can take advantage of the new screen. What I want to say is, they should have spend time in developing a bandwidth detection API way before the new Ipad was released.&lt;/p&gt;
&lt;p&gt;Let’s say they were clever and presented a reliable solution, integrated in mobile safari 6-8 month before the release. This would have been a huge effect. I am pretty sure, if the solution would have been acceptable and usable for developers and browser manufacturer, Google, Firefox, Opera and even Windows (the know they will ship tablets with windows 8 and a high resolution display later this year) would have implemented (or at least would do now) a bandwidth detection API in their browsers. At some point it would have been a de facto “standard”, so W3C would even have standardised the API.&lt;/p&gt;
&lt;p&gt;I don’t want to blame Apple, but it really annoys me, that we as developers now have to think about a way to serve high-resolution images to people surfing on low bandwidth, which is just not possible.&lt;/p&gt;
&lt;p&gt;So please &lt;a href=&quot;http://www.rachelandrew.co.uk/archives/2012/03/21/stop-solving-problems-you-dont-yet-have/&quot;&gt;stop solving problems you don’t yet have&lt;/a&gt; and enjoy easter.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Take this you mobile wannabe!</title>
							<link>https://justmarkup.com/log/2012/04/take-this-you-mobile-wannabe/</link>
							<pubDate>2012-04-02T13:55:45+02:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/04/take-this-you-mobile-wannabe/</guid>
							<description>&lt;p&gt;While we, as developers, think about best ways to serve images to different devices and resolutions or about how we can adapt the navigation to various screen sizes, many people get more and more annoyed by the mobile “experience” they have to deal with.&lt;/p&gt;
&lt;h3 id=&quot;an-uri-is-unique-and-everywhere-the-same%2C-isn%E2%80%99t-it%3F&quot;&gt;An URI is unique and everywhere the same, isn’t it? &lt;a class=&quot;permalink&quot; href=&quot;#an-uri-is-unique-and-everywhere-the-same%2C-isn%E2%80%99t-it%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Dear websites, every time you redirect me to your “mobile” site and just cut off the path of my URL, a kitten dies.&lt;/p&gt;
&lt;p&gt;— Thomas Fuchs (@thomasfuchs) &lt;a href=&quot;https://twitter.com/thomasfuchs/status/166361687027494912&quot;&gt;February 6, 2012&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thomas Fuchs puts it in a nutshell, it’s just a pain in the ass if you don’t serve the content the user wants to see. This users will think twice the next time before clicking your link and of course will never ever share your link. So, if you don’t have the requested content available on your mobile site, do yourself a favour and show the user your “normal” site instead.&lt;/p&gt;
&lt;h3 id=&quot;don%E2%80%99t-crop-your-cont%E2%80%A6&quot;&gt;Don’t crop your cont… &lt;a class=&quot;permalink&quot; href=&quot;#don%E2%80%99t-crop-your-cont%E2%80%A6&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Just because somebody is using a smaller device to view you site, it doesn’t mean they also want to see a stripped-down version of your content. Some days ago I saw a conversation on &lt;a href=&quot;http://www.reddit.com/r/web_design/comments/rhofp/i_prefer_desktop_layouts_on_my_mobile_device_not/&quot;&gt;reddit.com&lt;/a&gt; where somebody says, that he prefers desktop sites over “mobile” sites, because some of his favourite sites show a neutered version on his phone.&lt;/p&gt;
&lt;p&gt;Therefore, always keep in mind that there is no excuse to serve a stripped-down version, never ever. Never!&lt;/p&gt;
&lt;h3 id=&quot;in-your-app&quot;&gt;In your App &lt;a class=&quot;permalink&quot; href=&quot;#in-your-app&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Another really annoying practice is showing a Pop-up where the user gets invited to “Download the brand new and super shiny App NOW”. Providing native App’s is great and it’s also understandable that you want to promote it, but please choose another way. Many users, including me, just don’t have the nerve to close these Pop-up’s.&lt;/p&gt;
&lt;p&gt;Once again if you don’t have adapted your site for mobile, just serve us your “desktop” site. If you have good content, I may read it on a regular basis anyway and may also prefer to install your App someday, but I will never install an App just to get to see the content I want to see now.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Just because “everybody” is really exited about mobile, and Responsive Design seems to be the new Web 2.0, do yourself a favour and don’t act too hastily to get your site ready for mobile. A bad mobile site is much more bothersome than serving a “desktop” site to all devices.&lt;/p&gt;
&lt;p&gt;That said, I would never advise someone, not going responsive, but you can see at the examples above, how “easy” it is to loose potential users.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Why sharing a picture goes pear-shaped in many cases</title>
							<link>https://justmarkup.com/log/2012/03/why-sharing-a-picture-goes-pear-shaped-in-many-cases/</link>
							<pubDate>2012-03-07T10:10:48+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/03/why-sharing-a-picture-goes-pear-shaped-in-many-cases/</guid>
							<description>&lt;p&gt;As it happens a lot that you get a link from a friend saying “Look at this cute cat” and once you open the picture you actually get to see a “big pink dog”, I went on and tested some of the most visited news sites in Germany to see if it’s possible to share a specific image out of a gallery just by copying the URL from the address field.&lt;/p&gt;
&lt;p&gt;Here is what I came up with.&lt;/p&gt;
&lt;h3 id=&quot;spiegel.de&quot;&gt;&lt;a href=&quot;http://spiegel.de/&quot;&gt;spiegel.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#spiegel.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The link I tested on this site was &lt;a href=&quot;http://www.spiegel.de/fotostrecke/fotostrecke-79544-3.html&quot;&gt;this one&lt;/a&gt;. Sharing on non-mobile devices works well however once viewing this link on mobile you get &lt;a href=&quot;http://www.spiegel.de/fotostrecke/fotostrecke-79544.html#spRedirectedFrom=www&quot;&gt;this&lt;/a&gt;. #fail&lt;/p&gt;
&lt;h3 id=&quot;bild.de&quot;&gt;&lt;a href=&quot;http://bild.de/&quot;&gt;bild.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#bild.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I tried to share Image 4 in this &lt;a href=&quot;http://www.bild.de/schlagzeilen-des-tages/ateaserseite/der-tag-bei-bild/ateaserseite-15480098,tbid=20239438,cid=23017780.bild.html&quot;&gt;gallery&lt;/a&gt;. Impossible as you always get to see the first image. #fail&lt;/p&gt;
&lt;h3 id=&quot;welt.de&quot;&gt;&lt;a href=&quot;http://welt.de/&quot;&gt;welt.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#welt.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here I tried to share Image 6 from this &lt;a href=&quot;http://www.welt.de/politik/article13903167/Oeffentlichkeitsscheu-Russlands-neue-alte-First-Lady.html&quot;&gt;gallery&lt;/a&gt;. Nope, again no chance to share this specific image. #fail&lt;/p&gt;
&lt;h3 id=&quot;sueddeutsche.de&quot;&gt;&lt;a href=&quot;http://sueddeutsche.de/&quot;&gt;sueddeutsche.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#sueddeutsche.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;On this site I wanted to share this &lt;a href=&quot;http://www.sueddeutsche.de/leben/bilder-des-tages-momentaufnahmen-im-maerz-1.1297863-3&quot;&gt;image of a wale&lt;/a&gt;. And surprise, surprise this is the first image I can share between different devices. #good&lt;/p&gt;
&lt;h3 id=&quot;stern.de&quot;&gt;&lt;a href=&quot;http://stern.de/&quot;&gt;stern.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#stern.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Seems like we now have a run. Sharing this &lt;a href=&quot;http://www.stern.de/digital/cebit/cebit-eroeffnung-merkel-looking-at-things-1796092-578f337d0900c121.html&quot;&gt;picture&lt;/a&gt; works like a charm as well. #good&lt;/p&gt;
&lt;h3 id=&quot;focus.de&quot;&gt;&lt;a href=&quot;http://focus.de/&quot;&gt;focus.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#focus.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Oh look at the &lt;a href=&quot;http://www.focus.de/wissen/wissenschaft/artenschutz/bedrohte-tiere-groesster-feind-mensch_did_25875.html&quot;&gt;tiger on picture 4&lt;/a&gt;. What you actually see is not a tiger at all but some other animals. On my Android 2.3 device you even have to close 2 Pop-ups (asking if you want to install the App) before you get to the article, but no wonder still no tigers. #fail&lt;/p&gt;
&lt;h3 id=&quot;zeit.de&quot;&gt;&lt;a href=&quot;http://zeit.de/&quot;&gt;zeit.de&lt;/a&gt; &lt;a class=&quot;permalink&quot; href=&quot;#zeit.de&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here I tried to share &lt;a href=&quot;http://www.zeit.de/kultur/kunst/2012-03/fs-state-of-the-art-photography&quot;&gt;picture 13&lt;/a&gt;. Unfortunately this is not possible, as you always get to see the first picture, on mobile the same of course. #fail&lt;/p&gt;
&lt;h3 id=&quot;results-are-frustrating&quot;&gt;Results are frustrating &lt;a class=&quot;permalink&quot; href=&quot;#results-are-frustrating&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To sum it up, out of 7 tested sites only 2 provided me with a link to a specific image which I could share with whatever device I like. One (&lt;a href=&quot;http://spiegel.de/&quot;&gt;spiegel.de&lt;/a&gt;) is doing his job on desktop, but once you go mobile they fail completely. As a side note – &lt;a href=&quot;http://sueddeutsche.de/&quot;&gt;sueddeutsche.de&lt;/a&gt; was the only gallery where you could use your keyboard to navigate through the images, which is a terrible quota.&lt;/p&gt;
&lt;p&gt;I really don’t know why so many sites have problems changing the URL while clicking through there “fancy” JavaScript Gallery. It’s just some lines of JavaScript, to add a different hash to the URL for every image and on the other hand checking if a hash is present to show the image the user asked for. If you don’t like hashes in your url you can also use the HTML5 History API like this &lt;a href=&quot;https://github.com/balupton/History.js/&quot;&gt;cross-browser Solution&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;permalink&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I am really the only one who is pissed of, that fancy effects seems way more important than some of the basics? I absolutely hope not.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> What we can’t test</title>
							<link>https://justmarkup.com/log/2012/03/what-we-cant-test/</link>
							<pubDate>2012-03-02T16:53:22+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/03/what-we-cant-test/</guid>
							<description>&lt;p&gt;We all do our best to test our sites in lots of different browsers, screen resolutions and input/output devices. But to be honest we just can’t test everything.&lt;/p&gt;
&lt;h3 id=&quot;screen-resolution&quot;&gt;Screen resolution &lt;a class=&quot;permalink&quot; href=&quot;#screen-resolution&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Unless you have the opportunity and money to sit in front of a 42″ or even bigger screen you are not able to test your design on big screens. Scaling down your browser window is easy, but increasing it over your max. resolution available is just impossible.&lt;/p&gt;
&lt;h3 id=&quot;browsers&quot;&gt;Browsers &lt;a class=&quot;permalink&quot; href=&quot;#browsers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I really don’t know how many browsers exists and how many of them are actually used but I just checked some stats and there were over 100 different browser versions listed. And as this &lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/7/74/Timeline_of_web_browsers.svg&quot; title=&quot;Timeline of web browers&quot;&gt;svg on wikipedia&lt;/a&gt; shows there are actually a lot more, especially as I know at least of two (Chrome for Android and Dolphin Browser) not listed there.&lt;/p&gt;
&lt;p&gt;Who has ever tested his site in SeaMonkey (which is in some of my stats much more popular then IE6) or on &lt;a href=&quot;http://www.opera.com/business/tv/&quot;&gt;Opera TV&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;With the fast release circles nowadays and as &lt;a href=&quot;http://paulirish.com/2011/browser-market-pollution-iex-is-the-new-ie6/&quot;&gt;Paul Irish&lt;/a&gt; said growing numbers of Browser versions this task is simple impossible. Nobody can test in 100’s of different browsers/versions and continue to test all his sites with every new browser/version coming out.&lt;/p&gt;
&lt;h3 id=&quot;connection-speed&quot;&gt;Connection Speed &lt;a class=&quot;permalink&quot; href=&quot;#connection-speed&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I guess you all know that at the moment of writing this, there is no way to test the connection speed the user are running on. And even if there would be a test, the only way to make users happy is to serve your page as fast as possible, as &lt;a href=&quot;http://www.nytimes.com/2012/03/01/technology/impatient-web-users-flee-slow-loading-sites.html&quot;&gt;every millisecond is important.&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;external-influences&quot;&gt;External influences &lt;a class=&quot;permalink&quot; href=&quot;#external-influences&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Another thing you can’t test reliable is for example “light irradiation”. If you ever used your laptop while sitting outside in the sun you know what I mean. It gets really hard to read a website unless the contrast is very high. That’s just an example but many people will get pissed of, if they can’t read your great news, that’s why we always should design with high contrasts and big enough font sizes.&lt;/p&gt;
&lt;p&gt;Another example of external influence is, that we don’t know if the user is just sitting on his couch with lots of time or if he/she is just running to a meeting while trying to read the latest gossip. Once again we can’t test all this situations.&lt;/p&gt;
&lt;h3 id=&quot;and-many-more%E2%80%A6&quot;&gt;And many more… &lt;a class=&quot;permalink&quot; href=&quot;#and-many-more%E2%80%A6&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You know there are many other things we can’t really test like all the input/output devices, all the different Screenreaders and so on…&lt;/p&gt;
&lt;p&gt;That’s why we all should develop &lt;a href=&quot;http://futurefriend.ly/&quot;&gt;futurefriend.ly&lt;/a&gt;, so we don’t have to worry that much if Microsoft is going to release “mIE5” for Android tomorrow.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Don’t think in statistics – the future is already the past.</title>
							<link>https://justmarkup.com/log/2012/02/dont-think-in-statistics-the-future-is-already-the-past/</link>
							<pubDate>2012-02-21T11:40:40+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/02/dont-think-in-statistics-the-future-is-already-the-past/</guid>
							<description>&lt;p&gt;Let’s say you are thinking about a relaunch of your site. One of the first things you may do is checking your Analytics Data to get a feeling what Browser, OS, Screen resolutions, Plugins, … your users actually use.&lt;/p&gt;
&lt;p&gt;After finishing your evaluation you may define which browsers you have to support definitely and on the other hand which browsers you may just ignore as they only count for ~ 1% of your visits.&lt;/p&gt;
&lt;h3 id=&quot;don%E2%80%99t-trust-them&quot;&gt;Don’t trust them &lt;a class=&quot;permalink&quot; href=&quot;#don%E2%80%99t-trust-them&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let me explain why checking statistics is a good addition but not the ideal solution for your new project. First of all you can’t really trust your statistics, as the tracking may fail in some cases, you can’t really ensure tracking on all devices and you don’t get all data from users without JavaScript (unless you use &lt;a href=&quot;http://code.google.com/intl/de-DE/apis/analytics/docs/mobile/mobileWebsites.html&quot;&gt;server-side tracking&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Furthermore statistics only shows you the data from the time being, but you still don’t have no clue what the statistics will look like in one month, one year or the next day?. They may be already completely different at the time you are ready to relaunch your new site. This is also the point where you have to realise that statistic data are a great way to give you a feeling of what’s going on now, however they are not carved in stone, can change fast and often lies.&lt;/p&gt;
&lt;h3 id=&quot;prototyping-like-a-boss&quot;&gt;Prototyping like a BOSS &lt;a class=&quot;permalink&quot; href=&quot;#prototyping-like-a-boss&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;So after realising that statistics data are not reliable and should be just a small part of your browser evaluation, we have to rethink the concept. So lets bring in the terms “future-friendly” and “progressive enhancement” as these are not just buzz words, but the way you should start your new project.&lt;/p&gt;
&lt;p&gt;As the browser is (at least for me) now the new photoshop/fireworks, we should go even one step further and force ourself to build the first protoype of our webpage without using any CSS3, HTML5 and JavaScript.&lt;/p&gt;
&lt;p&gt;I know its hard to forget for a moment about all the fancy CSS3 and the cool HTML5/JavaScript Technics but this is, in my opinion, the perfect start to ensure that your page will be usable, readable and accessible in all browser/device combination you may not even imagine they (will) exist. Developing for the future by using technics from the past may sound weird, but thinking like the old old IE6 really helps to set up your first prototype.&lt;/p&gt;
&lt;p&gt;Don’t get me wrong, I love to use all the new technics and properties available, but you should never ever use them without a fallback solution, because there is nothing more annoying then a website not usable/readable or even completely broken in older browsers. And by starting with the “fallback” solution, as explained above, you will be absolutely sure the site works and even more important will work in whatever browser/device will come.&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Mobile isn’t mobile</title>
							<link>https://justmarkup.com/log/2012/02/mobile-isnt-mobile/</link>
							<pubDate>2012-02-13T21:38:40+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/02/mobile-isnt-mobile/</guid>
							<description>&lt;p&gt;Today on twitter the amazing Brad Frost wrote a great article, exactly speaking out what’s in my mind – &lt;a href=&quot;http://bradfrostweb.com/blog/news/native-vs-web-is-total-bullshit/&quot;&gt;“Native vs Web is total bullshit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That’s absolutely true, because you can’t compare apples and oranges.&lt;/p&gt;
&lt;h3 id=&quot;poles-apart&quot;&gt;Poles apart &lt;a class=&quot;permalink&quot; href=&quot;#poles-apart&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I surf the web with my mobile devices on a daily basis, often following some links from social networks or reading local/international news. What irritates me most, but unfortunately happens quite often is that news site offering some “fancy” iphone/ipad/whateverosordevice app but no mobile web experience at all. That makes me cry, because in my opinion their mobile strategy is just completely wrong. They spent lots of time and money to make an iphone app, just to find out a year later they have to build an ipad app, just to find out they need an android app, …. ending in an loop of building and rebuilding apps for whatever will come.&lt;/p&gt;
&lt;p&gt;I can’t find any argument why news sites think apps are the way to go for their business. They loose customers like me, who doesn’t want to install an app for every damn site out there, loose money in advertising by accepting the share for “in-app” advertising, loose money for every new device/os combination they want to support in the future. To conclude it every business focusing on content will have a huge benefit buy building mobile first responsive websites. And If they can afford it, I don’t care if they still build additional native apps, to enhance the experience for power user.&lt;/p&gt;
&lt;h3 id=&quot;play-with-me&quot;&gt;Play with me &lt;a class=&quot;permalink&quot; href=&quot;#play-with-me&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;On the other hand there are also many use cases were a native app is the way to go, just think about games. Of course you could build a game with html5 as well, but this way you have to deal with way to much difficulties like offline usage, cpu performanece… To be honest I don’t know much about developing games but I think it’s much easier to build an app as building it with html5 and dealing with all the device/os disparities. Point.&lt;/p&gt;
&lt;h3 id=&quot;think-future-friendly&quot;&gt;Think future friendly &lt;a class=&quot;permalink&quot; href=&quot;#think-future-friendly&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To sum it up, I have to say that it’s way to frustrating for me to surf on news site this days, just because they thought/think offering an app is the best mobile user experience they can afford. That’s also the reason why I often email to this sites complaining about and on the other hand demonstrating why they will love future friendly websites.&lt;/p&gt;
&lt;p&gt;Furthermore I don’t convict anyone building an native app, but if your main focus is publishing content, you shouldn’t do it unless you ensured your website looks great on every screen size / device you can imagine.&lt;/p&gt;
&lt;p&gt;What do you think?&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Let’s start with the basics.</title>
							<link>https://justmarkup.com/log/2012/02/lets-start-with-the-basics/</link>
							<pubDate>2012-02-08T13:08:56+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/02/lets-start-with-the-basics/</guid>
							<description>&lt;p&gt;At the moment the whole world (ok maybe only we frontend people) speaks about responsive design. If we divide the opinions we come up with three approaches.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;People who don’t care at all about responsive design and just continue coding like the years before.&lt;/li&gt;
&lt;li&gt;Frenetic elation – people trying to convince everybody to use it now.&lt;/li&gt;
&lt;li&gt;People who remark criticism about responsive design.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;ie-will-never-be-dead&quot;&gt;IE will never be dead &lt;a class=&quot;permalink&quot; href=&quot;#ie-will-never-be-dead&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Starring at your statistics with the hope old IE’s won’t appear anymore will not happen in the near future. Of course every frontend developer will have a giant party if the world of browsers would only consist of up to date browsers providing the same experience.&lt;/p&gt;
&lt;p&gt;Waking up from the dream we have to realise that there are not only different browsers, but also different screen sizes, people using all sort of input and output devices and so on.&lt;/p&gt;
&lt;h3 id=&quot;avoid-known-mistakes&quot;&gt;Avoid known mistakes &lt;a class=&quot;permalink&quot; href=&quot;#avoid-known-mistakes&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Lot of failures were made in the past, just think about the browser war in the 90’s were most developers either optimised for Internet Explorer or Netscape. Later on we tried to optimise for every single browser available, which was and is a pain in the ass, because it costs a lot of time, money and nerves until a page looks pixelperfect in every browser. This is just not acceptable, but more important, it’s also not to drop support for older browsers. Now, while you may think I am completely insane, saying that either option A nor option B is the way to go, let me talk about option C.&lt;/p&gt;
&lt;h3 id=&quot;start-with-the-basics&quot;&gt;Start with the basics &lt;a class=&quot;permalink&quot; href=&quot;#start-with-the-basics&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The key “feature” from option C is the solid basement. Starting with the basics of web design helps to avoid lots of problems in the next steps. The idea is to kickoff with a fundamental fluid layout, using no css3 or html5 fanciness. This will be our basic layout shown to older browsers and mobile phones. You may also define this as the fallback solution, but it’s a solid, fast, accessible (hope you haven’t forgot about this by the way) basement and can be viewed with nearly every device/browser combination available.&lt;/p&gt;
&lt;h3 id=&quot;climb-the-mountain&quot;&gt;Climb the mountain &lt;a class=&quot;permalink&quot; href=&quot;#climb-the-mountain&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Once ready with the basics, leave the base camp and move forward to “camp smartphone”. At this point we can start bringing in some lovely css3 styles. Adjust fonts, elements … for the actual screen size using media queries and after a fast look back in the base camp assuring everything is still fine down there we already reached the next step.&lt;/p&gt;
&lt;p&gt;Now in higher atmosphere some problems seems harder to solve, think about the pain with responsive images and videos, but as we trained a lot the years before, I am sure we will find a way to solve it, a &lt;a href=&quot;http://adaptive-images.com/&quot;&gt;good approach&lt;/a&gt; for responsive images is for example using JavaScript to find out the screen size, and then serve the right image, always providing some fallback if user has Javascript/Cookies disabled of course.&lt;/p&gt;
&lt;h3 id=&quot;enjoy-the-outlook&quot;&gt;Enjoy the outlook &lt;a class=&quot;permalink&quot; href=&quot;#enjoy-the-outlook&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Some camps later you will finally reach the peak. Take your time, celebrate the ascent of your private peak and always think about how easily the way back is, that at the very bottom is still a solid base waiting for you and you that can always climb the mountain again using another route if you are not really happy with your current way.&lt;/p&gt;
&lt;h3 id=&quot;let%E2%80%99s-discuss&quot;&gt;Let’s discuss &lt;a class=&quot;permalink&quot; href=&quot;#let%E2%80%99s-discuss&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After reading this you may wonder why I mentioned the list of different approaches at the beginning. As I said there are lots of people arguing against responsive design, many mentioning the fear of additional work and expense.&lt;/p&gt;
&lt;p&gt;But if we develop with fallback/mobile first this argument doesn’t longer has any effect, since it’s much more work to maintain css files for old browsers than just starting with one basic css file and adding shine for up to date browsers. This way it’s also a lot easier to adjust your css in the feature when even more css3 is availabe.&lt;/p&gt;
&lt;p&gt;Happy climbing!&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Loading… and how css can help</title>
							<link>https://justmarkup.com/log/2012/02/loading-and-how-css-can-help/</link>
							<pubDate>2012-02-05T15:27:05+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/02/loading-and-how-css-can-help/</guid>
							<description>&lt;p&gt;The simplest form of showing an animated Loading… has been around since the early days of Internet Explorer. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Marquee_element&quot;&gt;marquee element&lt;/a&gt; and his counterpart the even worse &lt;a href=&quot;http://en.wikipedia.org/wiki/Blink_element&quot;&gt;blink element&lt;/a&gt; has never been part of the w3c specifications because of their terrible usability and accessibility.&lt;/p&gt;
&lt;p&gt;Nevertheless at least the marquee still works in most browsers nowadays.&lt;/p&gt;
&lt;p&gt;Loading...&lt;/p&gt;
&lt;p&gt;Please have a look (don’t try it at home):&lt;/p&gt;
&lt;p&gt;Loading…&lt;/p&gt;
&lt;h3 id=&quot;loading%E2%80%A6-the-right-way%3F&quot;&gt;Loading… the right way? &lt;a class=&quot;permalink&quot; href=&quot;#loading%E2%80%A6-the-right-way%3F&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;After playing around a bit with css3 animations and pseudo elements here is my solution. Have a look at the &lt;a href=&quot;http://dabblet.com/gist/1712390&quot;&gt;dabblet&lt;/a&gt; if you wanna play around with it.&lt;/p&gt;
&lt;p&gt;Loading, please wait&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@keyframes&lt;/span&gt; load&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;0%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #ddd&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;50%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 80px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.8&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 70px&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #ddd&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@keyframes&lt;/span&gt; hideload&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;0%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fff&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token selector&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fff&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;#progress:before&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hideload 2400ms infinite alternate&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;token selector&quot;&gt;#progress:after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; absolute&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 4px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;	&lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; load 2400ms infinite alternate&lt;br&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You probably have seen much more fancy loading bars but I wanted a solution which is also compatible with older browsers and more accessible. If you remove the animations from the pseudo elements you will see how it looks like in older browsers and although not tested how screen readers will read it.&lt;/p&gt;
&lt;p&gt;Just the phrase “Loading, please wait”.&lt;/p&gt;
&lt;p&gt;To achieve that I used the simple trick to hide the text via the animation on :after immediately. This way all browsers with no support for animation simple see the phrase while browsers with support see the loading animation.&lt;/p&gt;
&lt;p&gt;What’s your solution?&lt;/p&gt;
</description>
						</item>
				
			
			
				
							
						
						
						<item>
							<title> Servus</title>
							<link>https://justmarkup.com/log/2012/01/servus/</link>
							<pubDate>2012-01-31T16:39:12+01:00</pubDate>
							<guid isPermaLink="false">https://justmarkup.com/log/2012/01/servus/</guid>
							<description>&lt;p&gt;Welcome to &lt;a href=&quot;http://justmarkup.com/&quot;&gt;justmarkup.com&lt;/a&gt;. Just my log.&lt;/p&gt;
</description>
						</item>
				
			
	</channel>
</rss>