1- # Getting Start with Dom
1+ # Getting Started with Dom
22
3- With Fastjs's dom module, you can operate dom elements with simple codes.
3+ With Fastjs's dom module, you can operate on DOM elements with simple codes.
44
5- Some API of Fastjs's dom module looks like jQuery, but not fully the same way.
5+ Some APIs of Fastjs's dom module look like jQuery, but not fully the same way.
66
7- Fastjs redesigned a lot of API to help you write in different ways, and we provide strongly type support without any extra packages.
7+ Fastjs redesigned a lot of APIs to help you write in different ways, and we provide strongly typed support without any extra packages.
88
99## Import Module
1010
1111``` typescript
1212import { dom } from " jsfast" ;
1313```
1414
15- ## Select a element
15+ ## Select an element
1616
17- :::tip Different with jQuery
17+ :::tip Different from jQuery
1818Fastjs doesn't register a global variable ` $ ` to select elements, import ` dom ` and use ` dom.select() ` to select elements.
1919:::
2020
21- Select a element to operate is usually the things you need to do first , you can do this easliy with ` dom.select() `
21+ Selecting an element to operate on is usually the first thing you need to do, you can do this easily with ` dom.select() `
2222
2323``` typescript
2424dom .select (" #id" ); // FastjsDom | null
2525dom .select (" .class" ); // FastjsDomList | null
2626dom .select (" tag" ); // FastjsDomList | null
2727```
2828
29- With strongly type support with your typescript project, you can define the return type of ` dom.select() ` .
29+ With strongly type support in your TypeScript project, you can define the return type of ` dom.select() ` .
3030
3131``` typescript
3232import type { FastjsDom , FastjsDomList } from " jsfast" ;
@@ -48,11 +48,11 @@ const tagElement = dom.select<FastjsDomList<HTMLSpanElement>>("span");
4848
4949## Operate a element
5050
51- Either you select a single element or a list of elements, you can operate them with some [ methods] ( ./api.md ) .
51+ Either you select a single element or a list of elements, you can operate on them with some [ methods] ( ./api.md ) .
5252
5353### Using FastjsDom
5454
55- After you select a ** FastjsDom** element, you can operate it with some [ methods] ( ./api.md ) .
55+ After you select a ** FastjsDom** element, you can operate on it with some [ methods] ( ./api.md ) .
5656
5757``` typescript
5858dom .select (" h1" )! .html (" Hello World" );
@@ -61,7 +61,7 @@ dom.select("h1")!.html("Hello World");
6161### Using FastjsDomList
6262
6363::: tip
64- If there are a same method in ** FastjsDom** and ** FastjsDomList** , fastjs will use the method of ** FastjsDomList** .
64+ If there is a same method in ** FastjsDom** and ** FastjsDomList** , fastjs will use the method of ** FastjsDomList** .
6565
6666For example, ` each ` method is in both ** FastjsDom** and ** FastjsDomList** , but when you use ` each ` method on ** FastjsDomList** , ` FastjsDomList.each ` will be called.
6767:::
@@ -78,9 +78,9 @@ dom(".class")!.html("Hello World");
7878dom (" .class" )! .each ((element : FastjsDom ) => element .html (" Hello World" ));
7979```
8080
81- ## Create a element
81+ ## Create an element
8282
83- You can create a element with ` dom.create() ` .
83+ You can create an element with ` dom.create() ` .
8484
8585``` typescript
8686dom .create (" div" );
@@ -127,7 +127,7 @@ dom.create("div", {
127127
128128### Set Content
129129
130- You can set content to the element by setting the ` text ` or ` html ` or ` val ` key.
130+ You can set content to the element by setting the ` text ` , ` html ` , or ` val ` key.
131131
132132``` typescript
133133dom .create (" div" , {
@@ -152,4 +152,4 @@ dom.create("div", {
152152dom .create (" div" , {
153153 class: [" class1" , " class2" ],
154154});
155- ```
155+ ```
0 commit comments