General documentation fixes (link to parent: CanJS#4116, Component#264, and Component#270)#288
General documentation fixes (link to parent: CanJS#4116, Component#264, and Component#270)#288michaelzcheng wants to merge 9 commits intomasterfrom
Conversation
docs/component.md
Outdated
| <hello-world><h1>Hi There</h1></hello-world> | ||
| ``` | ||
|
|
||
| Essentially, the children of the component tag will be treated as it's [can-component/content], |
docs/component.md
Outdated
| ``` | ||
|
|
||
| Essentially, the children of the component tag will be treated as it's [can-component/content], | ||
| to be rendered wherever the tag is provided in the component view. |
There was a problem hiding this comment.
the <content> tag.
(You might want to be explicit about which tag).
docs/component.md
Outdated
| Essentially, the children of the component tag will be treated as it's [can-component/content], | ||
| to be rendered wherever the tag is provided in the component view. | ||
|
|
||
| If no view is provided to a Component, it will render it's content naively. |
There was a problem hiding this comment.
Are you trying to say:
If no LIGHT DOM is provided to a component, it will render the element's LIGHT DOM?
We don't call the LIGHT DOM a view. The view is the component's view property.
By natively it sounds to me like something the BROWSER apis would just do.
Also it's => its
There was a problem hiding this comment.
I think maybe it's more accurate to say if there is no view property on a Component, that Component will simply render its LIGHT_DOM
docs/component.md
Outdated
| <can-el>Here's my content!</can-el> | ||
| ``` | ||
|
|
||
| or you can render viewModel properties using magic tags like : `<can-el>{{hovMessage}}</can-el>`, which renders like: |
There was a problem hiding this comment.
you can't do this without leakScope.
docs/content.md
Outdated
| } ); | ||
| ``` | ||
|
|
||
| The children of `<content>` can be used as a default value for rendering in the case that no content is passed. |
There was a problem hiding this comment.
Instead of "no content is passed", I think we probably should introduce the LIGHT_DOM and SHADOW_DOM concepts?
Or for CanJS, maybe these should be shadow view and light view?
docs/content.md
Outdated
| ```js | ||
| Component.extend( { | ||
| tag: "my-tag", | ||
| view: stache( "<h1><content>Hello world</content></h1>" ) |
There was a problem hiding this comment.
lets remove the stache() part.
|
|
||
| `<my-tag>Hello friend</my-tag>` will render: | ||
|
|
||
| ```html |
There was a problem hiding this comment.
it would be cool if these were @codepen-able examples:
<my-tag>Hello Friend</my-tag>
<script type="module">
import {Component} from "can";
...
</script>
docs/view.md
Outdated
|
|
||
| ### Omitting view entirely | ||
|
|
||
| If the user does not provide a view property, |
There was a problem hiding this comment.
Maybe:
If the component does not contain a view property ...
|
|
||
| ```js | ||
| Component.extend({ | ||
| tag: "my-greeting", |
There was a problem hiding this comment.
Not sure why this is showing up in Github, it doesn't show on my local text editor
- Show an example of using leakScope to render LIGHT_DOM with a component’s VM - Rename the example component tags (anything with can-* looks like it’s from CanJS) - Various grammar fixes
|
|
||
| ```js | ||
| Component.extend({ | ||
| leakScope: true, |
There was a problem hiding this comment.
@justinbmeyer I see your comment here about this only working with leakScope: #288 (comment)
But this definitely works without leakScope right now: https://codepen.io/anon/pen/wxEdyr
Is it a bug? Here’s the issue I originally filed about this: #270
| following example: | ||
|
|
||
| @demo demos/can-component/accordion.html | ||
| @codepen |
There was a problem hiding this comment.
All of these should work as of this PR: canjs/canjs#4388
- Add a link to the can-slot and can-template docs - Fix the grammar Closes #264
|
@michaelzcheng I added a few commits to clean up the docs/examples you added. 😊 |
General documentation fixes related to multiple issues