mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 097043b336e46876e281ddec3bb014fe9c480128
This commit is contained in:
parent
ecd32570c0
commit
b68253eac0
405 changed files with 9164 additions and 3050 deletions
|
@ -0,0 +1,31 @@
|
|||
AttributeValueTransforms = {
|
||||
lowercase: function(value) { return value.toLowerCase(); },
|
||||
uppercase: function(value) { return value.toUpperCase(); },
|
||||
alternate_case: function(value) {
|
||||
var transformedValue = "";
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
transformedValue += i % 2 ?
|
||||
value.charAt(i).toLowerCase() :
|
||||
value.charAt(i).toUpperCase();
|
||||
}
|
||||
return transformedValue;
|
||||
},
|
||||
// TODO: Should we perform this transform too?
|
||||
// https://github.com/mathml-refresh/mathml/issues/122
|
||||
// add_leading_and_trimming_whitespace: function(value) {
|
||||
// var space = "\0020\0009\000A\000D";
|
||||
// return `${space}${space}${value}${space}${space}`;
|
||||
// },
|
||||
};
|
||||
|
||||
function TransformAttributeValues(transform, attributeNames) {
|
||||
if (typeof attributeNames === "string")
|
||||
attributeNames = [attributeNames];
|
||||
attributeNames.forEach(name => {
|
||||
Array.from(document.querySelectorAll(`[${name}]`)).forEach(element => {
|
||||
var value = element.getAttribute(name);
|
||||
var transformedValue = AttributeValueTransforms[transform](value);
|
||||
element.setAttribute(name, transformedValue);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue