Skip to content

Commit 1be0379

Browse files
committed
Merge remote-tracking branch 'origin/master' into type-script
# Conflicts: # demo/dist/dc.min.js # demo/dist/dc.min.js.map # src/dc-factory.js
2 parents c3d60cd + 9a3ce74 commit 1be0379

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dcFactory.register(CollapsedComponent);
5050

5151

5252
// later after registering all your components, when your page is ready
53-
dcFactory.init();
53+
dcFactory.init(document.body);
5454

5555
```
5656

@@ -72,13 +72,13 @@ Type: `string | CallableFunction: HTMLElement[]`
7272

7373
CSS selector which will override searching by getNamespace() and be used for searching elements of given componentClass.
7474

75-
### dcFactory.init(root = document.body, withLazy = true)
75+
### dcFactory.init(root, withLazy = true)
7676

7777
Starts the factory on a given root: finds and creates all registered components within the root
7878

7979
#### root
8080

81-
*Optional*<br>
81+
*Required*<br>
8282
Type: `HTMLElement`
8383

8484
#### withLazy
@@ -100,4 +100,4 @@ Type: `HTMLElement`
100100

101101

102102
## License
103-
[MIT](https://choosealicense.com/licenses/mit/)
103+
[MIT](https://choosealicense.com/licenses/mit/)

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ <h2>Simple example</h2>
122122

123123
<p>
124124
Call dcFactory.register with your components, and then starts the factory by calling
125-
dcFactory.init()
125+
dcFactory.init(document.body)
126126
</p>
127127

128128
<script data-live-highlight>
129129
dcFactory.register(CollapsedComponent);
130-
dcFactory.init();
130+
dcFactory.init(document.body);
131131
</script>
132132
</div>
133133

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@deleteagency/dc",
3-
"version": "2.0.2",
3+
"version": "3.0.0-0",
44
"description": "",
55
"main": "src/index.ts",
66
"files": [

src/dc-factory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DcFactory {
6060
* @param {HTMLElement} root
6161
* @param {boolean} withLazy - Whether or not initialize component which marked as lazy
6262
*/
63-
public init: (root?: HTMLElement, withLazy?: boolean) => void = (root = document.body, withLazy = true) => {
63+
public init: (root?: HTMLElement, withLazy?: boolean) => void = (root = document.documentElement, withLazy = true) => {
6464
this._registeredComponents.forEach((rComponent) => {
6565
this._initComponent(root, rComponent, withLazy);
6666
});

0 commit comments

Comments
 (0)