Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text fragment support #13

Closed
ClassicOldSong opened this issue Jun 11, 2019 · 2 comments
Closed

Text fragment support #13

ClassicOldSong opened this issue Jun 11, 2019 · 2 comments

Comments

@ClassicOldSong
Copy link
Member

Now we have mounting points and list mounting points, which can handle all ef-components at ease. But times when people want only to put a line of text into the mounting points, things gets really hard. Maybe we can have text fragments supported, which can also be helpful when jsx(#3) gets supported.

For Example:

const {t} = ef

const component = new (t`
>div
  -nodeMountingPoint
  +listMountingPoint
`)()

component.nodeMountingPoint = 'Hello World!'
component.listMountingPoint.push('Hello ef.js!')
component.listMountingPoint.push('Hello text fragments!')

component.$mount({target: document.body})

could be rendered as:

<div>Hello World!Hello ef.js!Hello text fragments!</div>

while with jsx support, we can have:

const {t} = ef

const Div = t`
>div
  +children
`

const H1 = t`
>H1
  +children
`

const component = <Div>
  First line text
  <H1>Title text here</H1>
  Third line text
</Div>

component.$mount({target: document.body})
ClassicOldSong added a commit that referenced this issue Jun 12, 2019
1. Added fragment support #12, 2. Added text fragment support #13, 3. Added jsx support #3
@ClassicOldSong
Copy link
Member Author

ClassicOldSong commented Jun 13, 2019

With new version v0.9.0, TextFragment is now implemented, but in a slightly different approach:

component.nodeMountingPoint = new TextFragment({text: 'Hello World!'})
component.listMountingPoint.push(new TextFragment({text: 'Hello ef.js!'}))
component.listMountingPoint.push(new TextFragment({text: 'Hello text fragments!'}))

TextFragment support for jsx is not yet fully supported.

ClassicOldSong added a commit that referenced this issue Jun 13, 2019
Resolve #3, #12, #13
Drop support for under IE11(needs WeapMap polyfill)
@ClassicOldSong
Copy link
Member Author

Fixed in v0.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant