Update web-platform-tests to revision 0b22439430b6d8d9a6d43a0908e86c0366f207c0

This commit is contained in:
WPT Sync Bot 2019-07-06 10:25:38 +00:00
parent 39ec04a065
commit c8e806d0ef
93 changed files with 2118 additions and 597 deletions

View file

@ -34,6 +34,13 @@ SRIScriptTest.prototype.execute = function() {
document.body.appendChild(e);
};
function set_extra_attributes(element, attrs) {
// Apply the rest of the attributes, if any.
for (const [attr_name, attr_val] of Object.entries(attrs)) {
element[attr_name] = attr_val;
}
}
function buildElementFromDestination(resource_url, destination, attrs) {
// Assert: |destination| is a valid destination.
let element;
@ -45,26 +52,24 @@ function buildElementFromDestination(resource_url, destination, attrs) {
switch (destination) {
case "script":
element = document.createElement(destination);
set_extra_attributes(element, attrs);
element.src = resource_url;
break;
case "style":
element = document.createElement('link');
set_extra_attributes(element, attrs);
element.rel = 'stylesheet';
element.href = resource_url;
break;
case "image":
element = document.createElement('img');
set_extra_attributes(element, attrs);
element.src = resource_url;
break;
default:
assert_unreached("INVALID DESTINATION");
}
// Apply the rest of the attributes, if any.
for (const [attr_name, attr_val] of Object.entries(attrs)) {
element[attr_name] = attr_val;
}
return element;
}