// Test changing as attribute from an empty value to "foo" to "image". The empty value and "foo" will
// not trigger any event and "image" should trigger an load event.
function testPreloadEventAsAttributeChange(url) {
return new Promise((resolve) => { varlink = document.createElement("LINK"); link.setAttribute("rel", "preload"); link.setAttribute("href", url);
link.addEventListener("load", () => {
ok(link.as == "image", "Only image will trigger a load event"); link.remove();
resolve();
}); link.addEventListener("error", () => {
ok(false, "We should not get an error event.");
});
// Test changing as parameter from a wrong to a correct one.
testPreloadEventAsAttributeChange(SAME_ORIGIN + IMAGE_PATH)
// Test changing type parameter from a wrong to a correct one for given as parameter.
.then(() => testPreloadEventAttributeChange(SAME_ORIGIN + IMAGE_PATH, "type", "text/vtt", "image/png"))
// Test changing media parameter from a wrong to a correct one.
.then(() => testPreloadEventAttributeChange(SAME_ORIGIN + IMAGE_PATH, "media", "foo", "all"))
// Test changing crossorigin parameter.
.then(() => testPreloadEventSetCrossOrigin(CROSS_ORIGIN + SJS_PATH + "?statusCode=404&cacheControl=max-age%3D120&allowOrigin=*"))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.