Including Scripts
Load FactFinder scripts in order and prevent unstyled content flashes.
Boilerplate
The following section shows a boilerplate for including FactFinder Web Components in your website. custom-elements-es5-adapter.js and webcomponents-loader.js will load the required Polyfills minimized to the needs of the calling browser.
Note that the default-styles.css within our dist folder is already bundled into bundle.js and hence is not required to be referenced on your page. It is only for reference.
Boilerplate Code
<head>
<!-- Do not change the order of the scripts to ensure all required polyfills are loaded before our script -->
<script src="../dist/vendor/custom-elements-es5-adapter.js"></script>
<script src="../dist/vendor/webcomponents-loader.js"></script>
<script defer src="../dist/bundle.js"></script>
</head>Prevent Flash Of Unstyled Content (FOUC)
Depending on the browser's page loading time you might encounter ugly flashes of unstyled content and incomplete HTML template pieces. To prevent this simply annotate all elements that have a visual component and are shown immediately after page load with the unresolved attribute. This attribute is removed when the component is fully initialized and connected to the document.
<ff-record-list unresolved></ff-record-list>Also add suitable CSS rules to the top of the page before FactFinder Web Components are referenced.
The following CSS snippet hides elements marked as unresolved (as well as their descendants) in the document:
<head>
<style>
[unresolved] {
display: none;
}
</style>
</head>Last updated
Was this helpful?