Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/svg/linking/scripted/testcommon.js

Issue 2408493002: Import wpt@357b83b809e3cbc7a1805e7c3ca108a7980d782f (Closed)
Patch Set: Added one more win7-specific baseline Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /**
2 * The const var for SVG and xlink namespaces
3 */
4 const SVGNS = 'http://www.w3.org/2000/svg';
5 const XLINKNS = 'http://www.w3.org/1999/xlink';
6
7 /**
8 * Appends a svg element to the parent.
9 *
10 * @param test The testharness.js Test object. If provided, this will be used
11 * to register a cleanup callback to remove the div when the test
12 * finishes.
13 * @param tag The element tag name.
14 * @param parent The parent element of this new created svg element.
15 * @param attrs A dictionary object with attribute names and values to set on
16 * the div.
17 */
18 function createSVGElement(test, tag, parent, attrs) {
19 var elem = document.createElementNS(SVGNS, tag);
20 if (attrs) {
21 for (var attrName in attrs) {
22 elem.setAttribute(attrName, attrs[attrName]);
23 }
24 }
25 parent.appendChild(elem);
26 test.add_cleanup(function() {
27 elem.remove();
28 });
29 return elem;
30 }
31
32 /**
33 * Create a Promise object which resolves when a specific event fires.
34 *
35 * @param object The event target.
36 * @param name The event name.
37 */
38 function waitEvent(object, name) {
39 return new Promise(function(resolve) {
40 object.addEventListener(name, resolve, { once: true });
41 });
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698