Q: Inline onload supposed to work ?
See original GitHub issueGreetings from Brazil!
First of all, my sincere congrats for this amazing fw.
I have a simple question.
Why doesn’t the inline onload
work at the case below?
import choo from 'choo'
import html from 'choo/html'
import log from 'choo-log'
import onload from 'on-load'
export const testView = (state, emit) => {
function onloadFn(el) {
console.log('onLoad!', el);
}
return html`
<div onload=${onloadFn}>
<h1>test!</h1>
</div>
`
}
const app = choo()
app.use(log())
app.route('*', testView)
app.mount('#root')
but this does work ?
import choo from 'choo'
import html from 'choo/html'
import log from 'choo-log'
import onload from 'on-load'
export const testView = (state, emit) => {
function onloadFn(el) {
console.log('onLoad!', el);
}
const tree = html`
<div>
<h1>test!</h1>
</div>
`
onload(tree, onloadFn)
return tree
}
const app = choo()
app.use(log())
app.route('*', testView)
app.mount('#root')
What am I doing wrong?
Would love to understand it better.
Keep it up!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Trigger onload, inline javascript event - Stack Overflow
When body JS object is completely formed or in other words when body's content is completely loaded then onLoad event is fired ....
Read more >onload Event - W3Schools
The onload event can be used to check the visitor's browser type and browser version, and load the proper version of the web...
Read more >Cannot use inline 'onload' because of CSP · Issue #312 - GitHub
When you have a CSP without unsafe-inline , you cannot use onload inline. This it will throw an error, and therefore not load...
Read more >Event Handling - Vue.js
Inline handlers: Inline JavaScript to be executed when the event is triggered (similar to the native onclick attribute). Method handlers: A property name...
Read more >The Video Embed element - HTML - MDN Web Docs - Mozilla
The HTML element embeds a media player which supports video playback into the document. You can use for audio content as well, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Heya, sorry that docs aren’t up to date - will be focusing (full time) on getting more out in the next few weeks; so stay tuned! 😄
On Fri, Sep 29, 2017 at 9:39 AM Maciej Sitko notifications@github.com wrote:
EDIT:
Well actually it won’t really work on divs in particular so discard me.
Use
shama/on-load
then