mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* The const var for SVG and xlink namespaces
|
||||
*/
|
||||
const SVGNS = 'http://www.w3.org/2000/svg';
|
||||
const XLINKNS = 'http://www.w3.org/1999/xlink';
|
||||
|
||||
/**
|
||||
* Appends a svg element to the parent.
|
||||
*
|
||||
* @param test 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 tag The element tag name.
|
||||
* @param parent The parent element of this new created svg element.
|
||||
* @param attrs A dictionary object with attribute names and values to set on
|
||||
* the div.
|
||||
*/
|
||||
function createSVGElement(test, tag, parent, attrs) {
|
||||
var elem = document.createElementNS(SVGNS, tag);
|
||||
if (attrs) {
|
||||
for (var attrName in attrs) {
|
||||
elem.setAttribute(attrName, attrs[attrName]);
|
||||
}
|
||||
}
|
||||
parent.appendChild(elem);
|
||||
test.add_cleanup(function() {
|
||||
elem.remove();
|
||||
});
|
||||
return elem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Promise object which resolves when a specific event fires.
|
||||
*
|
||||
* @param object The event target.
|
||||
* @param name The event name.
|
||||
*/
|
||||
function waitEvent(object, name) {
|
||||
return new Promise(function(resolve) {
|
||||
object.addEventListener(name, resolve, { once: true });
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue