mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Update web-platform-tests to revision 84f93271efe15a4e37fed477a2ad364f8659a0f8
This commit is contained in:
parent
5504d9259d
commit
77e26e71da
374 changed files with 25426 additions and 892 deletions
|
@ -92,3 +92,35 @@ function all_syntaxes() {
|
|||
'<url>'
|
||||
]
|
||||
}
|
||||
|
||||
function with_style_node(text, fn) {
|
||||
let node = document.createElement('style');
|
||||
node.textContent = text;
|
||||
try {
|
||||
document.body.append(node);
|
||||
fn(node);
|
||||
} finally {
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function with_at_property(desc, fn) {
|
||||
let name = typeof(desc.name) === 'undefined' ? generate_name() : desc.name;
|
||||
let text = `@property ${name} {`;
|
||||
if (typeof(desc.syntax) !== 'undefined')
|
||||
text += `syntax:${desc.syntax};`;
|
||||
if (typeof(desc.initialValue) !== 'undefined')
|
||||
text += `initial-value:${desc.initialValue};`;
|
||||
if (typeof(desc.inherits) !== 'undefined')
|
||||
text += `inherits:${desc.inherits};`;
|
||||
text += '}';
|
||||
with_style_node(text, (node) => fn(name, node.sheet.rules[0]));
|
||||
}
|
||||
|
||||
function test_with_at_property(desc, fn, description) {
|
||||
test(() => with_at_property(desc, fn), description);
|
||||
}
|
||||
|
||||
function test_with_style_node(text, fn, description) {
|
||||
test(() => with_style_node(text, fn), description);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue