Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a242a3a

Browse files
committed
docs(readme): add docs for each attribute
1 parent 1594c38 commit a242a3a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ On page load, the `include-fragment` element fetches the URL, the response is pa
4040

4141
The server must respond with an HTML fragment to replace the `include-fragment` element. It should not contain _another_ `include-fragment` element or the server will be polled in an infinite loop.
4242

43+
### Other Attributes
44+
45+
#### accept
46+
47+
This attribute tells `<include-fragment/>` what to send as the `Accept` header, as part of the fetch request. If omitted, or if set to an empty value, the default behaviour will be `text/html`. It is important that the server responds with HTML, but you may wish to change the accept header to help negotiate the right content with the server.
48+
49+
#### loading
50+
51+
This indicates _when_ the contents should be fetched:
52+
53+
- `eager`: Fetches and load the content immediately, regardless of whether or not the `<include-fragment/>` is currently within the visible viewport (this is the default value).
54+
- `lazy`: Defers fetching and loading the content until the `<include-fragment/>` tag reaches a calculated distance from the viewport. The intent is to avoid the network and storage bandwidth needed to handle the content until it's reasonably certain that it will be needed.
55+
56+
The
57+
4358
### Errors
4459

4560
If the URL fails to load, the `include-fragment` element is left in the page and tagged with an `is-error` CSS class that can be used for styling.

0 commit comments

Comments
 (0)