mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -86,6 +86,32 @@ function assert_frame_lists_equal(actual, expected) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an element to the document body.
|
||||
*
|
||||
* @param t The testharness.js Test object. If provided, this will be used
|
||||
* to register a cleanup callback to remove the div when the test
|
||||
* finishes.
|
||||
*
|
||||
* @param name A string specifying the element name.
|
||||
*
|
||||
* @param attrs A dictionary object with attribute names and values to set on
|
||||
* the div.
|
||||
*/
|
||||
function addElement(t, name, attrs) {
|
||||
var element = document.createElement(name);
|
||||
if (attrs) {
|
||||
for (var attrName in attrs) {
|
||||
element.setAttribute(attrName, attrs[attrName]);
|
||||
}
|
||||
}
|
||||
document.body.appendChild(element);
|
||||
if (t && typeof t.add_cleanup === 'function') {
|
||||
t.add_cleanup(() => element.remove());
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a div to the document body.
|
||||
*
|
||||
|
@ -97,21 +123,7 @@ function assert_frame_lists_equal(actual, expected) {
|
|||
* the div.
|
||||
*/
|
||||
function addDiv(t, attrs) {
|
||||
var div = document.createElement('div');
|
||||
if (attrs) {
|
||||
for (var attrName in attrs) {
|
||||
div.setAttribute(attrName, attrs[attrName]);
|
||||
}
|
||||
}
|
||||
document.body.appendChild(div);
|
||||
if (t && typeof t.add_cleanup === 'function') {
|
||||
t.add_cleanup(function() {
|
||||
if (div.parentNode) {
|
||||
div.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
return div;
|
||||
return addElement(t, "div", attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue