Closed hrj closed 8 years ago
Idea credit: @TheJaredWilcurt
If an element has data-polyflif-bg attribute, then its value should be taken as a source URL, fetched, decoded, and rendered to an offline canvas.
data-polyflif-bg
The offline canvas can then be converted to a blob URL and assigned to element.style.backgroundImage.
element.style.backgroundImage
This is already possible with the current API; demo: https://jsfiddle.net/5v4t424f/12/
.. but would be nice to support out of the box.
Note: toBlob() is a new API (requires Chrome 50, IE10), but is easily poly-fillable as shown on the MDN page.
toBlob()
Idea credit: @TheJaredWilcurt
If an element has
data-polyflif-bg
attribute, then its value should be taken as a source URL, fetched, decoded, and rendered to an offline canvas.The offline canvas can then be converted to a blob URL and assigned to
element.style.backgroundImage
.This is already possible with the current API; demo: https://jsfiddle.net/5v4t424f/12/
.. but would be nice to support out of the box.
Note:
toBlob()
is a new API (requires Chrome 50, IE10), but is easily poly-fillable as shown on the MDN page.