Questions tagged [html5-import]
8 questions
6
votes
1 answer
How can I make HTML5 imports work properly on Firefox and IE11
I'm using some features of the Web Platform such HTML Imports.
On Chrome 52, everything works fine, as expected. I know that there are issues with HTML Imports on IE11 and FF 47.
However I've been requested to deploy my web app on IE-11 for…

digitai
- 1,870
- 2
- 20
- 37
3
votes
2 answers
Vanilla web-component structure
I am looking into structuring vanilla web-components. I have previously used Polymer and like the fact that you can have the template, styles and JavaScript in one file for your component. I want to achieve this with 'vanilla' web components if…

Ben Thomas
- 3,180
- 2
- 20
- 38
2
votes
1 answer
Images created using `document.currentScript.ownerDocument.createElement` (from within imported HTML) never load
Here's a function that returns the width of an image, given the image's url:
async function getImageWidthByUrl(imgUrl) {
const imgEl = document.createElement("img");
let untilImgLoaded = new Promise((resolve, reject) => {
imgEl.onload =…
user993683
2
votes
2 answers
Saving on localStorage from an HTML Imports file
I'm using HTML imports, as a vehicle to dynamically inject content on a website. It works, perfect, there is a good article
which exposes the use of imports on both files and templates.
Indeed there are few other articles, but Bidelman's is…

digitai
- 1,870
- 2
- 20
- 37
1
vote
0 answers
HTML Import: How to obtain correct document object within imported html?
https://www.webcomponents.org/community/articles/introduction-to-html-imports#window-and-document-object-in-an-imported-html suggests to use var mainDoc = document.currentScript.ownerDocument; in order to get the imported document so that any…

Mahesh V S
- 552
- 1
- 8
- 23
1
vote
1 answer
webcomponent basic (no polymer, etc..): simple example 'hello world', why does it need a server?
i'm new on webcomponent, i read some guides, but i really can't figured out how to build a simple webcomponent, on latest chrome 56 (so, no polyfill needed). I want to use it without external libraries (no polymer, etc). The only simple example i…

Johannes
- 675
- 1
- 7
- 12
1
vote
1 answer
onload of import template does not have object instance in `this` - where is it?
I played around with the html5 imports and JS to create some kind of mvc and now I have a problem.
When I import a template and append its elements to my DOM and register an event it is fired and all is good.
But then the this instance holds the…

helle
- 11,183
- 9
- 56
- 83
0
votes
1 answer
HTML5 Import with dynamically created link
I'm trying to understand, why HTML5 Import doesn't work with dynamically created link element.
First example. It's work fine.
main_page.html: