Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 6040

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 60k
Author
Asked: November 27, 20242024-11-27T02:50:09+00:00 2024-11-27T02:50:09+00:00

Wait, Pause: Web Components

  • 60k

Some Background:

I’ve been working with web components a lot the past year. Mostly meeting and talking about specs, new components, best practices with a bunch of developers at work. I had a feeling that the concept seemed really familiar to me, but it was hard to put something to it, until I was asked a random question from a friend: Which is your favorite power ranger series?

I was a little taken back at this question because there was no related context in the convo we were having. But it was almost like that question was a key that unlocked this mystical box from my childhood and then it all started flooding back to me. We talked for an hour or more about the different series, what we remember and then something else hit me.

One of my big tech passion projects I help contribute to is HAX, the Headless Authoring eXperience made out of web components. Everyone makes the comparison that Web Components are like legos. While I do agree, I think we can do one better. Web Components are Super Sentai. The end. Thanks for coming to my TED Talk.

Wait, pause. What is a “Super Sentai”?

Super Sentai is a superhero genre or metaseries that come from the combination of 2 words:

Super (/ ˈsü-pər /):

  1. High Grade or quality or
  2. large or powerful

Sentai(戦隊): Japanese for squadron, taskforce

The term might not be familiar to you, but you have seen its shows. Power Rangers or Sailor Moon ring a bell? Well for this imma stick with Power Ranger examples, but the ideas can also translate to Sailor Moon as well.

The reason why I dont like the lego comparison is because you can't do anything with a single lego brick, you need a bunch of them. A single Power Ranger is bad-ass and can handle their own.

Like a web component, there are key aspects that help define what a Power Ranger is.

HTML Template and Custom Elements:

These two are intertwined, so I'll talk about them in the same section. allows us to store some markup and styling of the component, that we can later clone, reuse, etc. You gotta use slots to make a placeholder since elements render in the shadow root. This would be akin to morphers and the morphing grid. Do power Rangers just walk down the street and buy groceries (when we were allowed to do that)? No. They are people who morph into rangers when the time occurs. But what good is a morpher if you don't have a power ranger who can use it. That’s where Custom Elements come in.

We can make a power rangers class and use a connectedCallback to connect it to our shadow to the template and figure out how we define our behaviors. This is where we get into custom elements. Each Power Ranger has behaviors, Attributes and functions specific to that ranger. We can make a custom element and give the ranger whatever color, weapon, and zord we want to assign. Think back to when Tommy Oliver lost his Green Ranger Powers. Zordon and Alpha used the Power Ranges template and created a new Custom Element (New Ranger) with unique properties specifically to it. This is how we got the White Ranger! Our element comes with Saba, The White Tiger Zord, and the White Tiger MegaZord

Just like Rangers needing a morpher and the morphing grid, we need HTML Templates (and slots) to make our Custom Elements.

The Shadow DOM:

Each element is encapsulated and rendered separately from the main DOM. This way you can keep features and styling of each element independent of each other and the other parts of the DOM. This is like the power ranger theme or color. There are only one of each color ranger in a team. (No Time Force did not have 2 red rangers. One was the Red Ranger, the other was the Quantum Ranger… and Ninja Storm had the Red and Crimson Ranger. Totally different).

As you can see, the <red-ranger> and <crimson-rangers> are similar, but independent of each other, all thanks to the Shadow DOM.

Thanks to all the parts of the spec: HTML Template, Custom Elements, and Shadow DOM we get our own badass <power-ranger>!

IT'S GIT INIT TIME

But the cool thing about web components is when you combine them!!

Like every Super Sentai series, the support and skills of the group are what defeats the villain at the end of the episode. Web Components are better when they work together. Hey sometimes power rangers from different series make guest appearances to help each other out.

I hope after this you see why I believe Web Components and Power Rangers are a much better comparison.

Go Forth and Build. Stay Spicy and Keep Moving

  • @tom_var

frontendnewbiewebcomponentswebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 1k
  • Popular
  • Answers
  • Author

    How to ensure that all the routes on my Symfony ...

    • 0 Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.