Commit 3e80556
Fix .complete for errored images
According to the HTML specification [1], HTMLImageElement#complete
indicates whether or not an image is loading. It does not indicate
whether or not the image successfully loaded.
When an Image fails to load, we call the onerror callback. However,
Image#complete is false, despite the current request's state being
'broken' (according to the spec). This is not spec-compliant.
Because our Image implementation loads images synchronously (as soon as
the src property is set, which is not spec-compliant), then the current
request's state is only ever 'completely available' or 'broken' [2] (if
src is set). This means that, according to the spec, Image#complete must
always be true. Fix Image#complete to return true unconditionally.
[1] https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
[2] https://html.spec.whatwg.org/multipage/images.html#img-req-state1 parent f13efc7 commit 3e80556
3 files changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| |||
156 | 159 | | |
157 | 160 | | |
158 | 161 | | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
| |||
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
| 172 | + | |
168 | 173 | | |
169 | 174 | | |
170 | 175 | | |
| |||
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| 226 | + | |
221 | 227 | | |
222 | 228 | | |
223 | 229 | | |
| |||
0 commit comments