forked from LeaVerou/HTML5-Progress-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (83 loc) · 3.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 <progress> polyfill by Lea Verou</title>
<link href="style.css" rel="stylesheet" />
<link href="progress-polyfill.css" rel="stylesheet" />
<script>document.createElement('progress');</script>
</head>
<body>
<hgroup>
<h1>HTML5 <progress> polyfill</h1>
<h2><a href="http://leaverou.me">by Lea Verou</a> • <a href="http://leaverou.me/2011/07/a-polyfill-for-html5-progress-element">Story</a> • <a href="https://github.com/LeaVerou/HTML5-Progress-polyfill">Github</a></h2>
</hgroup>
<h2>Demos</h2>
<ul>
<li>
<label>Indeterminate
<progress max="100"></progress>
</label>
</li>
<li>
<label for="progress1">Progress: 0%</label>
<progress max="10" value="0" id="progress1"></progress>
</li>
<li>
<label for="progress2">Progress: .5 of 0</label>
<progress max="0" value="0.5" id="progress2"></progress>
</li>
<li>
<label for="progress3">Progress: 100%</label>
<progress max="3254" value="3254" id="progress3"></progress>
</li>
<li>
<label>Progress: 75%
<progress max="0.8" value="0.6"></progress>
</label>
</li>
</ul>
<h2>Dynamic demo</h2>
<ul>
<li id="dynamicProgress">
<label>Progress: <span class="percentage">0</span>%
<progress value="0" max="100"></progress>
</label>
</li>
</ul>
<p>
<button id="animateFully">Animate to 100%</button>
<button id="animateToUserInput">Animate to...</button>
</p>
<h2>Features</h2>
<ul>
<li>Accessible (WAI-ARIA-enabled)</li>
<li>Supports getting (and setting, when allowed by the spec) all the IDL attributes defined in the specification (value, max, position, labels), through ES5 getters and setters</li>
<li>Supoorts setting both max and value attributes, through mutation events</li>
<li>Will fix new progress elements as well, through mutation events</li>
<li>No extra HTML elements needed and none added through script</li>
</ul>
<h2>Browser support</h2>
<p>The progress element is natively supported in: Firefox 6+, Opera 11+, Chrome, Safari 5.1</p>
<p>This polyfill adds almost full support in: Firefox 3.5-5, Opera 10.5-10.63, IE9-10</p>
<p>This polyfill adds partial support in: IE8</p>
<p>Supporting Safari 5 was impossible, as it completely drops the progress tags and gives you an error</p>
<h2>How to use</h2>
<ul>
<li>In the head section, add <code>progress-polyfill.css</code></li>
<li>Also in the head section, add the Javascript code: <code>document.createElement("progress");</code></li>
<li>Near the body closing tag, add <code>progress-polyfill.js</code>.</li>
</ul>
<h2>Unit tests</h2>
<p style="display:none">
<label><progress max="0.8" value="0.6" id="progress4"></progress></label>
<label for="progress4">Test label for progress4</label>
<progress max="100" id="progress0"></progress>
<progress max="0" id="progress5"></progress>
</p>
<div id="unit-test-results"></div>
<script src="progress-polyfill.js"></script>
<script src="tests.js"></script>
<script src="user-interaction.js"></script>
</body>
</html>