Skip to content

Commit 114e615

Browse files
authored
Update web-component.md (#27)
1 parent cbf15d4 commit 114e615

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

docs/documentation/capabilities/web-component.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class CounterApp extends WebComponent<Props, State> {
6767
customElements.define('counter-app', CounterApp)
6868
```
6969

70-
In your HTML you can simply use the tag normally.
70+
In your HTML, you can simply use the tag normally.
7171

7272
```html
73-
<counter-app label="count up"></counter-app>m
73+
<counter-app label="count up"></counter-app>
7474
```
7575

7676
### Installation
@@ -115,7 +115,7 @@ customElements.define('my-button', MyButton)
115115

116116
### Config
117117

118-
You can configure very few basic stuff about your component that will determine how your component will be rendered.
118+
You can configure very few basic things about your component that will determine how your component will be rendered.
119119

120120
#### ShadowRoot
121121

@@ -135,7 +135,7 @@ customElements.define('my-button', MyButton)
135135

136136
#### ShadowRoot options
137137

138-
You can specific any [attachShadow options](https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow#options) in the config object and they are all optional. The default matches their native default values.
138+
You can specify any [attachShadow options](https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow#options) in the config object, and they are all optional. The default matches their native default values.
139139

140140
```javascript
141141
class MyButton extends WebComponent {
@@ -174,7 +174,7 @@ class MyButton extends WebComponent {
174174
customElements.define('my-button', MyButton)
175175
```
176176

177-
In the render method you can return anything: a string, a [DOM Node](https://developer.mozilla.org/en-US/docs/Web/API/Node), a [Markup template](../templating/index.md), a `null` value, or nothing at all. Some components can just handle some internal logic and dont need to render anything but their tags.
177+
In the render method, you can return anything: a string, a [DOM Node](https://developer.mozilla.org/en-US/docs/Web/API/Node), a [Markup template](../templating/index.md), a `null` value, or nothing at all. Some components can just handle some internal logic and don't need to render anything but their tags.
178178

179179
### Stylesheet
180180

@@ -191,7 +191,7 @@ class MyButton extends WebComponent {
191191
customElements.define('my-button', MyButton)
192192
```
193193

194-
Where the style is added will depend on whether the shadow option is true or false. If the component has shadow style will be added to its own [content root](./web-component.md#content-root). Otherwise, style will be added to the closest root node the component was rendered in. It can be the document itself or [root](./web-component.md#root) of an ancestor web component.
194+
Where the style is added will depend on whether the shadow option is true or false. If the component has a shadow style, it will be added to its own [content root](./web-component.md#content-root). Otherwise, style will be added to the closest root node in which the component was rendered. It can be the document itself or [root](./web-component.md#root) of an ancestor web component.
195195

196196
#### css
197197

@@ -212,7 +212,7 @@ class MyButton extends WebComponent {
212212
customElements.define('my-button', MyButton)
213213
```
214214

215-
It helps your IDE give you better CSS syntax highlight and autocompletion but it does not perform any computation to your CSS at this point.
215+
It helps your IDE give you better CSS syntax highlighting and autocompletion, but it does not perform any computation on your CSS at this point.
216216

217217
#### updateStylesheet
218218

@@ -230,7 +230,7 @@ class MyButton extends WebComponent {
230230
customElements.define('my-button', MyButton)
231231
```
232232

233-
To define the default values for your props, simply define a property in the class with same name and provide the value.
233+
To define the default values for your props, simply define a property in the class with the same name and provide the value.
234234

235235
```javascript
236236
class MyButton extends WebComponent {
@@ -271,11 +271,11 @@ customElements.define('my-button', MyButton)
271271

272272
### State
273273

274-
The state is based on [Markup state](../state/index.md) which means it will pair up with your template just fine.
274+
The state is based on [Markup state](../state/index.md), which means it will pair up with your template just fine.
275275

276276
#### initialState
277277

278-
To start using state in your component simply define the initial state with the `initialState` property.
278+
To start using state in your component, simply define the initial state with the `initialState` property.
279279

280280
```typescript
281281
interface State {
@@ -293,7 +293,7 @@ customElements.define('my-button', MyButton)
293293

294294
#### setState
295295

296-
If you have state, you will need to update it. To do that you can call the `setState` method with a whole or partially new state object or simply a callback function that returns the state.
296+
If you have a state, you will need to update it. To do that, you can call the `setState` method with a whole or partially new state object or simply a callback function that returns the state.
297297

298298
```typescript
299299
interface State {
@@ -317,7 +317,7 @@ class MyButton extends WebComponent<{}, State> {
317317
customElements.define('my-button', MyButton)
318318
```
319319

320-
if you provide a partial state object it will be merged with the current state object. No need to spread state when updating it.
320+
If you provide a partial state object, it will be merged with the current state object. No need to spread state when updating it.
321321

322322
You can also provide a callback so you can access the current state data.
323323

@@ -352,7 +352,7 @@ class MyButton extends WebComponent {
352352
customElements.define('my-button', MyButton)
353353
```
354354

355-
This `dispatch` method also takes a second argument which can be the data you want to expose with the event.
355+
This `dispatch` method also takes a second argument, which can be the data you want to expose with the event.
356356

357357
```javascript
358358
this.dispatch('change', { value })
@@ -378,7 +378,7 @@ customElements.define('my-button', MyButton)
378378

379379
You may always use the `mounted` property to check if the component is in the DOM or not.
380380

381-
You have the option to return a function to perform cleanups which is executed like [onDestroy](./web-component.md#onDesctroy).
381+
You have the option to return a function to perform cleanups, which is executed like [onDestroy](./web-component.md#onDesctroy).
382382

383383
```javascript
384384
class MyButton extends WebComponent {
@@ -408,7 +408,7 @@ customElements.define('my-button', MyButton)
408408

409409
#### onUpdate
410410

411-
The `onUpdate` method is called whenever the component props are updated via the `setAttribute` or changing the props property on the element instance directly.
411+
The `onUpdate` method is called whenever the component props are updated via the `setAttribute` or by changing the props property on the element instance directly.
412412

413413
```javascript
414414
class MyButton extends WebComponent {
@@ -420,7 +420,7 @@ class MyButton extends WebComponent {
420420
customElements.define('my-button', MyButton)
421421
```
422422

423-
The method will always tell you, which prop and its new and old value.
423+
The method will always tell you which prop and its new and old values.
424424

425425
#### onAdoption
426426

@@ -438,7 +438,7 @@ customElements.define('my-button', MyButton)
438438

439439
#### onError
440440

441-
The `onError` method is called whenever the component fails to perform internal actions. These action can also be related to code executed inside any lifecycle methods, render, state or style update.
441+
The `onError` method is called whenever the component fails to perform internal actions. These actions can also be related to code executed inside any lifecycle methods, render, state or style update.
442442

443443
```javascript
444444
class MyButton extends WebComponent {
@@ -466,7 +466,7 @@ class MyButton extends WebComponent {
466466
customElements.define('my-button', MyButton)
467467
```
468468

469-
You can also enhance components so all errors are handled in the same place.
469+
You can also enhance components so that all errors are handled in the same place.
470470

471471
```javascript
472472
// have your global componenent that extends WebComponent
@@ -526,8 +526,8 @@ const field = new TextField()
526526
field.contentRoot // ShadowRoot object
527527
```
528528

529-
This is not to be confused with the Node returned by calling the [getRootNode()](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode) on an element. The getRootNode will return the element context root node and contentRoot will contain the node where the template was rendered to.
529+
This is not to be confused with the Node returned by calling the [getRootNode()](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode) on an element. The getRootNode will return the element context root node, and contentRoot will contain the node where the template was rendered to.
530530

531531
### Root
532532

533-
The `root` tells you about where the component was rendered at. It can either be the document itself, or the ancestor element shadow root.
533+
The `root` tells you about where the component was rendered. It can either be the document itself or the ancestor element shadow root.

0 commit comments

Comments
 (0)