<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Robert Haslinger on Medium]]></title>
        <description><![CDATA[Stories by Robert Haslinger on Medium]]></description>
        <link>https://medium.com/@robert.haslinger?source=rss-32ec524302aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eEr40t-Uou_jsroPIdi-Aw.jpeg</url>
            <title>Stories by Robert Haslinger on Medium</title>
            <link>https://medium.com/@robert.haslinger?source=rss-32ec524302aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:04:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@robert.haslinger/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Styling beyond Shadow Parts | CSS Constructable Stylesheets]]></title>
            <link>https://medium.com/@robert.haslinger/styling-beyond-shadow-parts-css-constructable-stylesheets-633b04347d3b?source=rss-32ec524302aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/633b04347d3b</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Robert Haslinger]]></dc:creator>
            <pubDate>Fri, 04 Nov 2022 12:24:43 GMT</pubDate>
            <atom:updated>2022-11-04T12:24:43.474Z</atom:updated>
            <content:encoded><![CDATA[<p>Encapsulation is great and provides better structure and readability.</p><p>This fact also applies to the DOM and with the addition of the <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM">Shadow DOM</a> and its <a href="https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot">ShadowRoot</a> interface, there are now efficient ways to extract the “inner logic” of a web component from the original DOM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TKOtV767rg1q9ntj" /><figcaption>Photo by <a href="https://unsplash.com/es/@rgaleriacom?utm_source=medium&amp;utm_medium=referral">Ricardo Gomez Angel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>UI Component libraries can make use of Web Components and the Shadow DOM in order to even further control the customization of their components.</p><h4>Shadow Parts</h4><p>Besides attributes and custom properties, there is also the possibility to define <a href="https://w3c.github.io/csswg-drafts/css-shadow-parts/#part">Shadow Parts</a> that can be targeted with the ::part()<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/::part">CSS pseudo element</a> to enable specific customization for the consumer.</p><h4>Limitations of Customization</h4><p>While most of the times, the defined parts of a component provide enough utility for customization, there are limitations.</p><p>I would like to take the <a href="https://ionicframework.com/docs/api/datetime">Ionic Datetime component</a> as an example, as I will also use this component later on in the article for a more practical demonstration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*SXg9yVvxlEckla_psK7mSA.png" /><figcaption>Ionic Datetime component from <a href="https://ionicframework.com/docs/api/datetime#basic-usage">their official documentation</a></figcaption></figure><p>This component is not only fancy looking, but will automatically handle additional logic like constraining dates, setting the correct localization and timezone on its own (the Ionic documentation is great).</p><p>While this is awesome and a real time saver, my enthusiasm quickly vanished after realizing that the datetime component exposes <strong>no </strong>Shadow Parts and only <strong>two </strong>Custom Properties for the background and and title color.</p><p>If an element in the Shadow DOM is not defined as a part, there is no proper way to access and therefore style this element from outside the component.</p><p>Or, at least there was none prior to <a href="https://wicg.github.io/construct-stylesheets/">Constructable Stylesheets</a>.</p><h4>What are Constructable Stylesheets</h4><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/CSSStyleSheet">CSSStyleSheet</a> interface provides an alternative to document.createElement(&#39;style&#39;) for creating and applying &lt;style&gt; elements.</p><p>This is especially useful when working with the Shadow DOM. There is a great <a href="https://web.dev/constructable-stylesheets/">article</a> about Constructable Stylesheets from Jason Miller on web.dev that explains this interface extensively.</p><p>I would highly encourage you to read his article for further explanation as I will continue with my datetime component example in the next section.</p><h3>Using Constructable Stylesheets to style shadow elements</h3><p>First, let us take a look at the elements that we want to style in the Shadow DOM of the Ionic Datetime component:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*_7YWERj_28grT0qmiTMeTg.png" /><figcaption>Shadow DOM of the Ionic Datetime component</figcaption></figure><p>It is clear to see, that neither calendar header, body nor time label are available as Shadow Parts. In order to style them independently, we can use Constructable Stylesheets:</p><h4>Step 1: Define CSS rules</h4><p>The defined rules must be declared as a string, since that is the only type that the API currently supports.</p><p>Here is an example of what this could look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*-VqlEFGwt1N78LTOV2SJOg.png" /><figcaption>CSS rules for the calendar header</figcaption></figure><h4>Step 2: Create a new Stylesheet</h4><p>After defining all CSS rules that should be included for this component, the next step would be to create a new CSSStyleSheet and insert the previously defined rules. You can read more about the insertRule method <a href="https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule">here</a>.</p><p>I usually extract this logic into a helper function to keep my code clean (and yes, I am using TypeScript):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*HUjZVUWiRhhFoR66UfSRbA.png" /><figcaption>Creating a new CSSStyleSheet</figcaption></figure><h4>Step 3: Obtain the ShadowRoot of the component</h4><p>Since we now have our StyleSheet ready, for the next step we need to grab the datetime component in order to access its ShadowRoot.</p><p>Since I am using Vue primarily, I am placing this code in the onMounted lifecycle callback. This is however not mandatory, you can execute the next steps in any function.</p><p>Just be sure to check whether the ShadowRoot was successfully retrieved:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*qxVvN7tcu5AcbOA9AMXq5Q.png" /><figcaption>Obtaining the ShadowRoot of the datetime component</figcaption></figure><h4>Step 4: Add the Stylesheet to the ShadowRoot</h4><p>This title is not 100% correct. In fact, we need to replace the current style sheets present in the ShadowRoot, because adoptedStyleSheets is a frozen array:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*Buk1BntFZMSXmwjo3AlYkA.png" /><figcaption>Apply the created StyleSheet</figcaption></figure><p>You can read more about adoptedStyleSheets <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets">here</a> and also in Jason’s article.</p><h4>The fully customized component</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*Z2APLwKTNh1b_B5qeBW7Qg.png" /><figcaption>Customized Ionic Datetime component</figcaption></figure><p>As you can see in the screenshot above, I was able to customize the components header, body and time label, even though they are not declared as Shadow Parts.</p><h4>Browser Compatibility &amp; Polyfill</h4><p>Unfortunately, as of today, not all browsers fully support the CSSStyleSheet Web API. In the image below, you can see that the constructor to create a new CSSStyleSheet is not available for Safari.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*v6vnIpo9ToauCts8pRapyA.png" /><figcaption>CSSStyleSheet constructor Browser Compatibility on <a href="https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/CSSStyleSheet#browser_compatibility">MDN</a></figcaption></figure><p>The constructor is essential to make this work.</p><p>It is not possible to retrieve an already existing stylesheet, adapt it and apply it to another element. You would run into an “Sharing constructable stylesheets in multiple documents is not allowed” error.</p><p><strong>Luckily</strong>, there is an open source <a href="https://github.com/calebdwilliams/construct-style-sheets">polyfill</a> available. The author claims that this polyfill supports the CSSStyleSheet Web API on all major browsers.</p><h4>Conclusion</h4><p>In my opinion, the addition of this Web API is great. I would suggest to use it with caution though.</p><p>It works perfectly for the use case that I described but I would still consider this a workaround (<em>one might even name this a hack</em>). Most of the times, web components provide <strong>as much</strong> customization utility as there <strong>should be</strong>, keep that in mind.</p><p>I would love to read your opinion about this topic, so be sure to leave a comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=633b04347d3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What tech terms really mean — Beginner Friendly]]></title>
            <link>https://medium.com/@robert.haslinger/what-tech-terms-really-mean-beginner-friendly-a9325919e9ef?source=rss-32ec524302aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9325919e9ef</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[humor]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[short]]></category>
            <dc:creator><![CDATA[Robert Haslinger]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 11:25:48 GMT</pubDate>
            <atom:updated>2022-10-29T11:25:48.922Z</atom:updated>
            <content:encoded><![CDATA[<h3>What tech terms really mean — Beginner Friendly</h3><p>Have you ever come across a friend of yours who describes themselves as <em>software developer</em> and everytime you talk to them, it feels like they are speaking a completely different language?</p><figure><img alt="A confused elderly woman wearing glasses and a beautiful sunhat" src="https://cdn-images-1.medium.com/max/1024/0*UYPWVZSk8Q7G783w" /><figcaption>Photo by <a href="https://unsplash.com/@alexharvey?utm_source=medium&amp;utm_medium=referral">RepentAnd SeekChristJesus</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If the answer is <em>yes</em>, this article is <strong>just right</strong> for you. If the answer is <em>no</em>, you should still continue to read! You will have to deal with one of <em>us </em>eventually.</p><p>If you really are familiar with the upcoming list of terms — forgive me, I am trying to be likeable here.</p><p>Enough said, this is <em>my </em>“best-of “ list of terms that you should know when talking to an engineer — sorted alphabetically, because c’mon this is my job.</p><ul><li><strong>Architecture: </strong>A recipe containing all the ingredients for a successful project. <em>You don’t want to take part in those meetings</em></li><li><strong>Backend: </strong>Here lives the magic that you can’t see and always take for granted, <em>a.k.a your TikTok algorithm</em></li><li><strong>Commit: </strong>A signature on the work you have just done. <em>Basically saying: “Hey, you can always blame me for this!”</em></li><li><strong>Design Principles: </strong>Blueprints to solve common problems. <em>Is there one for life?</em></li><li><strong>Environment Variables: </strong>Options that can be set to change the behavior of a program. <em>Typically frighten any junior</em></li><li><strong>Frontend: </strong>The part of an application that interacts with the user. <em>You are looking at one right now!</em></li><li><strong>Git: </strong>A system that allows for unlimited collaboration between team members. <em>Git is for developers as what the sun is for life — essential</em></li></ul><figure><img alt="Nature in all its beauty" src="https://cdn-images-1.medium.com/max/1024/0*o8Wf9fdpitC-4Ksf" /><figcaption>Photo by <a href="https://unsplash.com/@8moments?utm_source=medium&amp;utm_medium=referral">Simon Berger</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ul><li><strong>Hardcode: </strong>A part of a program that does not change since its values are embedded into the code. <em>Actually the easiest part in coding</em></li><li><strong>Infrastructure: </strong>All the puzzle pieces put together. <em>It’s not good if a sketch fits on a single piece of paper</em></li><li><strong>Jira: </strong>A project management tool commonly used in tech. <em>Can also track how long it takes you to finish simple tasks — Bad</em></li><li><strong>KISS: </strong>Don’t overthink, just “Keep it simple, stupid!”. <em>Not related to any hard-rock band at all</em></li><li><strong>Linter: </strong>Tools that highlight faulty or bad written code. <em>They will also highlight the misuse of your and you’re</em></li><li><strong>Metadata: </strong>Data that describes and gives additional information about other data. <em>Not your facebook profile picture</em></li><li><strong>Null: </strong>The value for describing something that does not have a value. <em>No, this is not the same as 0</em></li><li><strong>Open Source: </strong>Useful code made accessible for everyone, for free. <em>Kudos!</em></li></ul><figure><img alt="The real heroes" src="https://cdn-images-1.medium.com/max/1024/0*6P-74-LNL20pNrsY" /><figcaption>Photo by <a href="https://unsplash.com/@kutanural?utm_source=medium&amp;utm_medium=referral">Kutan Ural</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ul><li><strong>Pipeline: </strong>Automatically executes tedious tasks for you. <em>Great if you have one, not so great if you need to create one, absolutely not great if yours does not work</em></li><li><strong>Quality Assurance: </strong>Making sure the product works also in uncommon scenarios. <em>Well, mostly they don’t</em></li><li><strong>Regression: </strong>When something that has worked before, suddenly stops working. <em>Cut one head, two grow back</em></li><li><strong>Shell: </strong>The black box that pops up every now and then in the middle of your screen. You can type there also! <em>No, not the gas station</em></li><li><strong>Testing: </strong>Writing code that automatically tests your written code. Y<em>ou can’t trust anyone, not even yourself</em></li><li><strong>UI/UX Designer: </strong>Responsible for letting you feel great while using their product. <em>Once again clicked “Allow all cookies”? Blame them</em></li></ul><figure><img alt="A delicious cookie" src="https://cdn-images-1.medium.com/max/1024/0*7dUMn6eDZRq9sn2j" /><figcaption>Photo by <a href="https://unsplash.com/@dexezekiel?utm_source=medium&amp;utm_medium=referral">Dex Ezekiel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ul><li><strong>Vue: </strong>A tool used to create beautiful frontends. <em>You know this word already</em></li><li><strong>Workaround: </strong>Solving a problem by using an alternative approach. <em>Like a traffic diversion, only more permanent</em></li><li><strong>XML: </strong>Text based format used to structure pieces of information. <em>Not really one of my favourites, but I can’t stop now, can I?</em></li><li><strong>You aren’t gonna need it: </strong>A principle, essentially meaning to only do something when it is needed. <em>Perfectionists hate this one</em></li><li><strong>Zero Trust: </strong>Always assume the worst for your program to make it more secure. <em>Easier for pessimists</em></li></ul><p>That’s it already! If you got this far, you are <em>almost </em>perfectly prepared for another tech conversation. Make sure to stick around, as this was only the tip of the iceberg.</p><figure><img alt="There is always more than what you can see at a first glance" src="https://cdn-images-1.medium.com/max/1024/0*XdXD5M99e-6wQc7y" /><figcaption>Photo by <a href="https://unsplash.com/@simonppt?utm_source=medium&amp;utm_medium=referral">SIMON LEE</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9325919e9ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>