Skip to content

Commit f9a0364

Browse files
committed
fix retext lint errors
1 parent 1c37b50 commit f9a0364

13 files changed

+104
-104
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Contributions are always welcome! Before contributing, please read the
99
- If you're looking for issues to resolve, a good place to start is the
1010
[help wanted label](https://github.com/WebComponentsGuide/webcomponents.guide/labels/help%20wanted) and/or
1111
[good first issue label](https://github.com/WebComponentsGuide/webcomponents.guide/labels/good%20first%20issue).
12-
- If you have to contribute to bigger pieces, like an idea or new section, tutorial, or blog post, then please raise an
12+
- If you're contributing to larger pieces, like an idea or new section, tutorial, or blog post, then please raise an
1313
issue first! This way we can discuss an action plan and figure out a high level overview of what we should write.
1414

1515
### Setup
@@ -28,5 +28,5 @@ automatically rebuild, and you can see the changes reflected in your browser.
2828

2929
### Running checks/tests
3030

31-
When making contributions, please make sure to run `npm run check`, to ensure your contributions are correctly formatted
32-
and spelled. You can also run `npm run format` to automatically format all files.
31+
When making contributions, please make sure to run `npm run check`, to make sure your contributions are correctly
32+
formatted and spelled. You can also run `npm run format` to automatically format all files.

blog/2023-01-09-introducing-webcomponents-guide.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ excerpt: >
77
Hello, world! Announcing the launch of a new way to learn how to create Web Components.
88
---
99

10-
The Web is a special place. It's a giant ecosystem that organically grows day by day. Rather than being designed behind
10+
The Web is an amazing place. It's a giant ecosystem that organically grows day by day. Rather than being designed behind
1111
closed doors by a single corporation, the web is designed in the open by developers who _use_ the platform. It's one of
12-
the very few areas in which we see many competing corporations work together to ensure a productive, interoperable set
12+
the very few areas in which we see many competing corporations work together to create a productive, interoperable set
1313
of APIs that millions of other companies can leverage. No other platform comes close.
1414

1515
When I first picked up Microsoft Front Page '98 and started trying to build my own site, I was immediately hooked. Over
@@ -21,13 +21,13 @@ HTML 5 and thinking "wouldn't it be great to define our own tags?". Luckily I wa
2121
decade of innovation on the web saw exactly that. Today Web Components allow engineers to define their own tags with
2222
unique functionality.
2323

24-
Web Components started out as a collection of specs from Google. The initial release of the "Custom Elements API" in
25-
2014 (referred to as "Custom Elements V0"). It predated modern JavaScript idioms like ES6 Classes. Google Chrome was the
26-
only browser to ship the V0 spec, despite many experiments like Mozilla's [x-tag][x-tag] and Google's
27-
[polymer][polymer]. By 2016 browser vendors agreed on and shipped a new specification (Custom Elements V1). This new
28-
spec coincided with powerful new technologies such as ShadowDOM and HTML Templates. Luckily today this is a footnote in
29-
the history of the web platform and Web Components. Web Components a proven set of technologies used by companies the
30-
world over. There is one sticking point remaining though.
24+
Web Components started out as a collection of specs from Google. The first release of the "Custom Elements API" in 2014
25+
(referred to as "Custom Elements V0"). It predated modern JavaScript idioms like ES6 Classes. Google Chrome was the only
26+
browser to ship the V0 spec, despite many experiments like Mozilla's [x-tag][x-tag] and Google's [polymer][polymer]. By
27+
2016 browser vendors agreed on and shipped a new specification (Custom Elements V1). This new spec coincided with
28+
powerful new technologies such as ShadowDOM and HTML Templates. Luckily today this is a footnote in the history of the
29+
web platform and Web Components. Web Components a proven set of technologies used by companies the world over. One
30+
sticking point remaining though.
3131

3232
One of the best things about the web is the sheer number of learning materials available. Corporations like Mozilla,
3333
Google and Microsoft collaborate on excellent resources like [MDN][mdn], or [web.dev][web-dev]. There exists an army of
@@ -38,7 +38,7 @@ As great as these learning resources are, they cast a wide net. When speaking to
3838
Components, one question I am often asked is "how can I find out more?". "The documentation is all there", I say, "just
3939
look it up on MDN". While MDN provides a great reference, it doesn't give you _the journey_. It can't give you _the
4040
journey_, because it's job is to be a reference. [MDN still documents Custom Elements V0 APIs][mdn-ce-v0]. Despite the
41-
various sign posts telling you not to use this, it remains, because MDN's job is to be a reference.
41+
various sign posts telling you not to use this, it's still documented, because MDN's job is to be a reference.
4242

4343
_The journey_ is a hallmark of every great framework. The plethora of front-end frameworks today have _the journey_.
4444
From [Lit][lit] to [Vue][vue] to [Svelte][svelte] to [React][react] to [Remix][remix], every one starts out with the
@@ -65,7 +65,7 @@ The content we have is divided into three sections for now:
6565

6666
- **[Learn][learn]**: This will take you through _the journey_. Learn the basic building blocks and learn how to connect
6767
them to make useful user experiences.
68-
- **[Tutorials][tutorials]**: This section will give you more substantial end-to-end guides on how to build one specific
68+
- **[Tutorials][tutorials]**: This section will give you larger end-to-end guides on how to build one specific
6969
component, end to end. Each tutorial might not cover all topics. They will cover extended platform features or
7070
third-party libraries. They might make design decisions that aren't applicable to all web components. But we hope some
7171
will be exactly the kind of technique you're looking for. We hope this is an area where you can learn how experienced

learn/components/autonomous-vs-customized-elements.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ order: 2
55

66
In the [previous section][defining-a-component] we learned about _Autonomous Custom Elements_ vs _Customized Built-in
77
Elements_. The most popular way to make elements is to use the _Autonomous Custom Element_ style, by making up your own
8-
tag and extending `HTMLElement`. However, each style comes with different trade-offs.
8+
tag and extending `HTMLElement`. Each style comes with different trade-offs.
99

1010
Choosing a type of component to build will depend on a lot of factors. _Autonomous Custom Elements_ give you a blank
1111
canvas to work with. _Customized Built-ins_ **extend** the element you're customizing. Here are some considerations to
@@ -24,13 +24,13 @@ also means existing code that queries for `button` elements will also find your
2424
`.querySelectorAll('button')` will find all button elements, including ones which are _Customized Built-in elements_.
2525
The way to find _non-Customized Built-ins_ is to use a selector like: `.querySelectorAll('button:not([is])')`.
2626

27-
This difference in tag name also effects how you'll select for these elements in CSS. There are additional CSS
27+
This difference in tag name also effects how you'll select for these elements in CSS. It also has some additional CSS
2828
considerations...
2929

3030
### CSS & Styling
3131

3232
Given _Autonomous Custom Elements_ have their own tag, they are unlikely to conflict with existing CSS. They can have
33-
_classes_ added to them, and so can be styled by existing CSS but it is opt-in.
33+
_classes_ added to them, and so can be styled by existing CSS but it's opt-in.
3434

3535
As _Customized Built-ins_ keep their tags (e.g. `<button is="fancy-button">`) any CSS that has rules like `button {}`
3636
will apply. This means if you have some existing CSS that applies to _built-ins_, it'll also apply to the _Customized
@@ -41,7 +41,7 @@ All _built-ins_ have some _user-agent CSS_ supplied already, for example `div` e
4141
styles, so `<button is="fancy-button">` will look the same as `<button>` until you customize it further.
4242

4343
If you want to customize a _built-in_ by applying only new styles and not adding any new logic, it might be best to use
44-
a CSS class instead. The main benefit of _Customized Built-ins_ is to extend or add new logic.
44+
a CSS class instead. _Customized Built-ins_ are best used when extending or adding new logic.
4545

4646
If you create an _Autonomous Custom Element_ (e.g. `<fancy-button>`) you'll need to style it from scratch as _Autonomous
4747
Custom Elements_ have no default CSS. You will probably want to add some CSS to these elements - even if it's just
@@ -68,7 +68,7 @@ want to customize a _built-in_. Here's a list of _built-ins_ that you can custom
6868
- `<section>`
6969
- `<span>`
7070

71-
_ShadowDOM_ can be really useful for providing encapsulated markup and styles. Styles within _ShadowDOM_ don't effect
71+
_ShadowDOM_ can be really useful for providing encapsulated markup and styles. Styles within _ShadowDOM_ don't affect
7272
the rest of the page, and so it can be a really useful place to add styles to your elements. If this is a high priority,
7373
you might find using an _Autonomous Custom Element_ to be a better choice than the limited set of built-ins which can
7474
use _ShadowDOM_.
@@ -105,23 +105,23 @@ These all extend from `HTMLElement` themselves so you'll still get everything `H
105105

106106
Extending from `HTMLButtonElement`, for example, means your class will inherit the button's properties, like `.type`,
107107
`.disabled`, `.forms`, `.name`, `.value`, and so on. On one hand this would be a lot of code to replicate yourself with
108-
an _Autonomous Custom Element_, but on the other hand your element adopting all of these might not be desirable.
108+
an _Autonomous Custom Element_, but your element adopting all these might not be desirable.
109109

110-
When extending from a _Customized Built-in_, overriding the already existing methods and properties can have undesirable
110+
When extending from a _Customized Built-in_ overriding the existing methods and properties can have undesirable
111111
consequences. It might be tempting to add new `.type` values to `<button>` for example, but in doing so you might run
112112
into issues with code that isn't expecting to see the newly added logic.
113113

114114
### Accessibility
115115

116116
_Customized Built-ins_ have very good accessibility information built right into them. Most have an _implicit role_
117-
which means that assistive technologies know how to interpret them. For example using a _screen reader_, it is possible
118-
to navigate through all of the headings in a web page, and the purpose of form controls is explained as each one is
119-
focused (e.g. buttons are announced not only by their label but also referred to as "buttons").
120-
121-
_Autonomous Custom Elements_, on the other hand, do not have any accessibility information built into them. Assistive
122-
technologies such as _screen readers_ will read the contents of the element as if it were plain text; treating it the
123-
same as a `<div>` or `<span>`. It's possible to customize how assistive technology like _screen readers_ handle your
124-
element by using the [Accessible Rich Internet Applications (or ARIA)][aria] APIs, such as the `role=` attribute.
117+
which means that assistive technologies know how to interpret them. For example using a _screen reader_, it's possible
118+
to navigate through all the headings in a web page, and the purpose of form controls is explained as each one is focused
119+
(e.g. buttons are announced not only by their label but also referred to as "buttons").
120+
121+
_Autonomous Custom Elements_, do not have any accessibility information built into them. Assistive technologies such as
122+
_screen readers_ will read the contents of the element as if it were plain text; treating it the same as a `<div>` or
123+
`<span>`. It's possible to customize how assistive technology like _screen readers_ handle your element by using the
124+
[Accessible Rich Internet Applications (or ARIA)][aria] APIs, such as the `role=` attribute.
125125

126126
Accessibility can be hard to get right. Many assistive tools behave differently, and much like browsers, support is not
127127
universal and consistent. It's always worth getting comfortable with these tools, and testing your web applications

learn/components/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ order: 1
44
---
55

66
Most components you write will need some kind of JavaScript. While it's not **strictly** necessary, more often than not
7-
you'll want to add JavaScript to provide logic. To do this you'll need to create a JavaScript `class`, and use the
8-
_Custom Elements Registry_ to attach your class so the browser knows to use it.
7+
you'll want to add JavaScript to drive logic. To do this you'll need to create a JavaScript `class`, and use the _Custom
8+
Elements Registry_ to attach your class so the browser knows to use it.
99

1010
Without the _Custom Element Registry_ the browser won't know what JavaScript to associate to what elements. By default,
1111
whenever the browser encounters a tag it does not know, it will use the `HTMLUnknownElement` class to give it a default
@@ -14,8 +14,8 @@ With your own class _defined_, any time the browser sees the defined tag, it wil
1414
class_.
1515

1616
To define a _Custom Element_, you can use the global `customElements` API. You won't need to include any JavaScript
17-
libraries to use `customElements`, it's a global that already exists, like `console` or `localStorage`. There are two
18-
types of elements you can define:
17+
libraries to use `customElements`, it's a global that already exists, like `console` or `localStorage`. You can define
18+
two types of element:
1919

2020
## Autonomous Custom Elements
2121

learn/components/initializing-your-component.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ order: 5
44
---
55

66
Components can have many things that make them useful, for example styles, templates, or other information. Some
7-
components might keep a memory of things - often called _state_. All of these things need to be initialized using
8-
different techniques. You will likely use a combination of these techniques when building a component.
7+
components might keep a memory of things - often called _state_. All these things need to be initialized using different
8+
techniques. You will likely use a combination of these techniques when building a component.
99

1010
It can be very useful to create things during _instantiation_, that is when the component is first created. Most likely
1111
any _state_ will want to be instantiated with each new component instance created. This can be accomplished with _class
@@ -40,7 +40,7 @@ a _lifecycle callback_...
4040
### Adding logic when an element is inserted into the DOM
4141

4242
Perhaps more valuable than knowing when an element is created, is to know when it gets _inserted_ into the DOM. At this
43-
point an element can look at its _parent elements_ to know where it is in the tree, and can do useful logic like adding
43+
point an element can look at its _parent elements_ to know where it's in the tree, and can do useful logic like adding
4444
_event listeners_, and start rendering or animating.
4545

4646
If a _custom element_ has a `connectedCallback()` function, then the browser will automatically call this whenever the

learn/components/lifecycle-reference.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,26 @@ class MyElement extends HTMLElement {
119119
}
120120
```
121121

122-
When a document is parsed all of the attributes which are observed will result in a call to
123-
`attributeChangedCallback()`. This can happen _before_ the element is connected and `connectedCallback` has been called,
124-
so avoid relying on the element being connected during this time.
122+
When a document is parsed all the attributes which are observed will result in a call to `attributeChangedCallback()`.
123+
This can happen _before_ the element is connected and `connectedCallback` has been called, so avoid relying on the
124+
element being connected during this time.
125125

126-
The `attributeChangedCallback()` will fire whenever `setAttribute`, `removeAttribute`, `toggleAttribute` are called if
127-
they are changing an observed attribute.
126+
The `attributeChangedCallback()` will be called whenever `setAttribute`, `removeAttribute`, `toggleAttribute` are called
127+
if they are changing an observed attribute.
128128

129129
Attributes are also nodes that can be constructed with [`document.createAttribute()`][createattribute], which returns an
130130
`Attr` object. This `Attr` object can then be applied to the element via `.setAttributeNode()`. This will also result in
131131
the `attributeChangedCallback()` being called if it's an observed attribute. An `Attr` object also has a `.value`
132132
property; changing that will _also_ call `attributeChangedCallback()`.
133133

134134
It's worth noting that even if the _new_ value is the same as the _old_ value, calling `setAttribute` or changing the
135-
`.value` on an `Attr` will result in the `attributeChangedCallback()` being called. In other words, it is possible for
135+
`.value` on an `Attr` will result in the `attributeChangedCallback()` being called. In other words, it's possible for
136136
`attributeChangedCallback` to be called when `oldValue === newValue`. In most cases this really won't matter much, and
137137
in some cases this is very helpful; but sometimes this can bite, especially if you have
138138
[non-idempotent](https://en.wikipedia.org/wiki/Idempotence#Computer_science_examples) code inside your
139139
`attributeChangedCallback`. Try to make sure operations inside `attributeChangedCallback` are idempotent, or perhaps
140-
consider adding a check to ensure `oldValue !== newValue` before performing operations which may be sensitive to this.
140+
consider adding a check to make sure `oldValue !== newValue` before performing operations which may be sensitive to
141+
this.
141142

142143
## `adoptedCallback()`
143144

0 commit comments

Comments
 (0)