-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Hi,
I'm submitting a ...
- bug report
- feature request
- other (Please do not submit support requests here (below))
Within hyperapp sometimes I need to make some preparations, to ensure everything is going fine with DOM/events/data. For example:
- generate
<video>element, append some sources, and check which one browser wants to load; - create
<img>element and check if image is accessible and what size they have; - insert
svgfragment into already loaded though<object>tagsvgdom.
It is really useful to have function, which renders h('video', ...) into new Element, which can be inserted into existing DOM or just loaded (like images or videos), because as of now my preparations looks like
const el = document.createElement('video');
el.addEventListener('loadeddata', this.onVideoLoad.bind(this), false);
el.addEventListener('abort', this.onVideoAbort.bind(this), false);
el.addEventListener('waiting', this.onVideoWaiting.bind(this), false);
el.addEventListener('loadedmetadata', this.onVideoMeta.bind (this), false);
el.setAttribute('preload', 'metadata');
el.setAttribute('muted', 'true');
el.setAttribute('playsinline', 'true');
this.config.sources.forEach(source => {
var srcEl = document.createElement('source');
srcEl.src = patchLocalVideo(source.url);
srcEl.type = source.type;
el.appendChild(srcEl);
});I can implement it myself and make a pull request if you're interested in this.
Metadata
Metadata
Assignees
Labels
No labels