Skip to content

Commit

Permalink
Merge pull request #87 from chrishalebarnes/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
dfreedm authored Oct 25, 2018
2 parents c200495 + 3c3bfaf commit de54e60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ The polyfill hosts the imported documents in the import link element. E.g.

The polyfill fires the `HTMLImportsLoaded` event when imports are loaded, and exposes the `HTMLImports.whenReady` method. This api is necessary because unlike the native implementation, script elements do not force imports to resolve. Instead, users should wrap code in either an `HTMLImportsLoaded` handler or after load time in an `HTMLImports.whenReady(callback)` call.

The polyfill provides the `HMTLImports.importForElement()` method which can be used to retrieve the `<link rel=import>` that imported an element.
The polyfill provides the `HTMLImports.importForElement()` method which can be used to retrieve the `<link rel=import>` that imported an element.

## Caveats / Limitations

### `<link>.import` is not a `Document`

The polyfill appends the imported contents to the `<link>` itself to leverage the native implementation of [Custom Elements](https://www.w3.org/TR/custom-elements), which expects scripts upgrading the `CustomElementRegistry` to be connected to the main document.

As a consequence, `.ownerDocument` will be the main document, while `.parentNode` of the imported children will be the `<link rel=import>` itself. Consider using `HMTLImports.importForElement()` in these cases. e.g:
As a consequence, `.ownerDocument` will be the main document, while `.parentNode` of the imported children will be the `<link rel=import>` itself. Consider using `HTMLImports.importForElement()` in these cases. e.g:

```javascript
const ownerDoc = HTMLImports.importForElement(document.currentScript);
Expand Down

0 comments on commit de54e60

Please sign in to comment.