---
{
	"title": "Progress polyfill (progress bar)",
	"language": "en",
	"category": "Polyfills",
	"categoryfile": "polyfills",
	"description": "Emulates progress element support for browsers that do not have support. The progress element displays the progress of a task.",
	"altLangPrefix": "progress",
	"dateModified": "2014-08-04"
}
---
<span class="wb-prettify all-pre hide"></span>

<section>
	<h2>Purpose</h2>
	<p>The HTML5 <code>progress</code> element displays the progress of a task. Because some browsers do not support this functionality natively, this polyfill emulates the same functionality using generic HTML and WAI-ARIA.</p>
</section>

<section>
	<h2>Use when</h2>
	<ul>
		<li>Displaying the progress of a task</li>
	</ul>
</section>

<section>
	<h2>Working example</h2>
	<section>
		<h3>Task in progress</h3>
		<pre><code>&lt;progress value="25" max="100" /&gt;</code></pre>
	</section>
	<section>
		<h3>Completed task</h3>
		<pre><code>&lt;progress value="50" max="50" /&gt;</code></pre>
	</section>
	<section>
		<h3>Task of indeterminate progress</h3>
		<pre><code>&lt;progress /&gt;</code></pre>
		or
		<pre><code>&lt;progress max="50" /&gt;</code></pre>
	</section>

	<ul>
		<li><a href="../../../demos/progress/progress-en.html">English examples</a></li>
		<li><a href="../../../demos/progress/progress-fr.html">French examples</a></li>
	</ul>
</section>

<section>
	<h2>How to implement</h2>
	<p>To use the polyfill, a standard <code>progress</code> element must be used. In cases where a browser doesn't support the <code>progress</code> element, the polyfill is automatically loaded.</p>
</section>

<section>
	<h2>Configuration options</h2>
	<p><a href="https://www.w3.org/TR/html5/forms.html#the-progress-element">Configuration options available for the <code>progress</code> element (HTML5 specification)</a></p>
</section>

<section>
	<h2>Events</h2>
	<table class="table">
		<thead>
			<tr>
				<th>Event</th>
				<th>Trigger</th>
				<th>What it does</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td><code>wb-init.wb-progress</code></td>
				<td>Triggered manually (e.g., <code>$( "progress" ).trigger( "wb-init.wb-progress" );</code>).</td>
				<td>Used to manually initialize the <code>progress</code> polyfill. <strong>Note:</strong> The <code>progress</code> polyfill will be initialized automatically unless the <code>progress</code> element is added after the page has already loaded.</td>
			</tr>
			<tr>
				<td><code>wb-update.wb-progress</code></td>
				<td>Triggered manually (e.g., <code>$( "progress" ).trigger( "wb-update.wb-progress" );</code>).</td>
				<td>Used to manually update the <code>progress</code> polyfill.</td>
			</tr>
			<tr>
				<td><code>wb-ready.wb-progress</code> (v4.0.5+)</td>
				<td>Triggered automatically after the <code>progress</code> polyfill initializes. <strong>Note:</strong> This event will only be triggered if the polyfill is loaded. The polyfill will not load for browsers with native <code>progress</code> support.</td>
				<td>Used to identify where the <code>progress</code> polyfill initialized (target of the event)
					<pre><code>$( document ).on( "wb-ready.wb-progress", "progress", function( event ) {
});</code></pre>
					<pre><code>$( "progress" ).on( "wb-ready.wb-progress", function( event ) {
});</code></pre>
				</td>
			</tr>
			<tr>
				<td><code>wb-updated.wb-progress</code> (v4.0.5+)</td>
				<td>Triggered automatically after the <code>progress</code> polyfill is updated. <strong>Note:</strong> This event will only be triggered if the polyfill is loaded. The polyfill will not load for browsers with native <code>progress</code> support.</td>
				<td>Used to identify where the <code>progress</code> polyfill initialized (target of the event)
					<pre><code>$( document ).on( "wb-updated.wb-progress", "progress", function( event ) {
});</code></pre>
					<pre><code>$( "progress" ).on( "wb-updated.wb-progress", function( event ) {
});</code></pre>
				</td>
			</tr>
			<tr>
				<td><code>wb-ready.wb</code> (v4.0.5+)</td>
				<td>Triggered automatically when WET has finished loading and executing.</td>
				<td>Used to identify when all WET plugins and polyfills have finished loading and executing.
					<pre><code>$( document ).on( "wb-ready.wb", function( event ) {
});</code></pre>
				</td>
			</tr>
		</tbody>
	</table>
</section>

<section>
	<h2>Source code</h2>
	<p><a href="https://github.com/wet-boew/wet-boew/tree/master/src/polyfills/progress">Progress polyfill source code on GitHub</a></p>
</section>
