From 9dc9ed699e7180d4b449a89d2f7d3b6250de59ce Mon Sep 17 00:00:00 2001 From: championshuttler Date: Mon, 25 Mar 2019 19:22:09 +0000 Subject: [PATCH] Bug 1508987 - Enable ESLint for dom/svg/ (Automatic Changes). r=jwatt Differential Revision: https://phabricator.services.mozilla.com/D22293 --HG-- extra : moz-landing-system : lando --- dom/svg/test/MutationEventChecker.js | 113 +-- dom/svg/test/matrixUtils.js | 19 +- dom/svg/test/pointer-events.js | 211 ++--- dom/svg/test/test_SVGLengthList-2.xhtml | 11 +- dom/svg/test/test_SVGLengthList.xhtml | 13 +- dom/svg/test/test_SVGMatrix.xhtml | 55 +- dom/svg/test/test_SVGNumberList.xhtml | 9 +- dom/svg/test/test_SVGPointList.xhtml | 11 +- dom/svg/test/test_SVGStringList.xhtml | 33 +- dom/svg/test/test_SVGTransformList.xhtml | 63 +- .../test/test_SVGTransformListAddition.xhtml | 68 +- dom/svg/test/test_SVG_namespace_ids.html | 9 +- dom/svg/test/test_SVGxxxList.xhtml | 888 +++++++++--------- dom/svg/test/test_SVGxxxListIndexing.xhtml | 5 +- dom/svg/test/test_a_href_01.xhtml | 2 +- .../test/test_animLengthObjectIdentity.xhtml | 6 +- dom/svg/test/test_animLengthReadonly.xhtml | 16 +- dom/svg/test/test_animLengthUnits.xhtml | 12 +- dom/svg/test/test_bbox-changes.xhtml | 15 +- .../test/test_bbox-with-invalid-viewBox.xhtml | 5 +- dom/svg/test/test_bbox.xhtml | 6 +- dom/svg/test/test_bounds.html | 26 +- dom/svg/test/test_bug872812.html | 4 +- dom/svg/test/test_dataTypes.html | 7 +- dom/svg/test/test_dataTypesModEvents.html | 5 +- dom/svg/test/test_fragments.html | 8 +- dom/svg/test/test_getBBox-method.html | 240 +++-- dom/svg/test/test_getCTM.html | 73 +- dom/svg/test/test_getElementById.xhtml | 3 +- dom/svg/test/test_getSubStringLength.xhtml | 37 +- dom/svg/test/test_getTotalLength.xhtml | 8 +- .../test/test_hit-testing-and-viewbox.xhtml | 27 +- dom/svg/test/test_lang.xhtml | 10 +- dom/svg/test/test_length.xhtml | 13 +- dom/svg/test/test_lengthParsing.html | 4 +- dom/svg/test/test_markerOrient.xhtml | 3 +- dom/svg/test/test_non-scaling-stroke.html | 2 +- dom/svg/test/test_nonAnimStrings.xhtml | 6 +- .../test_object-delayed-intrinsic-size.html | 3 +- dom/svg/test/test_onerror.xhtml | 5 +- dom/svg/test/test_pathAnimInterpolation.xhtml | 47 +- dom/svg/test/test_pointAtLength.xhtml | 3 +- dom/svg/test/test_pointer-events-2.xhtml | 13 +- dom/svg/test/test_pointer-events-3.xhtml | 3 +- dom/svg/test/test_pointer-events-4.xhtml | 41 +- dom/svg/test/test_pointer-events-5.xhtml | 13 +- dom/svg/test/test_pointer-events-6.xhtml | 19 +- dom/svg/test/test_pointer-events-7.xhtml | 19 +- dom/svg/test/test_scientific.html | 3 +- dom/svg/test/test_selectSubString.xhtml | 27 +- dom/svg/test/test_stroke-hit-testing.xhtml | 17 +- .../test_stroke-linecap-hit-testing.xhtml | 9 +- dom/svg/test/test_switch.xhtml | 17 +- dom/svg/test/test_tabindex.html | 15 +- dom/svg/test/test_text.html | 46 +- dom/svg/test/test_text_lengthAdjust.html | 2 +- dom/svg/test/test_text_scaled.html | 38 +- dom/svg/test/test_text_selection.html | 18 +- dom/svg/test/test_transform.xhtml | 52 +- dom/svg/test/test_transformParsing.html | 8 +- dom/svg/test/test_use_with_hsts.html | 8 +- dom/svg/test/test_valueAsString.xhtml | 35 +- dom/svg/test/test_valueLeaks.xhtml | 7 +- dom/svg/test/test_viewBox.html | 3 +- dom/svg/test/test_viewport.html | 9 +- 65 files changed, 1180 insertions(+), 1346 deletions(-) diff --git a/dom/svg/test/MutationEventChecker.js b/dom/svg/test/MutationEventChecker.js index 8c81dcb9b523..5b80b8951292 100644 --- a/dom/svg/test/MutationEventChecker.js +++ b/dom/svg/test/MutationEventChecker.js @@ -33,12 +33,10 @@ // * Event checking can be temporarily disabled with ignoreEvents(). The next // call to expect() will cause it to resume. -function MutationEventChecker() -{ +function MutationEventChecker() { this.expectedEvents = []; - this.watchAttr = function(element, attr) - { + this.watchAttr = function(element, attr) { if (this.attr) { this.finish(); } @@ -50,11 +48,10 @@ function MutationEventChecker() this.giveUp = false; this.ignore = false; - this.element.addEventListener('DOMAttrModified', this._listener); - } + this.element.addEventListener("DOMAttrModified", this._listener); + }; - this.expect = function() - { + this.expect = function() { if (this.giveUp) { return; } @@ -78,17 +75,16 @@ function MutationEventChecker() // Turn arguments object into an array var args = Array.prototype.slice.call(arguments); // Check for whitespace separated keywords - if (args.length == 1 && typeof args[0] === 'string' && - args[0].indexOf(' ') > 0) { - args = args[0].split(' '); + if (args.length == 1 && typeof args[0] === "string" && + args[0].indexOf(" ") > 0) { + args = args[0].split(" "); } // Convert strings to event Ids this.expectedEvents = args.map(this._argToEventId); - } + }; // Temporarily disable event checking - this.ignoreEvents = function() - { + this.ignoreEvents = function() { // Check all events have been received ok(this.giveUp || this.expectedEvents.length == 0, "Going to ignore subsequent events on " + this.attr + @@ -96,22 +92,20 @@ function MutationEventChecker() this._stillExpecting()); this.ignore = true; - } + }; - this.finish = function() - { + this.finish = function() { // Check all events have been received ok(this.giveUp || this.expectedEvents.length == 0, "Finishing listening to " + this.attr + " attribute, but we're still expecting the following events: " + this._stillExpecting()); - this.element.removeEventListener('DOMAttrModified', this._listener); + this.element.removeEventListener("DOMAttrModified", this._listener); this.attr = ""; - } + }; - this._receiveEvent = function(e) - { + this._receiveEvent = function(e) { if (this.giveUp || this.ignore) { this.oldValue = e.newValue; return; @@ -119,8 +113,8 @@ function MutationEventChecker() // Make sure we're expecting something at all if (this.expectedEvents.length == 0) { - ok(false, 'Unexpected ' + this._eventToName(e.attrChange) + - ' event when none expected on ' + this.attr + ' attribute.'); + ok(false, "Unexpected " + this._eventToName(e.attrChange) + + " event when none expected on " + this.attr + " attribute."); return; } @@ -128,9 +122,9 @@ function MutationEventChecker() // Make sure we got the event we expected if (e.attrChange != expectedEvent) { - ok(false, 'Unexpected ' + this._eventToName(e.attrChange) + - ' on ' + this.attr + ' attribute. Expected ' + - this._eventToName(expectedEvent) + ' (followed by: ' + + ok(false, "Unexpected " + this._eventToName(e.attrChange) + + " on " + this.attr + " attribute. Expected " + + this._eventToName(expectedEvent) + " (followed by: " + this._stillExpecting() + ")"); // If we get events out of sequence, it doesn't make sense to do any // further testing since we don't really know what to expect @@ -140,8 +134,8 @@ function MutationEventChecker() // Common param checking is(e.target, this.element, - 'Unexpected node for mutation event on ' + this.attr + ' attribute'); - is(e.attrName, this.attr, 'Unexpected attribute name for mutation event'); + "Unexpected node for mutation event on " + this.attr + " attribute"); + is(e.attrName, this.attr, "Unexpected attribute name for mutation event"); // Don't bother testing e.relatedNode since Attr nodes are on the way // out anyway (but then, so are mutation events...) @@ -149,60 +143,57 @@ function MutationEventChecker() // Event-specific checking if (e.attrChange == MutationEvent.MODIFICATION) { ok(this.element.hasAttribute(this.attr), - 'Attribute not set after modification'); + "Attribute not set after modification"); is(e.prevValue, this.oldValue, - 'Unexpected old value for modification to ' + this.attr + - ' attribute'); + "Unexpected old value for modification to " + this.attr + + " attribute"); isnot(e.newValue, this.oldValue, - 'Unexpected new value for modification to ' + this.attr + - ' attribute'); + "Unexpected new value for modification to " + this.attr + + " attribute"); } else if (e.attrChange == MutationEvent.REMOVAL) { - ok(!this.element.hasAttribute(this.attr), 'Attribute set after removal'); + ok(!this.element.hasAttribute(this.attr), "Attribute set after removal"); is(e.prevValue, this.oldValue, - 'Unexpected old value for removal of ' + this.attr + - ' attribute'); + "Unexpected old value for removal of " + this.attr + + " attribute"); // DOM 3 Events doesn't say what value newValue will be for a removal // event but generally empty strings are used for other events when an // attribute isn't relevant ok(e.newValue === "", - 'Unexpected new value for removal of ' + this.attr + - ' attribute'); + "Unexpected new value for removal of " + this.attr + + " attribute"); } else if (e.attrChange == MutationEvent.ADDITION) { ok(this.element.hasAttribute(this.attr), - 'Attribute not set after addition'); + "Attribute not set after addition"); // DOM 3 Events doesn't say what value prevValue will be for an addition // event but generally empty strings are used for other events when an // attribute isn't relevant ok(e.prevValue === "", - 'Unexpected old value for addition of ' + this.attr + - ' attribute'); - ok(typeof(e.newValue) == 'string' && e.newValue !== "", - 'Unexpected new value for addition of ' + this.attr + - ' attribute'); + "Unexpected old value for addition of " + this.attr + + " attribute"); + ok(typeof(e.newValue) == "string" && e.newValue !== "", + "Unexpected new value for addition of " + this.attr + + " attribute"); } else { - ok(false, 'Unexpected mutation event type: ' + e.attrChange); + ok(false, "Unexpected mutation event type: " + e.attrChange); this.giveUp = true; } this.oldValue = e.newValue; - } + }; this._listener = this._receiveEvent.bind(this); - this._stillExpecting = function() - { + this._stillExpecting = function() { if (this.expectedEvents.length == 0) { return "(nothing)"; } var eventNames = []; - for (var i=0; i < this.expectedEvents.length; i++) { + for (var i = 0; i < this.expectedEvents.length; i++) { eventNames.push(this._eventToName(this.expectedEvents[i])); } return eventNames.join(", "); - } + }; - this._eventToName = function(evtId) - { - switch (evtId) - { + this._eventToName = function(evtId) { + switch (evtId) { case MutationEvent.MODIFICATION: return "modification"; case MutationEvent.ADDITION: @@ -210,20 +201,18 @@ function MutationEventChecker() case MutationEvent.REMOVAL: return "removal"; } - } + }; - this._argToEventId = function(arg) - { - if (typeof arg === 'number') + this._argToEventId = function(arg) { + if (typeof arg === "number") return arg; - if (typeof arg !== 'string') { + if (typeof arg !== "string") { ok(false, "Unexpected event type: " + arg); return 0; } - switch (arg.toLowerCase()) - { + switch (arg.toLowerCase()) { case "mod": case "modify": case "modification": @@ -241,5 +230,5 @@ function MutationEventChecker() ok(false, "Unexpected event name: " + arg); return 0; } - } + }; } diff --git a/dom/svg/test/matrixUtils.js b/dom/svg/test/matrixUtils.js index 9e316ed07a56..b73e1cc1a2d7 100644 --- a/dom/svg/test/matrixUtils.js +++ b/dom/svg/test/matrixUtils.js @@ -8,8 +8,7 @@ * Utilities for testing SVG matrices */ -function createMatrix(a, b, c, d, e, f) -{ +function createMatrix(a, b, c, d, e, f) { var svg = document.getElementsByTagName("svg")[0]; var m = svg.createSVGMatrix(); m.a = a; @@ -22,8 +21,7 @@ function createMatrix(a, b, c, d, e, f) } // Lightweight dummy Matrix class for representing arrays that get passed in -function MatrixFromArray(a) -{ +function MatrixFromArray(a) { this.a = a[0]; this.b = a[1]; this.c = a[2]; @@ -32,8 +30,7 @@ function MatrixFromArray(a) this.f = a[5]; } -function cmpMatrix(a, b, msg) -{ +function cmpMatrix(a, b, msg) { if (a.constructor === Array) a = new MatrixFromArray(a); if (b.constructor === Array) @@ -49,8 +46,7 @@ function cmpMatrix(a, b, msg) + ", expected " + formatMatrix(b)); } -function roughCmpMatrix(a, b, msg) -{ +function roughCmpMatrix(a, b, msg) { if (a.constructor === Array) a = new MatrixFromArray(a); if (b.constructor === Array) @@ -67,10 +63,9 @@ function roughCmpMatrix(a, b, msg) + ", expected " + formatMatrix(b)); } -function formatMatrix(m) -{ +function formatMatrix(m) { if (m.constructor != Array) - return "(" + [m.a, m.b, m.c, m.d, m.e, m.f].join(', ') + ")"; + return "(" + [m.a, m.b, m.c, m.d, m.e, m.f].join(", ") + ")"; - return "(" + m.join(', ') + ")"; + return "(" + m.join(", ") + ")"; } diff --git a/dom/svg/test/pointer-events.js b/dom/svg/test/pointer-events.js index cf5d6cb709fa..d62a5728c2af 100644 --- a/dom/svg/test/pointer-events.js +++ b/dom/svg/test/pointer-events.js @@ -1,34 +1,34 @@ SimpleTest.waitForExplicitFinish(); var pointer_events_values = [ - 'auto', - 'visiblePainted', - 'visibleFill', - 'visibleStroke', - 'visible', - 'painted', - 'fill', - 'stroke', - 'all', - 'none' + "auto", + "visiblePainted", + "visibleFill", + "visibleStroke", + "visible", + "painted", + "fill", + "stroke", + "all", + "none", ]; var paint_values = [ - 'blue', - 'transparent', - 'none' + "blue", + "transparent", + "none", ]; var opacity_values = [ - '1', - '0.5', - '0' + "1", + "0.5", + "0", ]; var visibility_values = [ - 'visible', - 'hidden', - 'collapse' + "visible", + "hidden", + "collapse", ]; /** @@ -43,29 +43,29 @@ var visibility_values = [ */ var hit_test_inputs = { fill: [ - { name: 'pointer-events', values: pointer_events_values }, - { name: 'fill', values: paint_values }, - { name: 'fill-opacity', values: opacity_values }, - { name: 'opacity', values: opacity_values }, - { name: 'visibility', values: visibility_values } + { name: "pointer-events", values: pointer_events_values }, + { name: "fill", values: paint_values }, + { name: "fill-opacity", values: opacity_values }, + { name: "opacity", values: opacity_values }, + { name: "visibility", values: visibility_values }, ], stroke: [ - { name: 'pointer-events', values: pointer_events_values }, - { name: 'stroke', values: paint_values }, - { name: 'stroke-opacity', values: opacity_values }, - { name: 'opacity', values: opacity_values }, - { name: 'visibility', values: visibility_values } + { name: "pointer-events", values: pointer_events_values }, + { name: "stroke", values: paint_values }, + { name: "stroke-opacity", values: opacity_values }, + { name: "opacity", values: opacity_values }, + { name: "visibility", values: visibility_values }, ], both: [ - { name: 'pointer-events', values: pointer_events_values }, - { name: 'fill', values: paint_values }, - { name: 'fill-opacity', values: opacity_values }, - { name: 'stroke', values: paint_values }, - { name: 'stroke-opacity', values: opacity_values }, - { name: 'opacity', values: opacity_values }, - { name: 'visibility', values: visibility_values } - ] -} + { name: "pointer-events", values: pointer_events_values }, + { name: "fill", values: paint_values }, + { name: "fill-opacity", values: opacity_values }, + { name: "stroke", values: paint_values }, + { name: "stroke-opacity", values: opacity_values }, + { name: "opacity", values: opacity_values }, + { name: "visibility", values: visibility_values }, + ], +}; /** * The following object contains a list of 'pointer-events' property values, @@ -86,77 +86,77 @@ var hit_test_inputs = { */ var hit_conditions = { auto: { - 'fill-intercepts-iff': { - 'visibility': ['visible'], - 'fill!': ['none'] + "fill-intercepts-iff": { + "visibility": ["visible"], + "fill!": ["none"], + }, + "stroke-intercepts-iff": { + "visibility": ["visible"], + "stroke!": ["none"], }, - 'stroke-intercepts-iff': { - 'visibility': ['visible'], - 'stroke!': ['none'] - } }, visiblePainted: { - 'fill-intercepts-iff': { - 'visibility': ['visible'], - 'fill!': ['none'] + "fill-intercepts-iff": { + "visibility": ["visible"], + "fill!": ["none"], + }, + "stroke-intercepts-iff": { + "visibility": ["visible"], + "stroke!": ["none"], }, - 'stroke-intercepts-iff': { - 'visibility': ['visible'], - 'stroke!': ['none'] - } }, visibleFill: { - 'fill-intercepts-iff': { - visibility: ['visible'] - } + "fill-intercepts-iff": { + visibility: ["visible"], + }, // stroke never intercepts pointer events }, visibleStroke: { // fill never intercepts pointer events - 'stroke-intercepts-iff': { - visibility: ['visible'] - } + "stroke-intercepts-iff": { + visibility: ["visible"], + }, }, visible: { - 'fill-intercepts-iff': { - visibility: ['visible'] + "fill-intercepts-iff": { + visibility: ["visible"], + }, + "stroke-intercepts-iff": { + visibility: ["visible"], }, - 'stroke-intercepts-iff': { - visibility: ['visible'] - } }, painted: { - 'fill-intercepts-iff': { - 'fill!': ['none'] + "fill-intercepts-iff": { + "fill!": ["none"], + }, + "stroke-intercepts-iff": { + "stroke!": ["none"], }, - 'stroke-intercepts-iff': { - 'stroke!': ['none'] - } }, fill: { - 'fill-intercepts-iff': { + "fill-intercepts-iff": { // fill always intercepts pointer events - } + }, // stroke never intercepts pointer events }, stroke: { // fill never intercepts pointer events - 'stroke-intercepts-iff': { + "stroke-intercepts-iff": { // stroke always intercepts pointer events - } + }, }, all: { - 'fill-intercepts-iff': { + "fill-intercepts-iff": { // fill always intercepts pointer events }, - 'stroke-intercepts-iff': { + "stroke-intercepts-iff": { // stroke always intercepts pointer events - } + }, }, none: { // neither fill nor stroke intercept pointer events - } -} + }, +}; // bit flags var POINT_OVER_FILL = 0x1; @@ -167,22 +167,21 @@ var POINT_OVER_STROKE = 0x2; * element that the pointer event is over (fill and/or stroke areas), return * true if the element is expected to intercept the event, otherwise false. */ -function hit_expected(element, over /* bit flags indicating which area(s) of the element the pointer is over */) -{ - function expect_hit(target){ +function hit_expected(element, over /* bit flags indicating which area(s) of the element the pointer is over */) { + function expect_hit(target) { var intercepts_iff = - hit_conditions[element.getAttribute('pointer-events')][target + '-intercepts-iff']; + hit_conditions[element.getAttribute("pointer-events")][target + "-intercepts-iff"]; if (!intercepts_iff) { return false; // never intercepts events } for (var attr in intercepts_iff) { - var vals = intercepts_iff[attr]; // must get this before we adjust 'attr' + var vals = intercepts_iff[attr]; // must get this before we adjust 'attr' var invert = false; - if (attr.substr(-1) == '!') { + if (attr.substr(-1) == "!") { invert = true; - attr = attr.substr(0, attr.length-1); + attr = attr.substr(0, attr.length - 1); } var match = vals.indexOf(element.getAttribute(attr)) > -1; if (invert) { @@ -196,12 +195,11 @@ function hit_expected(element, over /* bit flags indicating which area(s) of the return true; } - return (over & POINT_OVER_FILL) != 0 && expect_hit('fill') || - (over & POINT_OVER_STROKE) != 0 && expect_hit('stroke'); + return (over & POINT_OVER_FILL) != 0 && expect_hit("fill") || + (over & POINT_OVER_STROKE) != 0 && expect_hit("stroke"); } -function for_all_permutations(inputs, callback) -{ +function for_all_permutations(inputs, callback) { var current_permutation = arguments[2] || {}; var index = arguments[3] || 0; @@ -210,7 +208,7 @@ function for_all_permutations(inputs, callback) var values = inputs[index].values; for (var i = 0; i < values.length; ++i) { current_permutation[name] = values[i]; - for_all_permutations(inputs, callback, current_permutation, index+1); + for_all_permutations(inputs, callback, current_permutation, index + 1); } return; } @@ -218,29 +216,27 @@ function for_all_permutations(inputs, callback) callback(current_permutation); } -function make_log_msg(over, tag, attributes) -{ +function make_log_msg(over, tag, attributes) { var target; if (over == (POINT_OVER_FILL | POINT_OVER_STROKE)) { - target = 'fill and stroke'; + target = "fill and stroke"; } else if (over == POINT_OVER_FILL) { - target = 'fill'; + target = "fill"; } else if (over == POINT_OVER_STROKE) { - target = 'stroke'; + target = "stroke"; } else { throw "unexpected bit combination in 'over'"; } - var msg = 'Check if events are intercepted at a point over the '+target+' on <'+tag+'> for'; + var msg = "Check if events are intercepted at a point over the " + target + " on <" + tag + "> for"; for (var attr in attributes) { - msg += ' '+attr+'='+attributes[attr]; + msg += " " + attr + "=" + attributes[attr]; } return msg; } var dx, dy; // offset of element from pointer coordinates origin -function test_element(id, x, y, over /* bit flags indicating which area(s) of the element the pointer is over */) -{ +function test_element(id, x, y, over /* bit flags indicating which area(s) of the element the pointer is over */) { var element = document.getElementById(id); var tag = element.tagName; @@ -256,11 +252,11 @@ function test_element(id, x, y, over /* bit flags indicating which area(s) of th var inputs; if (over == (POINT_OVER_FILL | POINT_OVER_STROKE)) { - inputs = hit_test_inputs['both']; + inputs = hit_test_inputs.both; } else if (over == POINT_OVER_FILL) { - inputs = hit_test_inputs['fill']; + inputs = hit_test_inputs.fill; } else if (over == POINT_OVER_STROKE) { - inputs = hit_test_inputs['stroke']; + inputs = hit_test_inputs.stroke; } else { throw "unexpected bit combination in 'over'"; } @@ -268,12 +264,11 @@ function test_element(id, x, y, over /* bit flags indicating which area(s) of th for_all_permutations(inputs, test_permutation); // To reduce the chance of bogus results in subsequent tests: - element.setAttribute('fill', 'none'); - element.setAttribute('stroke', 'none'); + element.setAttribute("fill", "none"); + element.setAttribute("stroke", "none"); } -function run_tests(subtest) -{ +function run_tests(subtest) { var div = document.getElementById("div"); dx = div.offsetLeft; dy = div.offsetTop; @@ -294,8 +289,8 @@ function run_tests(subtest) throw "unexpected subtest number"; } - test_element('rect', 30, 30, POINT_OVER_FILL); - test_element('rect', 5, 5, POINT_OVER_STROKE); + test_element("rect", 30, 30, POINT_OVER_FILL); + test_element("rect", 5, 5, POINT_OVER_STROKE); // The SVG 1.1 spec essentially says that, for text, hit testing is done // against the character cells of the text, and not the fill and stroke as @@ -322,7 +317,7 @@ function run_tests(subtest) // intercept events in the normal way. When we make that change we'll be able // to add separate fill and stroke tests for text below. - test_element('text', 210, 30, POINT_OVER_FILL | POINT_OVER_STROKE); + test_element("text", 210, 30, POINT_OVER_FILL | POINT_OVER_STROKE); SimpleTest.finish(); } diff --git a/dom/svg/test/test_SVGLengthList-2.xhtml b/dom/svg/test/test_SVGLengthList-2.xhtml index db4bdde32e4e..c0a34780a7b0 100644 --- a/dom/svg/test/test_SVGLengthList-2.xhtml +++ b/dom/svg/test/test_SVGLengthList-2.xhtml @@ -23,9 +23,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=630760 SimpleTest.waitForExplicitFinish(); -function run_tests() -{ - var svg = document.getElementById('svg'); +function run_tests() { + var svg = document.getElementById("svg"); svg.pauseAnimations(); // Check that the animVal list for 'x' on gives the correct number of @@ -34,7 +33,7 @@ function run_tests() var text = document.getElementById("text"); var list = text.x.animVal; - is(list.numberOfItems, 4, 'Checking numberOfItems'); + is(list.numberOfItems, 4, "Checking numberOfItems"); // Check that items at an index larger than 255 (max value for PRUint8) are // returning the correct values: @@ -50,8 +49,8 @@ function run_tests() item.value = 2; list.appendItem(item); - is(list.getItem(0).value, 1, 'Check value of first item'); - is(list.getItem(256).value, 2, 'Check value of item at index > 255'); + is(list.getItem(0).value, 1, "Check value of first item"); + is(list.getItem(256).value, 2, "Check value of item at index > 255"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_SVGLengthList.xhtml b/dom/svg/test/test_SVGLengthList.xhtml index e8250b614a8e..0efd8119c061 100644 --- a/dom/svg/test/test_SVGLengthList.xhtml +++ b/dom/svg/test/test_SVGLengthList.xhtml @@ -30,14 +30,13 @@ tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized to other list types belongs there. */ -function run_tests() -{ - document.getElementById('svg').pauseAnimations(); +function run_tests() { + document.getElementById("svg").pauseAnimations(); var text = document.getElementById("text"); var lengths = text.x.baseVal; - is(lengths.numberOfItems, 0, 'Checking numberOfItems'); + is(lengths.numberOfItems, 0, "Checking numberOfItems"); // Test mutation events // --- Initialization @@ -46,7 +45,7 @@ function run_tests() eventChecker.expect("modify"); text.textContent = "abc"; text.setAttribute("x", "10 20 30"); - is(lengths.numberOfItems, 3, 'Checking numberOfItems'); + is(lengths.numberOfItems, 3, "Checking numberOfItems"); // -- Actual changes eventChecker.expect("modify modify modify modify modify"); lengths[0].value = 8; @@ -66,7 +65,7 @@ function run_tests() // -- Invalid attribute eventChecker.expect("modify"); text.setAttribute("x", ",20"); - is(lengths.numberOfItems, 0, 'Checking that parsing stops at invalid token'); + is(lengths.numberOfItems, 0, "Checking that parsing stops at invalid token"); // -- Attribute removal eventChecker.expect("remove"); text.removeAttribute("x"); @@ -96,7 +95,7 @@ function run_tests() function appendItem(aItem) { text.removeAttribute("x"); return lengths.appendItem(aItem); - } + }, ]; subtests.forEach(function(aFunction) { // -- Adding an unowned SVGLength diff --git a/dom/svg/test/test_SVGMatrix.xhtml b/dom/svg/test/test_SVGMatrix.xhtml index d3ccd4d422c4..74c7a11b5100 100644 --- a/dom/svg/test/test_SVGMatrix.xhtml +++ b/dom/svg/test/test_SVGMatrix.xhtml @@ -18,8 +18,7 @@ SimpleTest.waitForExplicitFinish(); -function main() -{ +function main() { var tests = [ testCreateMatrix, testMultiply, @@ -32,7 +31,7 @@ function main() testFlipX, testFlipY, testSkewX, - testSkewY + testSkewY, ]; for (var i = 0; i < tests.length; i++) { tests[i](); @@ -40,9 +39,8 @@ function main() SimpleTest.finish(); } -function testCreateMatrix() -{ - svg = $('svg'); +function testCreateMatrix() { + svg = $("svg"); var m = svg.createSVGMatrix(); // Should be initialised to identity @@ -55,8 +53,7 @@ function testCreateMatrix() } // SVGMatrix multiply(in SVGMatrix secondMatrix); -function testMultiply() -{ +function testMultiply() { // This is the example from SVG 1.1 section 7.5 var m1 = createMatrix(1, 0, 0, 1, 50, 90); var m2 = createMatrix(0.707, -0.707, 0.707, 0.707, 0, 0); @@ -73,8 +70,7 @@ function testMultiply() } // SVGMatrix inverse() raises(SVGException); -function testInverse() -{ +function testInverse() { // Test inversion var m = createMatrix(2, 0, 0, 4, 110, -50); roughCmpMatrix(m.inverse(), [0.5, 0, 0, 0.25, -55, 12.5], @@ -92,49 +88,44 @@ function testInverse() } // SVGMatrix translate(in float x, in float y); -function testTranslate() -{ +function testTranslate() { var m = createMatrix(2, 0, 0, 1, 120, 100); roughCmpMatrix(m.translate(100, -50), [2, 0, 0, 1, 320, 50], "Unexpected result after translate"); } // SVGMatrix scale(in float scaleFactor); -function testScale() -{ +function testScale() { var m = createMatrix(2, 0, 0, 1, 120, 100); roughCmpMatrix(m.scale(0.5), [1, 0, 0, 0.5, 120, 100], "Unexpected result after scale"); } // SVGMatrix scaleNonUniform(in float scaleFactorX, in float scaleFactorY); -function testScaleNonUniform() -{ +function testScaleNonUniform() { var m = createMatrix(2, 0, 0, 1, 120, 100); roughCmpMatrix(m.scaleNonUniform(0.5, -3), [1, 0, 0, -3, 120, 100], "Unexpected result after scaleNonUniform"); } // SVGMatrix rotate(in float angle); -function testRotate() -{ +function testRotate() { var m = createMatrix(2, 0, 0, 1, 120, 100); roughCmpMatrix(m.rotate(45), - [2*Math.cos(Math.PI/4), Math.sin(Math.PI/4), - 2*-Math.sin(Math.PI/4), Math.cos(Math.PI/4), + [2 * Math.cos(Math.PI / 4), Math.sin(Math.PI / 4), + 2 * -Math.sin(Math.PI / 4), Math.cos(Math.PI / 4), 120, 100], "Unexpected result after rotate"); } // SVGMatrix rotateFromVector(in float x, in float y) raises(SVGException); -function testRotateFromVector() -{ +function testRotateFromVector() { var m = createMatrix(2, 0, 0, 1, 120, 100); // Make a 150 degree angle var result = m.rotateFromVector(-2, 1.1547); roughCmpMatrix(result, - [2*Math.cos(5*Math.PI/6), Math.sin(5*Math.PI/6), - 2*-Math.sin(5*Math.PI/6), Math.cos(5*Math.PI/6), + [2 * Math.cos(5 * Math.PI / 6), Math.sin(5 * Math.PI / 6), + 2 * -Math.sin(5 * Math.PI / 6), Math.cos(5 * Math.PI / 6), 120, 100], "Unexpected result after rotateFromVector"); @@ -155,32 +146,28 @@ function testRotateFromVector() } // SVGMatrix flipX(); -function testFlipX() -{ +function testFlipX() { var m = createMatrix(1, 2, 3, 4, 5, 6); cmpMatrix(m.flipX(), [-1, -2, 3, 4, 5, 6], "Unexpected result after flipX"); } // SVGMatrix flipY(); -function testFlipY() -{ +function testFlipY() { var m = createMatrix(1, 2, 3, 4, 5, 6); cmpMatrix(m.flipY(), [1, 2, -3, -4, 5, 6], "Unexpected result after flipY"); } // SVGMatrix skewX(in float angle); -function testSkewX() -{ +function testSkewX() { var m = createMatrix(2, 0, 0, 1, 120, 100); - roughCmpMatrix(m.skewX(30), [2, 0, 2*Math.tan(Math.PI/6), 1, 120, 100], + roughCmpMatrix(m.skewX(30), [2, 0, 2 * Math.tan(Math.PI / 6), 1, 120, 100], "Unexpected result after skewX"); } // SVGMatrix skewY(in float angle); -function testSkewY() -{ +function testSkewY() { var m = createMatrix(2, 0, 0, 1, 120, 100); - roughCmpMatrix(m.skewY(30), [2, Math.tan(Math.PI/6), 0, 1, 120, 100], + roughCmpMatrix(m.skewY(30), [2, Math.tan(Math.PI / 6), 0, 1, 120, 100], "Unexpected result after skewY"); } diff --git a/dom/svg/test/test_SVGNumberList.xhtml b/dom/svg/test/test_SVGNumberList.xhtml index d56ad7c8a97a..4dcf6720ac7b 100644 --- a/dom/svg/test/test_SVGNumberList.xhtml +++ b/dom/svg/test/test_SVGNumberList.xhtml @@ -28,14 +28,13 @@ tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized to other list types belongs there. */ -function run_tests() -{ - document.getElementById('svg').pauseAnimations(); +function run_tests() { + document.getElementById("svg").pauseAnimations(); var text = document.getElementById("text"); var numbers = text.rotate.baseVal; - is(numbers.numberOfItems, 3, 'Checking numberOfItems'); + is(numbers.numberOfItems, 3, "Checking numberOfItems"); // Test mutation events // --- Initialization @@ -53,7 +52,7 @@ function run_tests() // -- Invalid attribute eventChecker.expect("modify"); text.setAttribute("rotate", ",20"); - is(numbers.numberOfItems, 0, 'Checking that parsing stops at invalid token'); + is(numbers.numberOfItems, 0, "Checking that parsing stops at invalid token"); // -- Attribute removal eventChecker.expect("remove"); text.removeAttribute("rotate"); diff --git a/dom/svg/test/test_SVGPointList.xhtml b/dom/svg/test/test_SVGPointList.xhtml index 0f9c80096939..042e2a6059d6 100644 --- a/dom/svg/test/test_SVGPointList.xhtml +++ b/dom/svg/test/test_SVGPointList.xhtml @@ -29,14 +29,13 @@ tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized to other list types belongs there. */ -function run_tests() -{ - document.getElementById('svg').pauseAnimations(); +function run_tests() { + document.getElementById("svg").pauseAnimations(); var polyline = document.getElementById("polyline"); var points = polyline.points; - is(points.numberOfItems, 2, 'Checking numberOfItems'); + is(points.numberOfItems, 2, "Checking numberOfItems"); // Test mutation events // --- Initialization @@ -54,7 +53,7 @@ function run_tests() // -- Invalid attribute eventChecker.expect("modify"); polyline.setAttribute("points", ",30,375"); - is(points.numberOfItems, 0, 'Checking that parsing stops at invalid token'); + is(points.numberOfItems, 0, "Checking that parsing stops at invalid token"); // -- Attribute removal eventChecker.expect("remove"); polyline.removeAttribute("points"); @@ -83,7 +82,7 @@ function run_tests() function appendItem(aItem) { polyline.removeAttribute("points"); return points.appendItem(aItem); - } + }, ]; subtests.forEach(function(aFunction) { // -- Adding SVGSVGElement.currentTranslate, which is the only instance diff --git a/dom/svg/test/test_SVGStringList.xhtml b/dom/svg/test/test_SVGStringList.xhtml index 571d91c4a5b3..0aafe4ab90cb 100644 --- a/dom/svg/test/test_SVGStringList.xhtml +++ b/dom/svg/test/test_SVGStringList.xhtml @@ -26,8 +26,7 @@ tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized to other list types belongs there. */ -function initializeThrowsFor(stringList, value) -{ +function initializeThrowsFor(stringList, value) { try { stringList.initialize(value); } catch (e) { @@ -36,8 +35,7 @@ function initializeThrowsFor(stringList, value) return false; } -function insertItemBeforeThrowsFor(stringList, value) -{ +function insertItemBeforeThrowsFor(stringList, value) { try { stringList.insertItemBefore(value, 0); } catch (e) { @@ -46,8 +44,7 @@ function insertItemBeforeThrowsFor(stringList, value) return false; } -function replaceItemThrowsFor(stringList, value) -{ +function replaceItemThrowsFor(stringList, value) { try { stringList.replaceItem(value, 0); } catch (e) { @@ -56,8 +53,7 @@ function replaceItemThrowsFor(stringList, value) return false; } -function appendItemThrowsFor(stringList, value) -{ +function appendItemThrowsFor(stringList, value) { try { stringList.appendItem(value); } catch (e) { @@ -66,38 +62,37 @@ function appendItemThrowsFor(stringList, value) return false; } -function run_tests() -{ +function run_tests() { var g = document.getElementById("g"); var strings = g.requiredFeatures; // sanity check: - is(strings.numberOfItems, 3, 'numberOfItems should be 3'); + is(strings.numberOfItems, 3, "numberOfItems should be 3"); ok(!initializeThrowsFor(strings, null), "SVGStringList.initialize() should not throw when passed null"); ok(initializeThrowsFor(strings, ""), "SVGStringList.initialize() should throw when passed the empty string"); - is(strings.length, 0, 'length should be 0'); + is(strings.length, 0, "length should be 0"); ok(!insertItemBeforeThrowsFor(strings, null), "SVGStringList.insertItemBefore() should not throw when passed null"); - ok(insertItemBeforeThrowsFor(strings, ""), + ok(insertItemBeforeThrowsFor(strings, ""), "SVGStringList.insertItemBefore() should throw when passed the empty string"); - is(strings.length, 1, 'length should be 1'); + is(strings.length, 1, "length should be 1"); ok(!replaceItemThrowsFor(strings, null), "SVGStringList.replaceItem() should not throw when passed null"); - ok(replaceItemThrowsFor(strings, ""), + ok(replaceItemThrowsFor(strings, ""), "SVGStringList.replaceItem() should throw when passed the empty string"); - is(strings.length, 1, 'length should be 1'); + is(strings.length, 1, "length should be 1"); ok(!appendItemThrowsFor(strings, null), "SVGStringList.appendItem() should not throw when passed null"); - ok(appendItemThrowsFor(strings, ""), + ok(appendItemThrowsFor(strings, ""), "SVGStringList.appendItem() should throw when passed the empty string"); - is(strings.length, 2, 'length should be 2'); + is(strings.length, 2, "length should be 2"); // more sanity checks: @@ -109,7 +104,7 @@ function run_tests() "SVGStringList.replaceItem() should not throw when passed a valid string"); ok(!appendItemThrowsFor(strings, "valid-string"), "SVGStringList.appendItem() should not throw when passed a valid string"); - is(strings.length, 3, 'numberOfItems should be 3'); + is(strings.length, 3, "numberOfItems should be 3"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_SVGTransformList.xhtml b/dom/svg/test/test_SVGTransformList.xhtml index 3b7af5b11d89..cb401815095f 100644 --- a/dom/svg/test/test_SVGTransformList.xhtml +++ b/dom/svg/test/test_SVGTransformList.xhtml @@ -31,9 +31,8 @@ tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized to other list types belongs there. */ -function main() -{ - var g = $('g'); +function main() { + var g = $("g"); var tests = [ testConsolidateMatrix, testConsolidateMatrixOneElem, @@ -42,7 +41,7 @@ function main() testReadOnly, testOrphan, testFailedSet, - testMutationEvents + testMutationEvents, ]; for (var i = 0; i < tests.length; i++) { tests[i](g); @@ -50,8 +49,7 @@ function main() SimpleTest.finish(); } -function testConsolidateMatrix(g) -{ +function testConsolidateMatrix(g) { // This is the example from SVG 1.1 section 7.5 g.setAttribute("transform", "translate(50 90) rotate(-45) translate(130 160)"); @@ -72,7 +70,7 @@ function testConsolidateMatrix(g) "Consolidate return value should be first item in list, not a copy"); is(consolidated.type, SVGTransform.SVG_TRANSFORM_MATRIX, "Consolidated transform not of type matrix"); - const angle = -Math.PI/4; + const angle = -Math.PI / 4; roughCmpMatrix(consolidated.matrix, [Math.cos(angle), Math.sin(angle), -Math.sin(angle), Math.cos(angle), @@ -102,8 +100,7 @@ function testConsolidateMatrix(g) "Changing list doesn't affect return value from consolidate"); } -function testConsolidateMatrixOneElem(g) -{ +function testConsolidateMatrixOneElem(g) { // Check that even if we only have one item in the list it becomes a matrix // transform (as per the spec) g.setAttribute("transform", "translate(50 90)"); @@ -126,8 +123,7 @@ function testConsolidateMatrixOneElem(g) "Unexpected consolidated matrix value"); } -function testConsolidateMatrixZeroElem(g) -{ +function testConsolidateMatrixZeroElem(g) { // Check that zero items returns null g.setAttribute("transform", ""); var list = g.transform.baseVal; @@ -137,8 +133,7 @@ function testConsolidateMatrixZeroElem(g) "consolidate() should return null for a zero-length transform list"); } -function testCreateSVGTransformFromMatrix(g) -{ +function testCreateSVGTransformFromMatrix(g) { var m = createMatrix(1, 2, 3, 4, 5, 6); // "Creates an SVGTransform object which is initialized to transform of type @@ -169,34 +164,33 @@ function testCreateSVGTransformFromMatrix(g) var exception = null; try { t = list.createSVGTransformFromMatrix(null); - } catch(e) { exception = e; } + } catch (e) { exception = e; } ok(exception, "Failed to throw for null input to createSVGTransformFromMatrix"); exception = null; try { t = list.createSVGTransformFromMatrix("undefined"); - } catch(e) { exception = e; } + } catch (e) { exception = e; } ok(exception, "Failed to throw for string input to createSVGTransformFromMatrix"); exception = null; try { t = list.createSVGTransformFromMatrix(SVGMatrix(t)); - } catch(e) { exception = e; } + } catch (e) { exception = e; } ok(exception, "Failed to throw for bad input to createSVGTransformFromMatrix"); exception = null; } -function testReadOnly(g) -{ - var SVG_NS = 'http://www.w3.org/2000/svg'; +function testReadOnly(g) { + var SVG_NS = "http://www.w3.org/2000/svg"; // Just some data to work with g.setAttribute("transform", "translate(50 90)"); // baseVal / animVal are readonly attributes // Create another (empty) transform list - var otherg = document.createElementNS(SVG_NS, 'g'); + var otherg = document.createElementNS(SVG_NS, "g"); g.parentNode.appendChild(otherg); is(g.transform.baseVal.numberOfItems, 1, "Unexpected number of items in transform list before attempting to set"); @@ -255,7 +249,7 @@ function testReadOnly(g) threw = false; try { roTransform.setTranslate(2, 3); - } catch(e) { + } catch (e) { threw = true; } ok(threw, "Failed to throw when calling setTranslate on read-only" @@ -264,7 +258,7 @@ function testReadOnly(g) threw = false; try { roTransform.setScale(2, 3); - } catch(e) { + } catch (e) { threw = true; } ok(threw, "Failed to throw when calling setScale on read-only transform"); @@ -272,7 +266,7 @@ function testReadOnly(g) threw = false; try { roTransform.setRotate(1, 2, 3); - } catch(e) { + } catch (e) { threw = true; } ok(threw, "Failed to throw when calling setRotate on read-only transform"); @@ -280,7 +274,7 @@ function testReadOnly(g) threw = false; try { roTransform.setSkewX(2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, "Failed to throw when calling setSkewX on read-only transform"); @@ -288,7 +282,7 @@ function testReadOnly(g) threw = false; try { roTransform.setSkewY(2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, "Failed to throw when calling setSkewY on read-only transform"); @@ -310,8 +304,7 @@ function testReadOnly(g) ok(threw, "Failed to throw exception when modifying read-only matrix"); } -function testOrphan(g) -{ +function testOrphan(g) { // Although this isn't defined, if a read-only object becomes orphaned // (detached from it's parent), then presumably it should become editable // again. @@ -330,10 +323,10 @@ function testOrphan(g) var exception = null; try { roTransform.setTranslate(5, 3); - } catch(e) { + } catch (e) { exception = e; } - ok(exception===null, + ok(exception === null, "Unexpected exception " + exception + " modifying orphaned transform"); uexception = null; @@ -341,15 +334,14 @@ function testOrphan(g) exception = null; try { roMatrix.a = 1; - } catch(e) { + } catch (e) { exception = e; } - ok(exception===null, + ok(exception === null, "Unexpected exception " + exception + " modifying orphaned matrix"); } -function testFailedSet(g) -{ +function testFailedSet(g) { // Check that a parse failure results in the attribute being empty // Set initial value @@ -365,8 +357,7 @@ function testFailedSet(g) "Animated transform list should also be empty after setting bad value"); } -function testMutationEvents(g) -{ +function testMutationEvents(g) { // Check mutation events // Set initial value @@ -390,7 +381,7 @@ function testMutationEvents(g) // transform.setMatrix eventChecker.expect("modify"); - var mx = $('svg').createSVGMatrix(); + var mx = $("svg").createSVGMatrix(); list[0].setMatrix(mx); list[0].setMatrix(mx); diff --git a/dom/svg/test/test_SVGTransformListAddition.xhtml b/dom/svg/test/test_SVGTransformListAddition.xhtml index f852d8feff64..a54f7f703da0 100644 --- a/dom/svg/test/test_SVGTransformListAddition.xhtml +++ b/dom/svg/test/test_SVGTransformListAddition.xhtml @@ -28,71 +28,68 @@ This file runs a series of tests specific to addition of SVGTransformList in animation. */ -function AdditionTestCase(desc, baseVal, animSpecs, expectedTransformList) -{ +function AdditionTestCase(desc, baseVal, animSpecs, expectedTransformList) { this.desc = desc; this.baseVal = baseVal; this.animSpecs = animSpecs; this.expectedTransformList = expectedTransformList; } -function Transform(type, angle) -{ +function Transform(type, angle) { this.type = type; this.angle = angle; } -function main(g) -{ +function main(g) { var cases = [ new AdditionTestCase("Not additive", "translate(150 50)", - {type: 'rotate', from: '0', to: '90'}, + {type: "rotate", from: "0", to: "90"}, [new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90)] ), new AdditionTestCase("To animation", "rotate(-90)", - {type: 'rotate', to: '90'}, + {type: "rotate", to: "90"}, [new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90)] ), new AdditionTestCase("By animation", "rotate(-90)", - {type: 'rotate', by: '180'}, + {type: "rotate", by: "180"}, [new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, -90), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 180)] ), new AdditionTestCase("Normal additive: same type", "rotate(45)", - {type: 'rotate', from: '0', to: '45', additive: 'sum'}, + {type: "rotate", from: "0", to: "45", additive: "sum"}, [new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45)] ), new AdditionTestCase("Normal additive: different type", "translate(50)", - {type: 'rotate', from: '0', to: '90', additive: 'sum'}, + {type: "rotate", from: "0", to: "90", additive: "sum"}, [new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90)] ), new AdditionTestCase("Stacked additive: same type", "rotate(-90)", - [{type: 'rotate', from: '0', to: '90', additive: 'sum'}, - {type: 'rotate', from: '0', to: '90', additive: 'sum'}], + [{type: "rotate", from: "0", to: "90", additive: "sum"}, + {type: "rotate", from: "0", to: "90", additive: "sum"}], [new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, -90), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90)] ), new AdditionTestCase("Stacked additive: different types #1", "translate(50)", - [{type: 'rotate', from: '0', to: '45', additive: 'sum'}, - {type: 'rotate', from: '0', to: '45', additive: 'sum'}], + [{type: "rotate", from: "0", to: "45", additive: "sum"}, + {type: "rotate", from: "0", to: "45", additive: "sum"}], [new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45)] ), new AdditionTestCase("Stacked additive: different types #2", "skewX(20) translate(50)", - [{type: 'rotate', from: '0', to: '45', additive: 'sum'}, - {type: 'rotate', from: '0', to: '45', additive: 'sum'}], + [{type: "rotate", from: "0", to: "45", additive: "sum"}, + {type: "rotate", from: "0", to: "45", additive: "sum"}], [new Transform(SVGTransform.SVG_TRANSFORM_SKEWX, 20), new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45), @@ -100,10 +97,10 @@ function main(g) ), new AdditionTestCase("Stacked additive: different types #3", "skewX(20) translate(50)", - [{type: 'rotate', from: '0', to: '45', additive: 'sum'}, - {type: 'translate', from: '0', to: '30', additive: 'sum'}, - {type: 'translate', from: '0', to: '-30', additive: 'sum'}, - {type: 'rotate', from: '0', to: '45', additive: 'sum'}], + [{type: "rotate", from: "0", to: "45", additive: "sum"}, + {type: "translate", from: "0", to: "30", additive: "sum"}, + {type: "translate", from: "0", to: "-30", additive: "sum"}, + {type: "rotate", from: "0", to: "45", additive: "sum"}], [new Transform(SVGTransform.SVG_TRANSFORM_SKEWX, 20), new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0), new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45), @@ -113,29 +110,28 @@ function main(g) ), new AdditionTestCase("Base value with rotation around a centre", "rotate(90 50 50)", - {type: 'translate', from: '0 0', to: '0 -50', additive: 'sum'}, + {type: "translate", from: "0 0", to: "0 -50", additive: "sum"}, [new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90), new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0)] ), ]; for (var i = 0; i < cases.length; i++) { - runAdditionTestCase(cases[i], $('g'), $('svg')); + runAdditionTestCase(cases[i], $("g"), $("svg")); } SimpleTest.finish(); } -function runAdditionTestCase(test, elem, svg) -{ +function runAdditionTestCase(test, elem, svg) { var anims = createAnims(test.animSpecs); - elem.setAttribute('transform', test.baseVal); + elem.setAttribute("transform", test.baseVal); elem.appendChild(anims); svg.setCurrentTime(1); var expected = test.expectedTransformList; // Array of Transform objects - var actual = elem.transform.animVal; // SVGTransformList + var actual = elem.transform.animVal; // SVGTransformList is(actual.numberOfItems, expected.length, "Unexpected number of transforms"); @@ -143,7 +139,7 @@ function runAdditionTestCase(test, elem, svg) for (var i = 0; i < actual.numberOfItems; i++) { var transform = actual.getItem(i); var testDesc = " for transform " + i + " in '" + test.desc + "' test"; - is(transform.type, expected[i].type, + is(transform.type, expected[i].type, "Unexpected transform type" + testDesc); is(transform.angle, expected[i].angle, "Unexpected transform angle" + testDesc); @@ -156,8 +152,7 @@ function runAdditionTestCase(test, elem, svg) } } -function createAnims(specs) -{ +function createAnims(specs) { if (specs.constructor == Array) { var frag = document.createDocumentFragment(); for (var i = 0; i < specs.length; ++i) { @@ -169,13 +164,12 @@ function createAnims(specs) return createAnim(specs); } -function createAnim(attrs) -{ - var SVG_NS = 'http://www.w3.org/2000/svg'; - var anim = document.createElementNS(SVG_NS, 'animateTransform'); - anim.setAttribute('attributeName', 'transform'); - anim.setAttribute('dur', '1s'); - anim.setAttribute('fill', 'freeze'); +function createAnim(attrs) { + var SVG_NS = "http://www.w3.org/2000/svg"; + var anim = document.createElementNS(SVG_NS, "animateTransform"); + anim.setAttribute("attributeName", "transform"); + anim.setAttribute("dur", "1s"); + anim.setAttribute("fill", "freeze"); for (attr in attrs) { anim.setAttribute(attr, attrs[attr]); } diff --git a/dom/svg/test/test_SVG_namespace_ids.html b/dom/svg/test/test_SVG_namespace_ids.html index 60726718256c..f93369989426 100644 --- a/dom/svg/test/test_SVG_namespace_ids.html +++ b/dom/svg/test/test_SVG_namespace_ids.html @@ -11,15 +11,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589640 SimpleTest.waitForExplicitFinish(); function debug(message) { - document.getElementById('debug').appendChild(document.createTextNode(message + "\n")); + document.getElementById("debug").appendChild(document.createTextNode(message + "\n")); } - function runTests() - { - var svg = document.getElementById('svg1'); + function runTests() { + var svg = document.getElementById("svg1"); for (var el = 0; el < svg.children.length; el++) { is(svg.children[el].id, svg.children[el].localName, svg.children[el].localName + " in the SVG namespace has a valid ID"); - debug(svg.children[el].localName + '.id = ' + svg.children[el].id); + debug(svg.children[el].localName + ".id = " + svg.children[el].id); } SimpleTest.finish(); diff --git a/dom/svg/test/test_SVGxxxList.xhtml b/dom/svg/test/test_SVGxxxList.xhtml index 1aded67670cb..8145da5f114c 100644 --- a/dom/svg/test/test_SVGxxxList.xhtml +++ b/dom/svg/test/test_SVGxxxList.xhtml @@ -93,180 +93,180 @@ To have the battery of generic tests run for a new list attribute, add an elemen property is omitted, it is assumed that we can just compare "item.value" (which is the case for most list types). */ -//helper method +// helper method function keys(obj) { var rval = []; for (var prop in obj) { rval.push(prop); } return rval; -}; +} var tests = [ { // SVGLengthList test: - target_element_id: 'text', - attr_name: 'x', - prop_name: 'x', - bv_name: 'baseVal', - av_name: 'animVal', - el_type: 'SVGTextElement', - prop_type: 'SVGAnimatedLengthList', - list_type: 'SVGLengthList', - item_type: 'SVGLength', - attr_val_3a: '10 20ex, 30in', - attr_val_3b: '30in 10, 20ex', - attr_val_4 : '10 20ex, 30in ,40cm', - attr_val_5a: '10 20ex, 30in ,40cm , 50%', - attr_val_5b: '20 50%, 20ex ,30in , 40cm', - attr_val_5b_firstItem_x3_constructor: function(constructor) { + target_element_id: "text", + attr_name: "x", + prop_name: "x", + bv_name: "baseVal", + av_name: "animVal", + el_type: "SVGTextElement", + prop_type: "SVGAnimatedLengthList", + list_type: "SVGLengthList", + item_type: "SVGLength", + attr_val_3a: "10 20ex, 30in", + attr_val_3b: "30in 10, 20ex", + attr_val_4: "10 20ex, 30in ,40cm", + attr_val_5a: "10 20ex, 30in ,40cm , 50%", + attr_val_5b: "20 50%, 20ex ,30in , 40cm", + attr_val_5b_firstItem_x3_constructor(constructor) { var expected = constructor(); expected.value = 60; return expected; }, - item_constructor: function() { + item_constructor() { // We need this function literal to avoid "Illegal operation on // WrappedNative prototype object" NS_ERROR_XPC_BAD_OP_ON_WN_PROTO. - return document.getElementById('svg').createSVGLength(); - } + return document.getElementById("svg").createSVGLength(); + }, }, { // SVGNumberList test: - target_element_id: 'text', - attr_name: 'rotate', - prop_name: 'rotate', - bv_name: 'baseVal', - av_name: 'animVal', - el_type: 'SVGTextElement', - prop_type: 'SVGAnimatedNumberList', - list_type: 'SVGNumberList', - item_type: 'SVGNumber', - attr_val_3a: '0 20 40', - attr_val_3b: '60 40 20', - attr_val_4 : '40 20 10 80', - attr_val_5a: '90 30 60 20 70', - attr_val_5b: '30 20 70 30 90', - attr_val_5b_firstItem_x3_constructor: function(constructor) { + target_element_id: "text", + attr_name: "rotate", + prop_name: "rotate", + bv_name: "baseVal", + av_name: "animVal", + el_type: "SVGTextElement", + prop_type: "SVGAnimatedNumberList", + list_type: "SVGNumberList", + item_type: "SVGNumber", + attr_val_3a: "0 20 40", + attr_val_3b: "60 40 20", + attr_val_4: "40 20 10 80", + attr_val_5a: "90 30 60 20 70", + attr_val_5b: "30 20 70 30 90", + attr_val_5b_firstItem_x3_constructor(constructor) { var expected = constructor(); expected.value = 90; return expected; }, - item_constructor: function() { + item_constructor() { // We need this function literal to avoid "Illegal operation on // WrappedNative prototype object" NS_ERROR_XPC_BAD_OP_ON_WN_PROTO. - return document.getElementById('svg').createSVGNumber(); - } + return document.getElementById("svg").createSVGNumber(); + }, }, { // SVGNumberList test: - target_element_id: 'feFuncR', - attr_name: 'tableValues', - prop_name: 'tableValues', - bv_name: 'baseVal', - av_name: 'animVal', - el_type: 'SVGFEComponentTransferElement', - prop_type: 'SVGAnimatedNumberList', - list_type: 'SVGNumberList', - item_type: 'SVGNumber', - attr_val_3a: '0 .5 .2', - attr_val_3b: '1 .7 .1', - attr_val_4 : '.5 .3 .8 .2', - attr_val_5a: '3 4 5 6 7', - attr_val_5b: '7 6 5 4 3', - attr_val_5b_firstItem_x3_constructor: function(constructor) { + target_element_id: "feFuncR", + attr_name: "tableValues", + prop_name: "tableValues", + bv_name: "baseVal", + av_name: "animVal", + el_type: "SVGFEComponentTransferElement", + prop_type: "SVGAnimatedNumberList", + list_type: "SVGNumberList", + item_type: "SVGNumber", + attr_val_3a: "0 .5 .2", + attr_val_3b: "1 .7 .1", + attr_val_4: ".5 .3 .8 .2", + attr_val_5a: "3 4 5 6 7", + attr_val_5b: "7 6 5 4 3", + attr_val_5b_firstItem_x3_constructor(constructor) { var expected = constructor(); expected.value = 21; return expected; }, - item_constructor: function() { + item_constructor() { // We need this function literal to avoid "Illegal operation on // WrappedNative prototype object" NS_ERROR_XPC_BAD_OP_ON_WN_PROTO. - return document.getElementById('svg').createSVGNumber(); - } + return document.getElementById("svg").createSVGNumber(); + }, }, { // SVGPointList test: - target_element_id: 'polyline', - attr_name: 'points', + target_element_id: "polyline", + attr_name: "points", prop_name: null, // SVGAnimatedPoints is an inherited interface! - bv_name: 'points', - av_name: 'animatedPoints', - el_type: 'SVGPolylineElement', + bv_name: "points", + av_name: "animatedPoints", + el_type: "SVGPolylineElement", prop_type: null, - list_type: 'SVGPointList', - item_type: 'SVGPoint', - attr_val_3a: ' 10,10 50,50 90,10 ', - attr_val_3b: ' 10,50 50,10 90,50 ', - attr_val_4 : ' 10,10 50,50 90,10 200,100 ', - attr_val_5a: ' 10,10 50,50 90,10 130,50 170,10 ', - attr_val_5b: ' 50,10 50,10 90,50 130,10 170,50 ', - attr_val_5b_firstItem_x3_constructor: function(constructor) { + list_type: "SVGPointList", + item_type: "SVGPoint", + attr_val_3a: " 10,10 50,50 90,10 ", + attr_val_3b: " 10,50 50,10 90,50 ", + attr_val_4: " 10,10 50,50 90,10 200,100 ", + attr_val_5a: " 10,10 50,50 90,10 130,50 170,10 ", + attr_val_5b: " 50,10 50,10 90,50 130,10 170,50 ", + attr_val_5b_firstItem_x3_constructor(constructor) { var expected = constructor(); expected.x = 150; expected.y = 30; return expected; }, - item_constructor: function() { + item_constructor() { // XXX return different values each time - return document.getElementById('svg').createSVGPoint(); + return document.getElementById("svg").createSVGPoint(); }, - item_is: function(itemA, itemB, message) { - ok(typeof(itemA.x) != 'undefined' && - typeof(itemB.x) != 'undefined', - 'expecting x property'); - ok(typeof(itemA.y) != 'undefined' && - typeof(itemB.y) != 'undefined', - 'expecting y property'); + item_is(itemA, itemB, message) { + ok(typeof(itemA.x) != "undefined" && + typeof(itemB.x) != "undefined", + "expecting x property"); + ok(typeof(itemA.y) != "undefined" && + typeof(itemB.y) != "undefined", + "expecting y property"); is(itemA.x, itemB.x, message); is(itemA.y, itemB.y, message); - } + }, }, { // SVGStringList test: - target_element_id: 'g', - attr_name: 'requiredFeatures', // requiredExtensions, systemLanguage, viewTarget + target_element_id: "g", + attr_name: "requiredFeatures", // requiredExtensions, systemLanguage, viewTarget prop_name: null, // SVGStringList attributes are not animatable - bv_name: 'requiredFeatures', + bv_name: "requiredFeatures", av_name: null, - el_type: 'SVGGElement', + el_type: "SVGGElement", prop_type: null, - list_type: 'SVGStringList', - item_type: 'DOMString', - attr_val_3a: 'http://www.w3.org/TR/SVG11/feature#Shape http://www.w3.org/TR/SVG11/feature#Image ' + - 'http://www.w3.org/TR/SVG11/feature#Style', - attr_val_3b: 'http://www.w3.org/TR/SVG11/feature#CoreAttribute http://www.w3.org/TR/SVG11/feature#Structure ' + - 'http://www.w3.org/TR/SVG11/feature#Gradient', - attr_val_4 : 'http://www.w3.org/TR/SVG11/feature#Pattern http://www.w3.org/TR/SVG11/feature#Clip ' + - 'http://www.w3.org/TR/SVG11/feature#Mask http://www.w3.org/TR/SVG11/feature#Extensibility', - attr_val_5a: 'http://www.w3.org/TR/SVG11/feature#BasicStructure http://www.w3.org/TR/SVG11/feature#BasicText ' + - 'http://www.w3.org/TR/SVG11/feature#BasicPaintAttribute http://www.w3.org/TR/SVG11/feature#BasicGraphicsAttribute ' + - 'http://www.w3.org/TR/SVG11/feature#BasicClip', - attr_val_5b: 'http://www.w3.org/TR/SVG11/feature#DocumentEventsAttribute http://www.w3.org/TR/SVG11/feature#GraphicalEventsAttribute ' + - 'http://www.w3.org/TR/SVG11/feature#AnimationEventsAttribute http://www.w3.org/TR/SVG11/feature#Hyperlinking ' + - 'http://www.w3.org/TR/SVG11/feature#XlinkAttribute', - item_constructor: function() { - return 'http://www.w3.org/TR/SVG11/feature#XlinkAttribute'; - } + list_type: "SVGStringList", + item_type: "DOMString", + attr_val_3a: "http://www.w3.org/TR/SVG11/feature#Shape http://www.w3.org/TR/SVG11/feature#Image " + + "http://www.w3.org/TR/SVG11/feature#Style", + attr_val_3b: "http://www.w3.org/TR/SVG11/feature#CoreAttribute http://www.w3.org/TR/SVG11/feature#Structure " + + "http://www.w3.org/TR/SVG11/feature#Gradient", + attr_val_4: "http://www.w3.org/TR/SVG11/feature#Pattern http://www.w3.org/TR/SVG11/feature#Clip " + + "http://www.w3.org/TR/SVG11/feature#Mask http://www.w3.org/TR/SVG11/feature#Extensibility", + attr_val_5a: "http://www.w3.org/TR/SVG11/feature#BasicStructure http://www.w3.org/TR/SVG11/feature#BasicText " + + "http://www.w3.org/TR/SVG11/feature#BasicPaintAttribute http://www.w3.org/TR/SVG11/feature#BasicGraphicsAttribute " + + "http://www.w3.org/TR/SVG11/feature#BasicClip", + attr_val_5b: "http://www.w3.org/TR/SVG11/feature#DocumentEventsAttribute http://www.w3.org/TR/SVG11/feature#GraphicalEventsAttribute " + + "http://www.w3.org/TR/SVG11/feature#AnimationEventsAttribute http://www.w3.org/TR/SVG11/feature#Hyperlinking " + + "http://www.w3.org/TR/SVG11/feature#XlinkAttribute", + item_constructor() { + return "http://www.w3.org/TR/SVG11/feature#XlinkAttribute"; + }, }, { // SVGTransformList test: - target_element_id: 'g', - attr_name: 'transform', // gradientTransform, patternTransform - prop_name: 'transform', - bv_name: 'baseVal', - av_name: 'animVal', - el_type: 'SVGGElement', - prop_type: 'SVGAnimatedTransformList', - list_type: 'SVGTransformList', - item_type: 'SVGTransform', - attr_val_3a: 'translate(20 10) rotate(90 10 10) skewX(45)', - attr_val_3b: 'translate(30 40) scale(2) matrix(1 2 3 4 5 6)', - attr_val_4 : 'scale(3 2) translate(19) skewY(2) rotate(-10)', + target_element_id: "g", + attr_name: "transform", // gradientTransform, patternTransform + prop_name: "transform", + bv_name: "baseVal", + av_name: "animVal", + el_type: "SVGGElement", + prop_type: "SVGAnimatedTransformList", + list_type: "SVGTransformList", + item_type: "SVGTransform", + attr_val_3a: "translate(20 10) rotate(90 10 10) skewX(45)", + attr_val_3b: "translate(30 40) scale(2) matrix(1 2 3 4 5 6)", + attr_val_4: "scale(3 2) translate(19) skewY(2) rotate(-10)", attr_val_5a: - 'translate(20) rotate(-10) skewY(3) matrix(1 2 3 4 5 6) scale(0.5)', + "translate(20) rotate(-10) skewY(3) matrix(1 2 3 4 5 6) scale(0.5)", attr_val_5b: - 'skewX(45) rotate(45 -10 -10) skewX(-45) scale(2) matrix(6 5 4 3 2 1)', + "skewX(45) rotate(45 -10 -10) skewX(-45) scale(2) matrix(6 5 4 3 2 1)", // SVGTransformList animation addition is tested in // test_SVGTransformListAddition.xhtml so we don't need: // - attr_val_3b @@ -275,25 +275,25 @@ var tests = [ // But we populate the first two anyway just in case they are later used for // something other than testing animation. // attr_val_5b_firstItem_x3_constructor is only used for animation - item_constructor: function() { + item_constructor() { // XXX populate the matrix with different values each time - return document.getElementById('svg').createSVGTransform(); + return document.getElementById("svg").createSVGTransform(); }, - item_is: function(itemA, itemB, message) { - ok(typeof(itemA.type) != 'undefined' && - typeof(itemB.type) != 'undefined', - 'expecting type property'); - ok(typeof(itemA.matrix) != 'undefined' && - typeof(itemB.matrix) != 'undefined', - 'expecting matrix property'); - ok(typeof(itemA.angle) != 'undefined' && - typeof(itemB.angle) != 'undefined', - 'expecting matrix property'); + item_is(itemA, itemB, message) { + ok(typeof(itemA.type) != "undefined" && + typeof(itemB.type) != "undefined", + "expecting type property"); + ok(typeof(itemA.matrix) != "undefined" && + typeof(itemB.matrix) != "undefined", + "expecting matrix property"); + ok(typeof(itemA.angle) != "undefined" && + typeof(itemB.angle) != "undefined", + "expecting matrix property"); is(itemA.type, itemB.type, message); is(itemA.angle, itemB.angle, message); cmpMatrix(itemA.matrix, itemB.matrix, message); - } + }, }, ]; @@ -318,9 +318,8 @@ At t=0s and t=1s we test the effect of an attribute value changes in the absence At t=10s we programmatically remove the fill="freeze" from animation 1. */ -function create_animate_elements(test) -{ - var SVG_NS = 'http://www.w3.org/2000/svg'; +function create_animate_elements(test) { + var SVG_NS = "http://www.w3.org/2000/svg"; var df = document.createDocumentFragment(); if (is_transform_attr(test.attr_name)) { @@ -332,46 +331,45 @@ function create_animate_elements(test) return df; // Return the empty document fragment } - var animate1 = document.createElementNS(SVG_NS, 'animate'); - var animate2 = document.createElementNS(SVG_NS, 'animate'); - var animate3 = document.createElementNS(SVG_NS, 'animate'); + var animate1 = document.createElementNS(SVG_NS, "animate"); + var animate2 = document.createElementNS(SVG_NS, "animate"); + var animate3 = document.createElementNS(SVG_NS, "animate"); - animate1.setAttribute('attributeName', test.attr_name); - animate1.setAttribute('from', test.attr_val_5a); - animate1.setAttribute('to', test.attr_val_5b); - animate1.setAttribute('begin', '1s'); - animate1.setAttribute('dur', '4s'); - animate1.setAttribute('repeatCount', '3'); - animate1.setAttribute('accumulate', 'sum'); - animate1.setAttribute('fill', 'freeze'); + animate1.setAttribute("attributeName", test.attr_name); + animate1.setAttribute("from", test.attr_val_5a); + animate1.setAttribute("to", test.attr_val_5b); + animate1.setAttribute("begin", "1s"); + animate1.setAttribute("dur", "4s"); + animate1.setAttribute("repeatCount", "3"); + animate1.setAttribute("accumulate", "sum"); + animate1.setAttribute("fill", "freeze"); df.appendChild(animate1); - animate2.setAttribute('attributeName', test.attr_name); - animate2.setAttribute('from', test.attr_val_3a); - animate2.setAttribute('to', test.attr_val_3b); - animate2.setAttribute('begin', '2s'); - animate2.setAttribute('dur', '1s'); + animate2.setAttribute("attributeName", test.attr_name); + animate2.setAttribute("from", test.attr_val_3a); + animate2.setAttribute("to", test.attr_val_3b); + animate2.setAttribute("begin", "2s"); + animate2.setAttribute("dur", "1s"); df.appendChild(animate2); - animate3.setAttribute('attributeName', test.attr_name); - animate3.setAttribute('from', test.attr_val_3a); - animate3.setAttribute('to', test.attr_val_3b); - animate3.setAttribute('begin', '7s'); - animate3.setAttribute('dur', '1s'); - animate3.setAttribute('additive', 'sum'); + animate3.setAttribute("attributeName", test.attr_name); + animate3.setAttribute("from", test.attr_val_3a); + animate3.setAttribute("to", test.attr_val_3b); + animate3.setAttribute("begin", "7s"); + animate3.setAttribute("dur", "1s"); + animate3.setAttribute("additive", "sum"); df.appendChild(animate3); return df; } function is_transform_attr(attr_name) { - return attr_name == 'transform' || - attr_name == 'gradientTransform' || - attr_name == 'patternTransform'; + return attr_name == "transform" || + attr_name == "gradientTransform" || + attr_name == "patternTransform"; } -function get_array_of_list_items(list) -{ +function get_array_of_list_items(list) { array = []; for (var i = 0; i < list.numberOfItems; ++i) { array.push(list.getItem(i)); @@ -395,34 +393,32 @@ function get_array_of_list_items(list) * * @param t A test from the 'tests' array. */ -function run_baseVal_API_tests() -{ +function run_baseVal_API_tests() { var res, threw, items; var eventChecker = new MutationEventChecker; for (var t of tests) { - // Test .clear(): t.element.setAttribute(t.attr_name, t.attr_val_4); is(t.baseVal.numberOfItems, 4, - 'The '+t.list_type+' object should contain four list items.'); + "The " + t.list_type + " object should contain four list items."); eventChecker.watchAttr(t.element, t.attr_name); eventChecker.expect("modify"); res = t.baseVal.clear(); is(t.baseVal.numberOfItems, 0, - 'The method '+t.list_type+'.clear() should clear the '+t.list_type+ - ' object.'); + "The method " + t.list_type + ".clear() should clear the " + t.list_type + + " object."); is(res, undefined, - 'The method '+t.list_type+'.clear() should not return a value.'); + "The method " + t.list_type + ".clear() should not return a value."); ok(t.element.hasAttribute(t.attr_name), - 'The method '+t.list_type+'.clear() should not remove the attribute.'); + "The method " + t.list_type + ".clear() should not remove the attribute."); ok(t.element.getAttribute(t.attr_name) === "", - 'Cleared '+t.attr_name+' ('+t.list_type+') but did not get an '+ - 'empty string back.'); + "Cleared " + t.attr_name + " (" + t.list_type + ") but did not get an " + + "empty string back."); eventChecker.expect(""); t.baseVal.clear(); @@ -432,18 +428,18 @@ function run_baseVal_API_tests() t.element.setAttribute(t.attr_name, ""); ok(t.element.getAttribute(t.attr_name) === "", - 'Set an empty attribute value for '+t.attr_name+' ('+t.list_type+ - ') but did not get an empty string back.'); + "Set an empty attribute value for " + t.attr_name + " (" + t.list_type + + ") but did not get an empty string back."); // Test removed attributes t.element.removeAttribute(t.attr_name); ok(t.element.getAttribute(t.attr_name) === null, - 'Removed attribute value for '+t.attr_name+' ('+t.list_type+ - ') but did not get null back.'); + "Removed attribute value for " + t.attr_name + " (" + t.list_type + + ") but did not get null back."); ok(!t.element.hasAttribute(t.attr_name), - 'Removed attribute value for '+t.attr_name+' ('+t.list_type+ - ') but hasAttribute still returns true.'); + "Removed attribute value for " + t.attr_name + " (" + t.list_type + + ") but hasAttribute still returns true."); // Test .initialize(): @@ -462,17 +458,17 @@ function run_baseVal_API_tests() is(t.baseVal.numberOfItems, 1, - 'The '+t.list_type+' object should contain one list item.'); + "The " + t.list_type + " object should contain one list item."); ok(res === item, - 'The list item returned by '+t.list_type+'.initialize() should be the '+ - 'exact same object as the item that was passed to that method, since '+ - 'the item that was passed to that method did not already belong to a '+ - 'list.'); + "The list item returned by " + t.list_type + ".initialize() should be the " + + "exact same object as the item that was passed to that method, since " + + "the item that was passed to that method did not already belong to a " + + "list."); ok(t.baseVal.getItem(0) === item, - 'The list item at index 0 should be the exact same object as the '+ - 'object that was passed to the '+t.list_type+'.initialize() method, '+ - 'since the item that was passed to that method did not already '+ - 'belong to a list.'); + "The list item at index 0 should be the exact same object as the " + + "object that was passed to the " + t.list_type + ".initialize() method, " + + "since the item that was passed to that method did not already " + + "belong to a list."); t.element.setAttribute(t.attr_name, t.attr_val_4); @@ -485,8 +481,8 @@ function run_baseVal_API_tests() t.baseVal.getItem(0) !== item && t.baseVal.getItem(0) !== old_items[0] && res === t.baseVal.getItem(0), - 'The method '+t.list_type+'.initialize() should clone the object that '+ - 'is passed in if that object is already in a list.'); + "The method " + t.list_type + ".initialize() should clone the object that " + + "is passed in if that object is already in a list."); // [SVGWG issue] not what the spec currently says @@ -495,20 +491,20 @@ function run_baseVal_API_tests() ok(res !== item && t.baseVal.getItem(0) !== item, - 'The method '+t.list_type+'.initialize() should clone the object that '+ - 'is passed in, even if that object is the only item in that list.'); + "The method " + t.list_type + ".initialize() should clone the object that " + + "is passed in, even if that object is the only item in that list."); // [SVGWG issue] not what the spec currently says eventChecker.expect(""); threw = false; try { t.baseVal.initialize({}); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.initialize() should throw if passed an '+ - 'object of the wrong type.'); + "The method " + t.list_type + ".initialize() should throw if passed an " + + "object of the wrong type."); eventChecker.ignoreEvents(); } @@ -523,42 +519,42 @@ function run_baseVal_API_tests() eventChecker.ignoreEvents(); is(t.baseVal.numberOfItems, 5, - 'The '+t.list_type+' object should contain five list items.'); + "The " + t.list_type + " object should contain five list items."); ok(res === item, - 'The list item returned by '+t.list_type+'.insertItemBefore() should '+ - 'be the exact same object as the item that was passed to that method, '+ - 'since the item that was passed to that method did not already belong '+ - 'to a list.'); + "The list item returned by " + t.list_type + ".insertItemBefore() should " + + "be the exact same object as the item that was passed to that method, " + + "since the item that was passed to that method did not already belong " + + "to a list."); ok(t.baseVal.getItem(2) === item, - 'The list item at index 2 should be the exact same object as the '+ - 'object that was passed to the '+t.list_type+'.insertItemBefore() '+ - 'method, since the item that was passed to that method did not '+ - 'already belong to a list.'); + "The list item at index 2 should be the exact same object as the " + + "object that was passed to the " + t.list_type + ".insertItemBefore() " + + "method, since the item that was passed to that method did not " + + "already belong to a list."); ok(t.baseVal.getItem(3) === old_items[2], - 'The list item that was at index 2 should be at index 3 after '+ - 'inserting a new item at index 2 using the '+t.list_type+ - '.insertItemBefore() method.'); + "The list item that was at index 2 should be at index 3 after " + + "inserting a new item at index 2 using the " + t.list_type + + ".insertItemBefore() method."); item = t.item_constructor(); t.baseVal.insertItemBefore(item, 100); ok(t.baseVal.getItem(5) === item, - 'When the index passed to the '+t.list_type+'.insertItemBefore() '+ - 'method is out of bounds, the supplied list item should be appended '+ - 'to the list.'); + "When the index passed to the " + t.list_type + ".insertItemBefore() " + + "method is out of bounds, the supplied list item should be appended " + + "to the list."); item = t.baseVal.getItem(4); res = t.baseVal.insertItemBefore(item, 2); is(t.baseVal.numberOfItems, 7, - 'The '+t.list_type+' object should contain seven list items.'); + "The " + t.list_type + " object should contain seven list items."); if (t.item_type != "DOMString") { ok(res !== item && t.baseVal.getItem(2) !== item && t.baseVal.getItem(2) !== old_items[2] && res === t.baseVal.getItem(2), - 'The method '+t.list_type+'.insertItemBefore() should clone the '+ - 'object that is passed in if that object is already in a list.'); + "The method " + t.list_type + ".insertItemBefore() should clone the " + + "object that is passed in if that object is already in a list."); // [SVGWG issue] not what the spec currently says } @@ -566,25 +562,25 @@ function run_baseVal_API_tests() res = t.baseVal.insertItemBefore(item, 2); is(t.baseVal.numberOfItems, 8, - 'The '+t.list_type+' object should contain eight list items.'); + "The " + t.list_type + " object should contain eight list items."); if (t.item_type != "DOMString") { ok(res !== item && t.baseVal.getItem(2) !== item, - 'The method '+t.list_type+'.insertItemBefore() should clone the '+ - 'object that is passed in, even if that object is the item in '+ - 'the list at the index specified.'); + "The method " + t.list_type + ".insertItemBefore() should clone the " + + "object that is passed in, even if that object is the item in " + + "the list at the index specified."); // [SVGWG issue] not what the spec currently says eventChecker.expect(""); threw = false; try { t.baseVal.insertItemBefore({}, 2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.insertItemBefore() should throw if passed '+ - 'an object of the wrong type.'); + "The method " + t.list_type + ".insertItemBefore() should throw if passed " + + "an object of the wrong type."); eventChecker.ignoreEvents(); } @@ -599,23 +595,23 @@ function run_baseVal_API_tests() eventChecker.ignoreEvents(); is(t.baseVal.numberOfItems, 4, - 'The '+t.list_type+' object should contain four list items.'); + "The " + t.list_type + " object should contain four list items."); if (t.item_type != "DOMString") { ok(res === item, - 'The list item returned by '+t.list_type+'.replaceItem() should be '+ - 'the exact same object as the item that was passed to that method, '+ - 'since the item that was passed to that method did not already belong '+ - 'to a list.'); + "The list item returned by " + t.list_type + ".replaceItem() should be " + + "the exact same object as the item that was passed to that method, " + + "since the item that was passed to that method did not already belong " + + "to a list."); } ok(t.baseVal.getItem(2) === item, - 'The list item at index 2 should be the exact same object as the '+ - 'object that was passed to the '+t.list_type+'.replaceItem() method, '+ - 'since the item that was passed to that method did not already belong '+ - 'to a list.'); + "The list item at index 2 should be the exact same object as the " + + "object that was passed to the " + t.list_type + ".replaceItem() method, " + + "since the item that was passed to that method did not already belong " + + "to a list."); ok(t.baseVal.getItem(3) === old_items[3], - 'The list item that was at index 3 should still be at index 3 after '+ - 'the item at index 2 was replaced using the '+t.list_type+ - '.replaceItem() method.'); + "The list item that was at index 3 should still be at index 3 after " + + "the item at index 2 was replaced using the " + t.list_type + + ".replaceItem() method."); item = t.item_constructor(); @@ -623,12 +619,12 @@ function run_baseVal_API_tests() threw = false; try { t.baseVal.replaceItem(item, 100); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.replaceItem() should throw if passed '+ - 'an index that is out of bounds.'); + "The method " + t.list_type + ".replaceItem() should throw if passed " + + "an index that is out of bounds."); eventChecker.ignoreEvents(); old_items = get_array_of_list_items(t.baseVal); @@ -636,14 +632,14 @@ function run_baseVal_API_tests() res = t.baseVal.replaceItem(item, 1); is(t.baseVal.numberOfItems, 4, - 'The '+t.list_type+' object should contain four list items.'); + "The " + t.list_type + " object should contain four list items."); if (t.item_type != "DOMString") { ok(res !== item && t.baseVal.getItem(1) !== item && t.baseVal.getItem(1) !== old_items[1] && res === t.baseVal.getItem(1), - 'The method '+t.list_type+'.replaceItem() should clone the object '+ - 'that is passed in if that object is already in a list.'); + "The method " + t.list_type + ".replaceItem() should clone the object " + + "that is passed in if that object is already in a list."); // [SVGWG issue] not what the spec currently says } @@ -651,24 +647,24 @@ function run_baseVal_API_tests() res = t.baseVal.replaceItem(item, 1); is(t.baseVal.numberOfItems, 4, - 'The '+t.list_type+' object should contain four list items.'); + "The " + t.list_type + " object should contain four list items."); if (t.item_type != "DOMString") { ok(res !== item && t.baseVal.getItem(1) !== item, - 'The method '+t.list_type+'.replaceItem() should clone the object '+ - 'that is passed in, even if the object that object and the object '+ - 'that is being replaced are the exact same objects.'); + "The method " + t.list_type + ".replaceItem() should clone the object " + + "that is passed in, even if the object that object and the object " + + "that is being replaced are the exact same objects."); // [SVGWG issue] not what the spec currently says threw = false; try { t.baseVal.replaceItem({}, 2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.replaceItem() should throw if passed '+ - 'an object of the wrong type.'); + "The method " + t.list_type + ".replaceItem() should throw if passed " + + "an object of the wrong type."); } // Test .removeItem(): @@ -682,31 +678,31 @@ function run_baseVal_API_tests() eventChecker.ignoreEvents(); is(t.baseVal.numberOfItems, 3, - 'The '+t.list_type+' object should contain three list items.'); + "The " + t.list_type + " object should contain three list items."); if (t.item_type != "DOMString") { ok(res === item, - 'The list item returned by '+t.list_type+'.removeItem() should be the '+ - 'exact same object as the item that was at the specified index.'); + "The list item returned by " + t.list_type + ".removeItem() should be the " + + "exact same object as the item that was at the specified index."); } ok(t.baseVal.getItem(1) === old_items[1], - 'The list item that was at index 1 should still be at index 1 after '+ - 'the item at index 2 was removed using the '+t.list_type+ - '.replaceItem() method.'); + "The list item that was at index 1 should still be at index 1 after " + + "the item at index 2 was removed using the " + t.list_type + + ".replaceItem() method."); ok(t.baseVal.getItem(2) === old_items[3], - 'The list item that was at index 3 should still be at index 2 after '+ - 'the item at index 2 was removed using the '+t.list_type+ - '.replaceItem() method.'); + "The list item that was at index 3 should still be at index 2 after " + + "the item at index 2 was removed using the " + t.list_type + + ".replaceItem() method."); eventChecker.expect(""); threw = false; try { t.baseVal.removeItem(100); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.removeItem() should throw if passed '+ - 'an index that is out of bounds.'); + "The method " + t.list_type + ".removeItem() should throw if passed " + + "an index that is out of bounds."); eventChecker.ignoreEvents(); // Test .appendItem(): @@ -720,33 +716,33 @@ function run_baseVal_API_tests() eventChecker.ignoreEvents(); is(t.baseVal.numberOfItems, 5, - 'The '+t.list_type+' object should contain five list items.'); + "The " + t.list_type + " object should contain five list items."); ok(res === item, - 'The list item returned by '+t.list_type+'.appendItem() should be the '+ - 'exact same object as the item that was passed to that method, since '+ - 'the item that was passed to that method did not already belong '+ - 'to a list.'); + "The list item returned by " + t.list_type + ".appendItem() should be the " + + "exact same object as the item that was passed to that method, since " + + "the item that was passed to that method did not already belong " + + "to a list."); ok(t.baseVal.getItem(4) === item, - 'The last list item should be the exact same object as the object '+ - 'that was passed to the '+t.list_type+'.appendItem() method, since '+ - 'the item that was passed to that method did not already belong to '+ - 'a list.'); + "The last list item should be the exact same object as the object " + + "that was passed to the " + t.list_type + ".appendItem() method, since " + + "the item that was passed to that method did not already belong to " + + "a list."); ok(t.baseVal.getItem(3) === old_items[3], - 'The list item that was at index 4 should still be at index 4 after '+ - 'appending a new item using the '+t.list_type+'.appendItem() '+ - 'method.'); + "The list item that was at index 4 should still be at index 4 after " + + "appending a new item using the " + t.list_type + ".appendItem() " + + "method."); item = t.baseVal.getItem(2); res = t.baseVal.appendItem(item); is(t.baseVal.numberOfItems, 6, - 'The '+t.list_type+' object should contain six list items.'); + "The " + t.list_type + " object should contain six list items."); if (t.item_type != "DOMString") { ok(res !== item && t.baseVal.getItem(5) !== item && res === t.baseVal.getItem(5), - 'The method '+t.list_type+'.appendItem() should clone the object '+ - 'that is passed in if that object is already in a list.'); + "The method " + t.list_type + ".appendItem() should clone the object " + + "that is passed in if that object is already in a list."); // [SVGWG issue] not what the spec currently says } @@ -754,25 +750,25 @@ function run_baseVal_API_tests() res = t.baseVal.appendItem(item); is(t.baseVal.numberOfItems, 7, - 'The '+t.list_type+' object should contain seven list items.'); + "The " + t.list_type + " object should contain seven list items."); if (t.item_type != "DOMString") { ok(res !== item && t.baseVal.getItem(6) !== item, - 'The method '+t.list_type+'.appendItem() should clone the object '+ - 'that is passed in, if that object is already the last item in '+ - 'that list.'); + "The method " + t.list_type + ".appendItem() should clone the object " + + "that is passed in, if that object is already the last item in " + + "that list."); // [SVGWG issue] not what the spec currently says eventChecker.expect(""); threw = false; try { t.baseVal.appendItem({}); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.appendItem() should throw if passed '+ - 'an object of the wrong type.'); + "The method " + t.list_type + ".appendItem() should throw if passed " + + "an object of the wrong type."); eventChecker.ignoreEvents(); } @@ -791,8 +787,7 @@ function run_baseVal_API_tests() * This function tests the SVGXxxList API for the anim val list (see also the * comment for test_baseVal_API). */ -function run_animVal_API_tests() -{ +function run_animVal_API_tests() { var threw, item; for (var t of tests) { @@ -804,86 +799,86 @@ function run_animVal_API_tests() t.element.setAttribute(t.attr_name, t.attr_val_4); is(t.animVal.numberOfItems, 4, - 'The '+t.list_type+' object should contain four list items.'); + "The " + t.list_type + " object should contain four list items."); // Test .clear(): threw = false; try { t.animVal.clear(); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.clear() should throw when called on an '+ - 'anim val list, since anim val lists should be readonly.'); + "The method " + t.list_type + ".clear() should throw when called on an " + + "anim val list, since anim val lists should be readonly."); // Test .getItem(): var item = t.animVal.getItem(2); ok(item != null && item === t.animVal.getItem(2), - 'The method '+t.list_type+'.getItem() should work when called on an '+ - 'anim val list, and always return the exact same object.'); + "The method " + t.list_type + ".getItem() should work when called on an " + + "anim val list, and always return the exact same object."); // .initialize() threw = false; try { t.animVal.initialize(item); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.initialize() should throw when called on '+ - 'an anim val list, since anim val lists should be readonly.'); + "The method " + t.list_type + ".initialize() should throw when called on " + + "an anim val list, since anim val lists should be readonly."); // Test .insertItemBefore(): threw = false; try { t.animVal.insertItemBefore(item, 2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.insertItemBefore() should throw when '+ - 'called on an anim val list, since anim val lists should be readonly.'); + "The method " + t.list_type + ".insertItemBefore() should throw when " + + "called on an anim val list, since anim val lists should be readonly."); // Test .replaceItem(): threw = false; try { t.animVal.replaceItem(item, 2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.replaceItem() should throw when called '+ - 'on an anim val list, since anim val lists should be readonly.'); + "The method " + t.list_type + ".replaceItem() should throw when called " + + "on an anim val list, since anim val lists should be readonly."); // Test .removeItem(): threw = false; try { t.animVal.removeItem(2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.removeItem() should throw when called '+ - 'on an anim val list, since anim val lists should be readonly.'); + "The method " + t.list_type + ".removeItem() should throw when called " + + "on an anim val list, since anim val lists should be readonly."); // Test .appendItem(): threw = false; try { t.animVal.appendItem(item); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.list_type+'.appendItem() should throw when called '+ - 'on an anim val list, since anim val lists should be readonly.'); + "The method " + t.list_type + ".appendItem() should throw when called " + + "on an anim val list, since anim val lists should be readonly."); } } @@ -892,10 +887,8 @@ function run_animVal_API_tests() * This function runs some basic tests to check the effect of setAttribute() * calls on object identity, without taking SMIL animation into consideration. */ -function run_basic_setAttribute_tests() -{ +function run_basic_setAttribute_tests() { for (var t of tests) { - // Since the t.prop, t.baseVal and t.animVal objects should never ever // change, we leave testing of them to our caller so that it can check // them after all the other mutations such as SMIL changes. @@ -903,35 +896,35 @@ function run_basic_setAttribute_tests() t.element.setAttribute(t.attr_name, t.attr_val_4); ok(t.baseVal.numberOfItems == 4 && t.baseVal.getItem(3) != null, - 'The length of the '+t.list_type+' object for '+t.bv_path+' should '+ - 'have been set to 4 by the setAttribute() call.'); + "The length of the " + t.list_type + " object for " + t.bv_path + " should " + + "have been set to 4 by the setAttribute() call."); if (t.animVal) { ok(t.baseVal.numberOfItems == t.animVal.numberOfItems, - 'When no animations are active, the '+t.list_type+' objects for '+ - t.bv_path+' and '+t.av_path+' should be the same length (4).'); + "When no animations are active, the " + t.list_type + " objects for " + + t.bv_path + " and " + t.av_path + " should be the same length (4)."); ok(t.baseVal !== t.animVal, - 'The '+t.list_type+' objects for '+t.bv_path+' and '+t.av_path+ - ' should be different objects.'); + "The " + t.list_type + " objects for " + t.bv_path + " and " + t.av_path + + " should be different objects."); ok(t.baseVal.getItem(0) !== t.animVal.getItem(0), - 'The '+t.item_type+' list items in the '+t.list_type+' objects for '+ - t.bv_path+' and '+t.av_path+' should be different objects.'); + "The " + t.item_type + " list items in the " + t.list_type + " objects for " + + t.bv_path + " and " + t.av_path + " should be different objects."); } ok(t.baseVal.getItem(0) === t.baseVal.getItem(0), - 'The exact same '+t.item_type+' DOM object should be returned each '+ - 'time the item at a given index in the '+t.list_type+' for '+ - t.bv_path+' is accessed, given that the index was not made invalid '+ - 'by a change in list length between the successive accesses.'); + "The exact same " + t.item_type + " DOM object should be returned each " + + "time the item at a given index in the " + t.list_type + " for " + + t.bv_path + " is accessed, given that the index was not made invalid " + + "by a change in list length between the successive accesses."); if (t.animVal) { ok(t.animVal.getItem(0) === t.animVal.getItem(0), - 'The exact same '+t.item_type+' DOM object should be returned each '+ - 'time the item at a given index in the '+t.list_type+' for '+ - t.av_path+' is accessed, given that the index was not made invalid '+ - 'by a change in list length between the successive accesses.'); + "The exact same " + t.item_type + " DOM object should be returned each " + + "time the item at a given index in the " + t.list_type + " for " + + t.av_path + " is accessed, given that the index was not made invalid " + + "by a change in list length between the successive accesses."); } // Test the effect of setting the attribute to new values: @@ -945,42 +938,42 @@ function run_basic_setAttribute_tests() t.element.setAttribute(t.attr_name, t.attr_val_5a); ok(t.baseVal.numberOfItems == 5 && t.baseVal.getItem(4) != null, - 'The length of the '+t.list_type+' object for '+t.bv_path+' should '+ - 'have been set to 5 by the setAttribute() call.'); + "The length of the " + t.list_type + " object for " + t.bv_path + " should " + + "have been set to 5 by the setAttribute() call."); if (t.animVal) { ok(t.baseVal.numberOfItems == t.animVal.numberOfItems, - 'Since no animations are active, the length of the '+t.list_type+' '+ - 'objects for '+t.bv_path+' and '+t.av_path+' should be the same '+ - '(5).'); + "Since no animations are active, the length of the " + t.list_type + " " + + "objects for " + t.bv_path + " and " + t.av_path + " should be the same " + + "(5)."); } if (t.item_type != "DOMString") { ok(t.baseVal.getItem(2) === t.old_baseVal_items[2], - 'After its attribute changes, list items in the '+t.list_type+' for '+ - t.bv_path+' that are at indexes that existed prior to the attribute '+ - 'change should be the exact same objects as the objects that were '+ - 'at those indexes prior to the attribute change.'); + "After its attribute changes, list items in the " + t.list_type + " for " + + t.bv_path + " that are at indexes that existed prior to the attribute " + + "change should be the exact same objects as the objects that were " + + "at those indexes prior to the attribute change."); ok(t.baseVal.getItem(3) !== t.old_baseVal_items[3], - 'After its attribute changes, list items in the '+t.list_type+' for '+ - t.bv_path+' that are at indexes that did not exist prior to the '+ - 'attribute change should not be the same objects as any objects that '+ - 'were at those indexes at some earlier time.'); + "After its attribute changes, list items in the " + t.list_type + " for " + + t.bv_path + " that are at indexes that did not exist prior to the " + + "attribute change should not be the same objects as any objects that " + + "were at those indexes at some earlier time."); } if (t.animVal) { ok(t.animVal.getItem(2) === t.old_animVal_items[2], - 'After its attribute changes, list items in the '+t.list_type+' for '+ - t.av_path+' that are at indexes that existed prior to the attribute '+ - 'change should be the exact same objects as the objects that were '+ - 'at those indexes prior to the attribute change.'); + "After its attribute changes, list items in the " + t.list_type + " for " + + t.av_path + " that are at indexes that existed prior to the attribute " + + "change should be the exact same objects as the objects that were " + + "at those indexes prior to the attribute change."); ok(t.animVal.getItem(3) !== t.old_animVal_items[3], - 'After its attribute changes, list items in the '+t.list_type+' for '+ - t.av_path+' that are at indexes that did not exist prior to the '+ - 'attribute change should not be the same objects as any objects '+ - 'that were at those indexes at some earlier time.'); + "After its attribute changes, list items in the " + t.list_type + " for " + + t.av_path + " that are at indexes that did not exist prior to the " + + "attribute change should not be the same objects as any objects " + + "that were at those indexes at some earlier time."); } } } @@ -989,8 +982,7 @@ function run_basic_setAttribute_tests() * This function verifies that a list's animVal is kept in sync with its * baseVal, when we add & remove items from the baseVal. */ -function run_list_mutation_tests() -{ +function run_list_mutation_tests() { for (var t of tests) { if (t.animVal) { // Test removeItem() @@ -1002,8 +994,8 @@ function run_list_mutation_tests() var secondVal = t.baseVal.getItem(1); var removedFirstVal = t.baseVal.removeItem(0); t.item_is(t.animVal.getItem(0), secondVal, - 'animVal for '+t.attr_name+' needs update after first item ' + - 'removed'); + "animVal for " + t.attr_name + " needs update after first item " + + "removed"); // Repeat with last item var secondToLastVal = t.baseVal.getItem(1); @@ -1012,16 +1004,16 @@ function run_list_mutation_tests() var threw = false; try { t.animVal.getItem(2); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.attr_name+'.animVal.getItem() for previously-final ' + - 'index should throw after final item is removed from baseVal.'); + "The method " + t.attr_name + ".animVal.getItem() for previously-final " + + "index should throw after final item is removed from baseVal."); t.item_is(t.animVal.getItem(1), secondToLastVal, - 'animVal for ' + t.attr_name +' needs update after last item ' + - 'removed'); + "animVal for " + t.attr_name + " needs update after last item " + + "removed"); // Test insertItemBefore() // ======================= @@ -1029,22 +1021,22 @@ function run_list_mutation_tests() t.element.setAttribute(t.attr_name, t.attr_val_3a); t.baseVal.insertItemBefore(removedLastVal, 0); t.item_is(t.animVal.getItem(0), removedLastVal, - 'animVal for '+t.attr_name+' needs update after insert at ' + - 'beginning'); + "animVal for " + t.attr_name + " needs update after insert at " + + "beginning"); // Repeat with insert at end t.element.setAttribute(t.attr_name, t.attr_val_3a); t.baseVal.insertItemBefore(removedFirstVal, t.baseVal.numberOfItems); t.item_is(t.animVal.getItem(t.baseVal.numberOfItems - 1), removedFirstVal, - 'animVal for '+t.attr_name+' needs update after insert at end'); + "animVal for " + t.attr_name + " needs update after insert at end"); // Test appendItem() // ================= var dummy = t.item_constructor(); t.baseVal.appendItem(dummy); t.item_is(t.animVal.getItem(t.baseVal.numberOfItems - 1), dummy, - 'animVal for '+t.attr_name+' needs update after appendItem'); + "animVal for " + t.attr_name + " needs update after appendItem"); // Test clear() // ============ @@ -1052,15 +1044,15 @@ function run_list_mutation_tests() threw = false; try { t.animVal.getItem(0); - } catch(e) { + } catch (e) { threw = true; } ok(threw, - 'The method '+t.attr_name+'.animVal.getItem() should throw after ' + - 'we\'ve cleared baseVal.'); + "The method " + t.attr_name + ".animVal.getItem() should throw after " + + "we've cleared baseVal."); is(t.animVal.numberOfItems, 0, - 'animVal for '+t.attr_name+' should be empty after baseVal cleared'); + "animVal for " + t.attr_name + " should be empty after baseVal cleared"); // Test initialize() // ================= @@ -1068,9 +1060,9 @@ function run_list_mutation_tests() t.baseVal.initialize(dummy); is(t.animVal.numberOfItems, 1, - 'animVal for '+t.attr_name+' should have length 1 after initialize'); + "animVal for " + t.attr_name + " should have length 1 after initialize"); t.item_is(t.animVal.getItem(0), dummy, - 'animVal for '+t.attr_name+' needs update after initialize'); + "animVal for " + t.attr_name + " needs update after initialize"); } } } @@ -1083,9 +1075,8 @@ function run_list_mutation_tests() * See the comment for create_animate_elements() for details of the animations * and their timings. */ -function run_animation_timeline_tests() -{ - var svg = document.getElementById('svg'); +function run_animation_timeline_tests() { + var svg = document.getElementById("svg"); for (var t of tests) { // Skip if there is no animVal for this test or if it is a transform list @@ -1101,26 +1092,26 @@ function run_animation_timeline_tests() t.old_animVal_items = get_array_of_list_items(t.animVal); - /******************** t = 1s ********************/ + /** ****************** t = 1s ********************/ svg.setCurrentTime(1); // begin first animation ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'The start of an animation should never affect the '+t.list_type+ - ' for '+t.bv_path+', or its list items.'); + "The start of an animation should never affect the " + t.list_type + + " for " + t.bv_path + ", or its list items."); ok(t.animVal.numberOfItems == 5 && t.animVal.getItem(4) != null, - 'The start of the animation should have changed the number of items '+ - 'in the '+t.list_type+' for '+t.bv_path+' to 5.'); + "The start of the animation should have changed the number of items " + + "in the " + t.list_type + " for " + t.bv_path + " to 5."); // TODO ok(t.animVal.getItem(3) === t.old_animVal_items[3], - 'When affected by SMIL animation, list items in the '+t.list_type+ - ' for '+t.bv_path+' that are at indexes that existed prior to the '+ - 'start of the animation should be the exact same objects as the '+ - 'objects that were at those indexes prior to the start of the '+ - 'animation.'); + "When affected by SMIL animation, list items in the " + t.list_type + + " for " + t.bv_path + " that are at indexes that existed prior to the " + + "start of the animation should be the exact same objects as the " + + "objects that were at those indexes prior to the start of the " + + "animation."); t.old_animVal_items = get_array_of_list_items(t.animVal); @@ -1128,15 +1119,15 @@ function run_animation_timeline_tests() ok(t.baseVal.numberOfItems == 3 && t.baseVal.getItem(2) === t.old_baseVal_items[2], - 'Setting the underlying attribute should change the items in the '+ - t.list_type+' for '+t.bv_path+', including when an animation is '+ - 'in progress.'); + "Setting the underlying attribute should change the items in the " + + t.list_type + " for " + t.bv_path + ", including when an animation is " + + "in progress."); ok(t.animVal.numberOfItems == 5 && t.animVal.getItem(4) === t.old_animVal_items[4], - 'Setting the underlying attribute should not change the '+t.list_type+ - ' for '+t.bv_path+' when an animation that does not depend on the '+ - 'base val is in progress.'); + "Setting the underlying attribute should not change the " + t.list_type + + " for " + t.bv_path + " when an animation that does not depend on the " + + "base val is in progress."); t.element.setAttribute(t.attr_name, t.attr_val_4); // reset @@ -1144,106 +1135,104 @@ function run_animation_timeline_tests() t.old_animVal_items = get_array_of_list_items(t.animVal); - /******************** t = 2s ********************/ + /** ****************** t = 2s ********************/ svg.setCurrentTime(2); // begin override animation ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'The start of an override animation should never affect the '+ - t.list_type+' for '+t.bv_path+', or its list items.'); + "The start of an override animation should never affect the " + + t.list_type + " for " + t.bv_path + ", or its list items."); is(t.animVal.numberOfItems, 3, - 'The start of the override animation should have changed the number '+ - 'of items in the '+t.list_type+' for '+t.bv_path+' to 3.'); + "The start of the override animation should have changed the number " + + "of items in the " + t.list_type + " for " + t.bv_path + " to 3."); ok(t.animVal.getItem(2) === t.old_animVal_items[2], - 'When affected by an override SMIL animation, list items in the '+ - t.list_type+' for '+t.bv_path+' that are at indexes that existed '+ - 'prior to the start of the animation should be the exact same '+ - 'objects as the objects that were at those indexes prior to the '+ - 'start of that animation.'); + "When affected by an override SMIL animation, list items in the " + + t.list_type + " for " + t.bv_path + " that are at indexes that existed " + + "prior to the start of the animation should be the exact same " + + "objects as the objects that were at those indexes prior to the " + + "start of that animation."); t.old_animVal_items = get_array_of_list_items(t.animVal); - /******************** t = 3s ********************/ + /** ****************** t = 3s ********************/ svg.setCurrentTime(3); // end of override animation ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'The end of an override animation should never affect the '+ - t.list_type+' for '+t.bv_path+', or its list items.'); + "The end of an override animation should never affect the " + + t.list_type + " for " + t.bv_path + ", or its list items."); is(t.animVal.numberOfItems, 5, - 'At the end of the override animation, the number of items in the '+ - t.list_type+' for '+t.bv_path+' should have reverted to 5.'); + "At the end of the override animation, the number of items in the " + + t.list_type + " for " + t.bv_path + " should have reverted to 5."); ok(t.animVal.getItem(2) === t.old_animVal_items[2], - 'At the end of the override animation, list items in the '+ - t.list_type+' for '+t.bv_path+' that are at indexes that existed '+ - 'prior to the end of the animation should be the exact same '+ - 'objects as the objects that were at those indexes prior to the '+ - 'end of that animation.'); + "At the end of the override animation, list items in the " + + t.list_type + " for " + t.bv_path + " that are at indexes that existed " + + "prior to the end of the animation should be the exact same " + + "objects as the objects that were at those indexes prior to the " + + "end of that animation."); t.old_animVal_items = get_array_of_list_items(t.animVal); - /******************** t = 5s ********************/ + /** ****************** t = 5s ********************/ svg.setCurrentTime(5); // animation repeat point ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'When a SMIL animation repeats, it should never affect the '+ - t.list_type+' for '+t.bv_path+', or its list items.'); + "When a SMIL animation repeats, it should never affect the " + + t.list_type + " for " + t.bv_path + ", or its list items."); ok(t.animVal.numberOfItems == t.old_animVal_items.length && t.animVal.getItem(4) === t.old_animVal_items[4], - 'When an animation repeats, the list items that are at a given '+ - 'index in the '+t.list_type+' for '+t.av_path+' should be the exact '+ - 'same objects as were at that index before the repeat occurred.'); + "When an animation repeats, the list items that are at a given " + + "index in the " + t.list_type + " for " + t.av_path + " should be the exact " + + "same objects as were at that index before the repeat occurred."); - /******************** t = 6s ********************/ + /** ****************** t = 6s ********************/ svg.setCurrentTime(6); // inside animation repeat ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'When a SMIL animation repeats, it should never affect the '+ - t.list_type+' for '+t.bv_path+', or its list items.'); + "When a SMIL animation repeats, it should never affect the " + + t.list_type + " for " + t.bv_path + ", or its list items."); ok(t.animVal.numberOfItems == t.old_animVal_items.length && t.animVal.getItem(4) === t.old_animVal_items[4], - 'When an animation repeats, the list items that are at a given '+ - 'index in the '+t.list_type+' for '+t.av_path+' should be the exact '+ - 'same objects as were at that index before the repeat occurred.'); + "When an animation repeats, the list items that are at a given " + + "index in the " + t.list_type + " for " + t.av_path + " should be the exact " + + "same objects as were at that index before the repeat occurred."); - /******************** t = 7s ********************/ + /** ****************** t = 7s ********************/ svg.setCurrentTime(7); // start of additive="sum" animation ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'When a new SMIL animation starts and should blend with an '+ - 'underlying animation, it should never affect the '+ - t.list_type+' for '+t.bv_path+', or its list items.'); - - if (t.list_type == 'SVGLengthList') { + "When a new SMIL animation starts and should blend with an " + + "underlying animation, it should never affect the " + + t.list_type + " for " + t.bv_path + ", or its list items."); + if (t.list_type == "SVGLengthList") { // Length lists are a special case where it makes sense to allow shorter // lists to be composed on top of longer lists (but not necessarily vice // versa - see comment below). ok(t.animVal.numberOfItems == t.old_animVal_items.length && t.animVal.getItem(3) === t.old_animVal_items[3], - 'When an animation with additive="sum" is added on top of an '+ - 'existing animation that has more list items, the length of the '+ - t.list_type+' for '+t.av_path+' should not change.'); - + 'When an animation with additive="sum" is added on top of an ' + + "existing animation that has more list items, the length of the " + + t.list_type + " for " + t.av_path + " should not change."); } else { /* TODO @@ -1268,47 +1257,46 @@ function run_animation_timeline_tests() // SVGLengthListSMILAttr::Add(). - /******************** t = 13s ********************/ + /** ****************** t = 13s ********************/ svg.setCurrentTime(13); // all animations have finished, but one is frozen ok(t.baseVal.numberOfItems == t.old_baseVal_items.length && t.baseVal.getItem(3) === t.old_baseVal_items[3], - 'When a SMIL animation ends, it should never affect the '+ - t.list_type+' for '+t.bv_path+', or its list items.'); + "When a SMIL animation ends, it should never affect the " + + t.list_type + " for " + t.bv_path + ", or its list items."); is(t.animVal.numberOfItems, 5, - 'Even though all SMIL animation have finished, the number '+ - 'of items in the '+t.list_type+' for '+t.av_path+ - ' should still be more than the same as the number of items in '+ - t.bv_path+' since one of the animations is still frozen.'); + "Even though all SMIL animation have finished, the number " + + "of items in the " + t.list_type + " for " + t.av_path + + " should still be more than the same as the number of items in " + + t.bv_path + " since one of the animations is still frozen."); var expected = t.attr_val_5b_firstItem_x3_constructor(t.item_constructor); t.item_is(t.animVal.getItem(0), expected, - 'animation with accumulate="sum" and repeatCount="3" for attribute "'+ - t.attr_name+'" should end up at 3x the "to" value.'); + 'animation with accumulate="sum" and repeatCount="3" for attribute "' + + t.attr_name + '" should end up at 3x the "to" value.'); // Unfreeze frozen animation (removing its effects) var frozen_animate_element = - t.element.querySelector('animate[fill][attributeName="'+t.attr_name+'"]'); - frozen_animate_element.removeAttribute('fill'); + t.element.querySelector('animate[fill][attributeName="' + t.attr_name + '"]'); + frozen_animate_element.removeAttribute("fill"); ok(t.animVal.numberOfItems == t.baseVal.numberOfItems, - 'Once all SMIL animation have finished and been un-frozen, the number '+ - 'of items in the '+t.list_type+' for '+t.av_path+ - ' should be the same as the number of items in '+t.bv_path+'.'); + "Once all SMIL animation have finished and been un-frozen, the number " + + "of items in the " + t.list_type + " for " + t.av_path + + " should be the same as the number of items in " + t.bv_path + "."); ok(t.animVal.getItem(2) === t.old_animVal_items[2], - 'Even after an animation finishes and is un-frozen, the list items '+ - 'that are at a given index in the '+t.list_type+' for '+t.av_path+ - ' should be the exact same objects as were at that index before the '+ - 'end and unfreezing of the animation occurred.'); + "Even after an animation finishes and is un-frozen, the list items " + + "that are at a given index in the " + t.list_type + " for " + t.av_path + + " should be the exact same objects as were at that index before the " + + "end and unfreezing of the animation occurred."); } } -function run_tests() -{ +function run_tests() { // Initialize each test object with some useful properties, and create their // 'animate' elements. Note that 'prop' and 'animVal' may be null. for (var t of tests) { @@ -1316,12 +1304,12 @@ function run_tests() t.prop = t.prop_name ? t.element[t.prop_name] : null; t.baseVal = ( t.prop || t.element )[t.bv_name]; t.animVal = t.av_name ? ( t.prop || t.element )[t.av_name] : null; - t.bv_path = t.el_type + '.' + - (t.prop ? t.prop_name + '.' : '') + - t.bv_name; // e.g. 'SVGTextElement.x.baseVal' + t.bv_path = t.el_type + "." + + (t.prop ? t.prop_name + "." : "") + + t.bv_name; // e.g. 'SVGTextElement.x.baseVal' if (t.animVal) { - t.av_path = t.el_type + '.' + - (t.prop ? t.prop_name + '.' : '') + + t.av_path = t.el_type + "." + + (t.prop ? t.prop_name + "." : "") + t.av_name; } t.prop_type = t.prop_type || null; @@ -1329,9 +1317,9 @@ function run_tests() // use fallback 'is' function, if none was provided. if (!t.item_is) { t.item_is = function(itemA, itemB, message) { - ok(typeof(itemA.value) != 'undefined' && - typeof(itemB.value) != 'undefined', - 'expecting value property'); + ok(typeof(itemA.value) != "undefined" && + typeof(itemB.value) != "undefined", + "expecting value property"); is(itemA.value, itemB.value, message); }; } @@ -1355,18 +1343,18 @@ function run_tests() for (var t of tests) { if (t.prop) { ok(t.prop === t.element[t.prop_name], - 'The same '+t.prop_type+' object should ALWAYS be returned for '+ - t.el_type+'.'+t.prop_name+' each time it is accessed.'); + "The same " + t.prop_type + " object should ALWAYS be returned for " + + t.el_type + "." + t.prop_name + " each time it is accessed."); } ok(t.baseVal === ( t.prop || t.element )[t.bv_name], - 'The same '+t.list_type+' object should ALWAYS be returned for '+ - t.el_type+'.'+t.prop_name+'.'+t.bv_name+' each time it is accessed.'); + "The same " + t.list_type + " object should ALWAYS be returned for " + + t.el_type + "." + t.prop_name + "." + t.bv_name + " each time it is accessed."); if (t.animVal) { ok(t.animVal === ( t.prop || t.element )[t.av_name], - 'The same '+t.list_type+' object should ALWAYS be returned for '+ - t.el_type+'.'+t.prop_name+'.'+t.av_name+' each time it is accessed.'); + "The same " + t.list_type + " object should ALWAYS be returned for " + + t.el_type + "." + t.prop_name + "." + t.av_name + " each time it is accessed."); } } diff --git a/dom/svg/test/test_SVGxxxListIndexing.xhtml b/dom/svg/test/test_SVGxxxListIndexing.xhtml index e0b87bacb1e0..7dfd071f0f47 100644 --- a/dom/svg/test/test_SVGxxxListIndexing.xhtml +++ b/dom/svg/test/test_SVGxxxListIndexing.xhtml @@ -22,8 +22,7 @@ var text = document.getElementById("text"), poly = document.getElementById("poly"); g = document.getElementById("g"); -function CheckList(aListObject, aExpectedListLength, aListDescription) -{ +function CheckList(aListObject, aExpectedListLength, aListDescription) { is(aListObject.numberOfItems, aExpectedListLength, aListDescription + ".numberOfItems"); is(aListObject.length, aExpectedListLength, aListDescription + ".length"); for (let i = 0; i < aListObject.length; i++) { @@ -69,7 +68,7 @@ var tests = [ type: "SVGStringList", subtests: [ { values: null, length: 3 }, { values: "foo", length: 1 }, - { values: "foo bar baz qux", length: 4 } ] } + { values: "foo bar baz qux", length: 4 } ] }, ]; for (let test of tests) { diff --git a/dom/svg/test/test_a_href_01.xhtml b/dom/svg/test/test_a_href_01.xhtml index 908633889499..5aa214603366 100644 --- a/dom/svg/test/test_a_href_01.xhtml +++ b/dom/svg/test/test_a_href_01.xhtml @@ -75,7 +75,7 @@ function doNavigationTest(testNumber, initialHref, f) { if (f) { f(a); } - sendMouseEvent({type:'click'}, a); + sendMouseEvent({type: "click"}, a); } window.onload = windowLoaded; diff --git a/dom/svg/test/test_animLengthObjectIdentity.xhtml b/dom/svg/test/test_animLengthObjectIdentity.xhtml index 4b714fde132a..c82c2024489e 100644 --- a/dom/svg/test/test_animLengthObjectIdentity.xhtml +++ b/dom/svg/test/test_animLengthObjectIdentity.xhtml @@ -25,9 +25,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=508496 /** Test object identity of animated lengths **/ /* Global Variables */ -const svgns="http://www.w3.org/2000/svg"; +const svgns = "http://www.w3.org/2000/svg"; var svg = document.getElementById("svg"); -var circle = document.getElementById('circle'); +var circle = document.getElementById("circle"); SimpleTest.waitForExplicitFinish(); @@ -47,7 +47,7 @@ function main() { ok(animVal === circle.cx.animVal, "Got different animVal SVGLength objects at startup"); - var animate = document.getElementById('animate'); + var animate = document.getElementById("animate"); if (animate && animate.targetElement) { // Sample mid-way through the animation svg.setCurrentTime(5); diff --git a/dom/svg/test/test_animLengthReadonly.xhtml b/dom/svg/test/test_animLengthReadonly.xhtml index d75e120db1eb..a349c62c44e7 100644 --- a/dom/svg/test/test_animLengthReadonly.xhtml +++ b/dom/svg/test/test_animLengthReadonly.xhtml @@ -38,9 +38,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=506856 /** Test read-only times of animated lengths **/ /* Global Variables */ -const svgns="http://www.w3.org/2000/svg"; +const svgns = "http://www.w3.org/2000/svg"; var svg = document.getElementById("svg"); -var circle = document.getElementById('circle'); +var circle = document.getElementById("circle"); SimpleTest.waitForExplicitFinish(); @@ -124,7 +124,7 @@ function checkReadOnly(animLength) { // newValueSpecifiedUnits try { exceptionCaught = false; - animLength.animVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX,-100); + animLength.animVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, -100); } catch (e) { exceptionCaught = true; } ok(exceptionCaught, "animVal.newValueSpecifiedUnits failed to throw."); if (!exceptionCaught) return false; @@ -139,8 +139,7 @@ function checkReadOnly(animLength) { return exceptionCaught; } -function checkSameValue(animLength) -{ +function checkSameValue(animLength) { // value animLength.baseVal.value = 1; is(animLength.animVal.value, 1, @@ -151,7 +150,7 @@ function checkSameValue(animLength) is(animLength.animVal.value, 2, "un-animated animVal.value not changed after setting " + "baseValue.valueInSpecifiedUnits"); - + // valueAsString animLength.baseVal.valueAsString = "3"; is(animLength.animVal.value, 3, @@ -171,8 +170,7 @@ function checkSameValue(animLength) + "baseValue.convertToSpecifiedUnits"); } -function checkDiffValue(animLength) -{ +function checkDiffValue(animLength) { // We assume here that the animation is not additive and hence changing the // baseValue will not be reflected in the animValue var origValue = animLength.animVal.value; @@ -187,7 +185,7 @@ function checkDiffValue(animLength) is(animLength.animVal.value, origValue, "animated animVal.value changed after setting " + "baseValue.valueInSpecifiedUnits"); - + // valueAsString animLength.baseVal.valueAsString = "3"; is(animLength.animVal.value, origValue, diff --git a/dom/svg/test/test_animLengthUnits.xhtml b/dom/svg/test/test_animLengthUnits.xhtml index f4dafad4d9fc..b86cdbfe9d1e 100644 --- a/dom/svg/test/test_animLengthUnits.xhtml +++ b/dom/svg/test/test_animLengthUnits.xhtml @@ -27,10 +27,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=507067 /** Test units of animated lengths **/ /* Global Variables */ -const svgns="http://www.w3.org/2000/svg"; +const svgns = "http://www.w3.org/2000/svg"; var svg = document.getElementById("svg"); -var circle = document.getElementById('circle'); -var animate = document.getElementById('animate'); +var circle = document.getElementById("circle"); +var animate = document.getElementById("animate"); SimpleTest.waitForExplicitFinish(); @@ -74,7 +74,7 @@ function main() { "(1) Unexpected value for animVal during animation"); // Change font-size and check - circle.parentNode.setAttribute('font-size', '5px'); + circle.parentNode.setAttribute("font-size", "5px"); // Currently, changing the font-size on a parent doesn't force a resample (see // bug 508206) so we have to give the animation a chance to run @@ -93,7 +93,7 @@ function checkAfterChangeFontSize() { // Do the same again, when the animation is frozen svg.setCurrentTime(10); - circle.parentNode.setAttribute('font-size', '7px'); + circle.parentNode.setAttribute("font-size", "7px"); // Again, due to bug 508206 we need to give the animation a chance to resample window.requestAnimationFrame(checkWhilstFrozen); @@ -112,7 +112,7 @@ function checkWhilstFrozen() { SimpleTest.finish(); } -var animate = document.getElementById('animate'); +var animate = document.getElementById("animate"); if (animate && animate.targetElement) { window.addEventListener("load", main); } else { diff --git a/dom/svg/test/test_bbox-changes.xhtml b/dom/svg/test/test_bbox-changes.xhtml index 281e706e9e28..756b2cb38d6e 100644 --- a/dom/svg/test/test_bbox-changes.xhtml +++ b/dom/svg/test/test_bbox-changes.xhtml @@ -40,32 +40,31 @@ function checkBBox(id, options, x, y, width, height, msg) { is(bbox.height, height, id + ".getBBox().height" + msg); } -function run() -{ +function run() { // First call getBBox on 'rect1' with stroke included: $("rect1").setAttribute("stroke", "black"); $("rect1").setAttribute("stroke-width", "10"); - checkBBox("rect1", { fill:true, stroke:true }, 5, 5, 20, 20, " with stroke"); + checkBBox("rect1", { fill: true, stroke: true }, 5, 5, 20, 20, " with stroke"); // Now remove the stroke from 'rect1' and check again: $("rect1").removeAttribute("stroke"); $("rect1").removeAttribute("stroke-width"); - checkBBox("rect1", { fill:true }, 10, 10, 10, 10, " after stroke removed"); + checkBBox("rect1", { fill: true }, 10, 10, 10, 10, " after stroke removed"); // First call getBBox on 'rect2' without a stroke included: - checkBBox("rect2", { fill:true }, 30, 10, 10, 10, " with stroke"); + checkBBox("rect2", { fill: true }, 30, 10, 10, 10, " with stroke"); // Now add a stroke to 'rect2' and check again: $("rect2").setAttribute("stroke", "black"); $("rect2").setAttribute("stroke-width", "10"); - checkBBox("rect2", { fill:true, stroke:true }, 25, 5, 20, 20, " with stroke"); + checkBBox("rect2", { fill: true, stroke: true }, 25, 5, 20, 20, " with stroke"); // Check the initial result for getBBox on the group: - checkBBox("g", { fill:true }, 55, 15, 70, 10, " before child moves"); + checkBBox("g", { fill: true }, 55, 15, 70, 10, " before child moves"); // Now move one of the circle children and check again: $("circle2").setAttribute("cx", "110"); - checkBBox("g", { fill:true }, 55, 15, 60, 10, " after child moves"); + checkBBox("g", { fill: true }, 55, 15, 60, 10, " after child moves"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_bbox-with-invalid-viewBox.xhtml b/dom/svg/test/test_bbox-with-invalid-viewBox.xhtml index 84b4fe0e2bc6..8f4a3a724c00 100644 --- a/dom/svg/test/test_bbox-with-invalid-viewBox.xhtml +++ b/dom/svg/test/test_bbox-with-invalid-viewBox.xhtml @@ -22,8 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=433063 diff --git a/dom/svg/test/test_bbox.xhtml b/dom/svg/test/test_bbox.xhtml index 9f56333f25ff..a0c5aabe8e09 100644 --- a/dom/svg/test/test_bbox.xhtml +++ b/dom/svg/test/test_bbox.xhtml @@ -20,12 +20,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=449327 SimpleTest.waitForExplicitFinish(); -function run() -{ +function run() { var doc = $("svg").contentDocument; - function isFuzzy(a, b, error, name) - { + function isFuzzy(a, b, error, name) { ok(!(Math.abs(a - b) > error), name + " - got " + a + ", expected " + b + " (within " + error + ")"); } diff --git a/dom/svg/test/test_bounds.html b/dom/svg/test/test_bounds.html index e8621460fe84..06f4e43930d4 100644 --- a/dom/svg/test/test_bounds.html +++ b/dom/svg/test/test_bounds.html @@ -30,29 +30,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=463934
 
diff --git a/dom/svg/test/test_dataTypes.html b/dom/svg/test/test_dataTypes.html
index f381832f688f..6a823db1aeeb 100644
--- a/dom/svg/test/test_dataTypes.html
+++ b/dom/svg/test/test_dataTypes.html
@@ -19,8 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=437448
 
 
diff --git a/dom/svg/test/test_getTotalLength.xhtml b/dom/svg/test/test_getTotalLength.xhtml index bbf4e07b408c..5e94a45a9387 100644 --- a/dom/svg/test/test_getTotalLength.xhtml +++ b/dom/svg/test/test_getTotalLength.xhtml @@ -22,20 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1474284 diff --git a/dom/svg/test/test_hit-testing-and-viewbox.xhtml b/dom/svg/test/test_hit-testing-and-viewbox.xhtml index 3e53eef9c64c..0d20fe5423bd 100644 --- a/dom/svg/test/test_hit-testing-and-viewbox.xhtml +++ b/dom/svg/test/test_hit-testing-and-viewbox.xhtml @@ -19,43 +19,42 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1486952 SimpleTest.waitForExplicitFinish(); -function run() -{ - const div = $('div'); +function run() { + const div = $("div"); const offsetX = div.offsetLeft; const offsetY = div.offsetTop; - const outerRect = $('outerRect'); - const innerRect = $('innerRect'); - const outerSVG = $('outerSVG'); - const innerSVG = $('innerSVG'); + const outerRect = $("outerRect"); + const innerRect = $("innerRect"); + const outerSVG = $("outerSVG"); + const innerSVG = $("innerSVG"); let got; // Update the inner SVG viewBox to "move" the inner rectangle off its current // position on screen: - innerSVG.setAttribute('viewBox', '-25 0 50 50'); + innerSVG.setAttribute("viewBox", "-25 0 50 50"); got = document.elementFromPoint(offsetX + 150, offsetY + 25); - is(got, innerRect, 'Should hit inner rectangle (1)'); + is(got, innerRect, "Should hit inner rectangle (1)"); // Update the inner SVG viewBox again. (At the time of writing, a reflow is // triggered the first time you change viewBox on an inner svg, so the // previous test is expected to always pass. This next test will fail if we're // updating overflows on the inner svg frame instead of its children). - innerSVG.setAttribute('viewBox', '0 -25 50 50'); + innerSVG.setAttribute("viewBox", "0 -25 50 50"); got = document.elementFromPoint(offsetX + 100, offsetY + 75); - is(got, innerRect, 'Should hit inner rectangle (2)'); + is(got, innerRect, "Should hit inner rectangle (2)"); // Now update the outer SVG viewBox and confirm that both rectangles are // registered. (Note that in this case the overflow rectangle of the inner // svg is the inner svg's viewport, so be sure to "move" the outer svg so that // the "new" outer rectangle and inner svg are off the current outerRect // union inner svg viewport - hit testing still works in that union.) - outerSVG.setAttribute('viewBox', '-200 0 400 100'); + outerSVG.setAttribute("viewBox", "-200 0 400 100"); // Outer: got = document.elementFromPoint(offsetX + 250, offsetY + 50); - is(got, outerRect, 'Should hit outer rectangle'); + is(got, outerRect, "Should hit outer rectangle"); // Inner: got = document.elementFromPoint(offsetX + 300, offsetY + 75); - is(got, innerRect, 'Should hit inner rectangle (3)'); + is(got, innerRect, "Should hit inner rectangle (3)"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_lang.xhtml b/dom/svg/test/test_lang.xhtml index 4e4935e0c946..56727b9c02d6 100644 --- a/dom/svg/test/test_lang.xhtml +++ b/dom/svg/test/test_lang.xhtml @@ -41,7 +41,7 @@ var elts = [ document.getElementById("s0"), document.getElementById("s4"), document.getElementById("s12"), - document.getElementById("s28") + document.getElementById("s28"), ]; function fs(idx) { @@ -53,7 +53,7 @@ function fs(idx) { return getComputedStyle(elts[idx], "").wordSpacing; } -SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.zh-CN']]}, step1); +SpecialPowers.pushPrefEnv({"clear": [["font.minimum-size.zh-CN"]]}, step1); function step1() { is(fs(0), "0px", "at min font size 0, 0px should compute to 0px"); @@ -61,7 +61,7 @@ function step1() { is(fs(2), "12px", "at min font size 0, 12px should compute to 12px"); is(fs(3), "28px", "at min font size 0, 28px should compute to 28px"); - SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.zh-CN', 7]]}, step2); + SpecialPowers.pushPrefEnv({"set": [["font.minimum-size.zh-CN", 7]]}, step2); } function step2() { @@ -70,7 +70,7 @@ function step2() { is(fs(2), "12px", "at min font size 7, 12px should compute to 12px"); is(fs(3), "28px", "at min font size 7, 28px should compute to 28px"); - SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.zh-CN', 18]]}, step3); + SpecialPowers.pushPrefEnv({"set": [["font.minimum-size.zh-CN", 18]]}, step3); } function step3() { @@ -79,7 +79,7 @@ function step3() { is(fs(2), "18px", "at min font size 18, 12px should compute to 18px"); is(fs(3), "28px", "at min font size 18, 28px should compute to 28px"); - SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.zh-CN']]}, SimpleTest.finish); + SpecialPowers.pushPrefEnv({"clear": [["font.minimum-size.zh-CN"]]}, SimpleTest.finish); } //]]> diff --git a/dom/svg/test/test_length.xhtml b/dom/svg/test/test_length.xhtml index adf7ac509865..56a38d8a86b6 100644 --- a/dom/svg/test/test_length.xhtml +++ b/dom/svg/test/test_length.xhtml @@ -24,19 +24,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=342513 SimpleTest.waitForExplicitFinish(); -function run() -{ - var svgDoc = document.getElementById('svg'); - var divElem = document.getElementById('div'); +function run() { + var svgDoc = document.getElementById("svg"); + var divElem = document.getElementById("div"); var expectedWidth = divElem.clientWidth; // test for the pixel width of the svg - is(svgDoc.width.baseVal.value, expectedWidth, 'svgDoc.width.baseVal.value'); + is(svgDoc.width.baseVal.value, expectedWidth, "svgDoc.width.baseVal.value"); // set the SVG width to ~50% in pixels - svgDoc.width.baseVal.newValueSpecifiedUnits(svgDoc.width.baseVal.SVG_LENGTHTYPE_PX, Math.floor(expectedWidth/2)); + svgDoc.width.baseVal.newValueSpecifiedUnits(svgDoc.width.baseVal.SVG_LENGTHTYPE_PX, Math.floor(expectedWidth / 2)); svgDoc.width.baseVal.convertToSpecifiedUnits(svgDoc.width.baseVal.SVG_LENGTHTYPE_PERCENTAGE); // the valueInSpecifiedUnits should now be 50% - is(Math.round(svgDoc.width.baseVal.valueInSpecifiedUnits), 50, 'valueInSpecifiedUnits after convertToSpecifiedUnits'); + is(Math.round(svgDoc.width.baseVal.valueInSpecifiedUnits), 50, "valueInSpecifiedUnits after convertToSpecifiedUnits"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_lengthParsing.html b/dom/svg/test/test_lengthParsing.html index 34e2b04a36ec..db99c930d25f 100644 --- a/dom/svg/test/test_lengthParsing.html +++ b/dom/svg/test/test_lengthParsing.html @@ -51,7 +51,7 @@ function checkParseOk(spec, valueInUnits, units) { const tolerance = 1 / 65535; var actual = rect.x.baseVal.valueInSpecifiedUnits; ok(Math.abs(actual - valueInUnits) < tolerance, - spec + ' (value) - got ' + actual + ', expected ' + valueInUnits); + spec + " (value) - got " + actual + ", expected " + valueInUnits); // Check unit part var unitMapping = { @@ -65,7 +65,7 @@ function checkParseOk(spec, valueInUnits, units) { "mm": SVGLength.SVG_LENGTHTYPE_MM, "in": SVGLength.SVG_LENGTHTYPE_IN, "pt": SVGLength.SVG_LENGTHTYPE_PT, - "pc": SVGLength.SVG_LENGTHTYPE_PC + "pc": SVGLength.SVG_LENGTHTYPE_PC, }; if (typeof units == "undefined") { units = ""; diff --git a/dom/svg/test/test_markerOrient.xhtml b/dom/svg/test/test_markerOrient.xhtml index ae449460c7e8..71bca92885d1 100644 --- a/dom/svg/test/test_markerOrient.xhtml +++ b/dom/svg/test/test_markerOrient.xhtml @@ -43,8 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=892372 "orientAngle animVal after numeric angle is set"); } - function run() - { + function run() { var m = $("m"); // Testing two conditions: diff --git a/dom/svg/test/test_non-scaling-stroke.html b/dom/svg/test/test_non-scaling-stroke.html index 06099bd9bfc2..0abd8e660175 100644 --- a/dom/svg/test/test_non-scaling-stroke.html +++ b/dom/svg/test/test_non-scaling-stroke.html @@ -34,7 +34,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=829085 function startTest() { SimpleTest.waitForFocus(function() { disableNonTestMouseEvents(true); - var line = document.getElementById('line'); + var line = document.getElementById("line"); // Send a click synthesizeMouseExpectEvent($("svg"), 170, 100, { }, $("line"), "click", diff --git a/dom/svg/test/test_nonAnimStrings.xhtml b/dom/svg/test/test_nonAnimStrings.xhtml index faab7d48301a..7eafa7075f22 100644 --- a/dom/svg/test/test_nonAnimStrings.xhtml +++ b/dom/svg/test/test_nonAnimStrings.xhtml @@ -38,9 +38,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589436 /* Global Variables */ var svg = document.getElementById("svg"); -var script = document.getElementById('script'); -var mpath = document.getElementById('mpath'); -var animate = document.getElementById('animate'); +var script = document.getElementById("script"); +var mpath = document.getElementById("mpath"); +var animate = document.getElementById("animate"); SimpleTest.waitForExplicitFinish(); diff --git a/dom/svg/test/test_object-delayed-intrinsic-size.html b/dom/svg/test/test_object-delayed-intrinsic-size.html index b260d27485ff..c58ad4b011cc 100644 --- a/dom/svg/test/test_object-delayed-intrinsic-size.html +++ b/dom/svg/test/test_object-delayed-intrinsic-size.html @@ -17,8 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1063073 SimpleTest.waitForExplicitFinish(); -function runTest() -{ +function runTest() { var object = document.querySelector("object"); var cs = document.defaultView.getComputedStyle(object); var width = cs.getPropertyValue("width"); diff --git a/dom/svg/test/test_onerror.xhtml b/dom/svg/test/test_onerror.xhtml index 59c67cd860c9..8e7391ec55e9 100644 --- a/dom/svg/test/test_onerror.xhtml +++ b/dom/svg/test/test_onerror.xhtml @@ -15,9 +15,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500261 SimpleTest.waitForExplicitFinish(); -function run() -{ - ok(true, 'onerror method called'); +function run() { + ok(true, "onerror method called"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_pathAnimInterpolation.xhtml b/dom/svg/test/test_pathAnimInterpolation.xhtml index 6187e1814ce9..6fd153446368 100644 --- a/dom/svg/test/test_pathAnimInterpolation.xhtml +++ b/dom/svg/test/test_pathAnimInterpolation.xhtml @@ -26,15 +26,15 @@ var gTypes = "zMmLlCcQqAaHhVvSsTt".split(""); // order that they would appear in a path data string. var gArgumentNames = { Z: [], - M: ['x', 'y'], - L: ['x', 'y'], - C: ['x1', 'y1', 'x2', 'y2', 'x', 'y'], - Q: ['x1', 'y1', 'x', 'y'], - A: ['r1', 'r2', 'angle', 'largeArcFlag', 'sweepFlag', 'x', 'y'], - H: ['x'], - V: ['y'], - S: ['x2', 'y2', 'x', 'y'], - T: ['x', 'y'] + M: ["x", "y"], + L: ["x", "y"], + C: ["x1", "y1", "x2", "y2", "x", "y"], + Q: ["x1", "y1", "x", "y"], + A: ["r1", "r2", "angle", "largeArcFlag", "sweepFlag", "x", "y"], + H: ["x"], + V: ["y"], + S: ["x2", "y2", "x", "y"], + T: ["x", "y"], }; // All of these prefixes leave the current point at 100,100. Some of them @@ -79,7 +79,7 @@ var gPrefixes = [ [3, "M50,50 C10,10,20,20,75,75 S75,75,100,100"], [3, "M50,50 C10,10,20,20,75,75 s0,0,25,25"], [3, "M50,50 c10,10,20,20,25,25 S75,75,100,100"], - [3, "M50,50 c10,10,20,20,25,25 s0,0,25,25"] + [3, "M50,50 c10,10,20,20,25,25 s0,0,25,25"], ]; // These are all of the suffixes whose result is not dependent on whether the @@ -120,7 +120,7 @@ var gPrefixes = [ // convert the "M10,20" into its relative form, which is "m-90,-80" due to the // current point being 100,100. Half way through the animation between // "m-90,-80" and "m30,40" is thus "m-30,-20". -// +// // The expected result of the additive test is "m-120,-100". We take the // halfway value of the animation, "m-30,-20" and add it on to the underlying // value. Since the underlying value "M10,20" is an absolute moveto, we first @@ -172,25 +172,23 @@ var gSuffixes = { hH: [[10], [20], [65], [175]], Vv: [[10], [20], [-35], [-125]], vV: [[10], [20], [65], [175]], - Tt: [[10, 20], [30, 40], [-30,-20], [-120, -100]], + Tt: [[10, 20], [30, 40], [-30, -20], [-120, -100]], tT: [[10, 20], [30, 40], [70, 80], [180, 200]], Ss: [[10, 20, 30, 40], [50, 60, 70, 80], [-20, -10, 0, 10], [-110, -90, -70, -50]], sS: [[10, 20, 30, 40], [50, 60, 70, 80], - [80, 90, 100, 110], [190, 210, 230, 250]] + [80, 90, 100, 110], [190, 210, 230, 250]], }; // Returns an array of property names that exist on an SVGPathSeg object // corresponding to the given segment type, in the order that they would // be present in a path data string. -function argumentNames(aType) -{ +function argumentNames(aType) { return gArgumentNames[aType.toUpperCase()]; } // Creates and returns a new element and sets some attributes on it. -function newElement(aNamespaceURI, aLocalName, aAttributes) -{ +function newElement(aNamespaceURI, aLocalName, aAttributes) { var e = document.createElementNS(aNamespaceURI, aLocalName); if (aAttributes) { for (let [name, value] of Object.entries(aAttributes)) { @@ -201,8 +199,7 @@ function newElement(aNamespaceURI, aLocalName, aAttributes) } // Creates and returns a new SVG element and sets some attributes on it. -function newSVGElement(aLocalName, aAttributes) -{ +function newSVGElement(aLocalName, aAttributes) { return newElement("http://www.w3.org/2000/svg", aLocalName, aAttributes); } @@ -218,8 +215,7 @@ function newSVGElement(aLocalName, aAttributes) // animation function addTest(aPrefixLength, aPrefix, aFromType, aFromArguments, aToType, aToArguments, aExpectedType, aExpectedArguments, - aAdditive) -{ + aAdditive) { var fromPath = aPrefix + aFromType + aFromArguments, toPath = aPrefix + aToType + aToArguments; @@ -245,8 +241,7 @@ function addTest(aPrefixLength, aPrefix, aFromType, aFromArguments, // Generates an array of path segment arguments for the given type. aOffset // is a number to add on to all non-Boolean segment arguments. -function generatePathSegmentArguments(aType, aOffset) -{ +function generatePathSegmentArguments(aType, aOffset) { var args = new Array(argumentNames(aType).length); for (let i = 0; i < args.length; i++) { args[i] = i * 10 + aOffset; @@ -259,14 +254,12 @@ function generatePathSegmentArguments(aType, aOffset) } // Returns whether interpolating between the two given types is valid. -function isValidInterpolation(aFromType, aToType) -{ +function isValidInterpolation(aFromType, aToType) { return aFromType.toUpperCase() == aToType.toUpperCase(); } // Runs the test. -function run() -{ +function run() { for (let additive of [false, true]) { let indexOfExpectedArguments = additive ? 3 : 2; diff --git a/dom/svg/test/test_pointAtLength.xhtml b/dom/svg/test/test_pointAtLength.xhtml index 31ddd4c629f1..dad3c235a087 100644 --- a/dom/svg/test/test_pointAtLength.xhtml +++ b/dom/svg/test/test_pointAtLength.xhtml @@ -13,8 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=643419 SimpleTest.waitForExplicitFinish(); -function run() -{ +function run() { var p1 = document.getElementById("p1"); var point = p1.getPointAtLength(200); is(point.x, 200); diff --git a/dom/svg/test/test_pointer-events-2.xhtml b/dom/svg/test/test_pointer-events-2.xhtml index afe63b3f0c4d..0c638c78bc7a 100644 --- a/dom/svg/test/test_pointer-events-2.xhtml +++ b/dom/svg/test/test_pointer-events-2.xhtml @@ -13,25 +13,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174 SimpleTest.waitForExplicitFinish(); -function run() -{ - var svgDoc = document.getElementById('svg'); +function run() { + var svgDoc = document.getElementById("svg"); var div = document.getElementById("div"); // Get the coords of the origin of the SVG canvas: var originX = div.offsetLeft; var originY = div.offsetTop; - var circle = document.getElementById('circle'); - var path = document.getElementById('path'); + var circle = document.getElementById("circle"); + var path = document.getElementById("path"); var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55); is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"'); elementFromPoint = document.elementFromPoint(originX + 205, originY + 55); - is(elementFromPoint, circle, 'Over foreignObject, outside clip path'); + is(elementFromPoint, circle, "Over foreignObject, outside clip path"); elementFromPoint = document.elementFromPoint(originX + 225, originY + 75); // XXX disabled. See See https://bugzilla.mozilla.org/show_bug.cgi?id=580983#c116 - //is(elementFromPoint, path, 'Over foreignObject, inside clip path'); + // is(elementFromPoint, path, 'Over foreignObject, inside clip path'); SimpleTest.finish(); } diff --git a/dom/svg/test/test_pointer-events-3.xhtml b/dom/svg/test/test_pointer-events-3.xhtml index 7981002237fb..716c94c0ac48 100644 --- a/dom/svg/test/test_pointer-events-3.xhtml +++ b/dom/svg/test/test_pointer-events-3.xhtml @@ -13,8 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=762679 SimpleTest.waitForExplicitFinish(); -function run() -{ +function run() { var svgDoc = document.getElementById("svg"); var div = document.getElementById("div"); // Get the coords of the origin of the SVG canvas: diff --git a/dom/svg/test/test_pointer-events-4.xhtml b/dom/svg/test/test_pointer-events-4.xhtml index bab3baae83f0..171c0496593d 100644 --- a/dom/svg/test/test_pointer-events-4.xhtml +++ b/dom/svg/test/test_pointer-events-4.xhtml @@ -13,72 +13,71 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=820506 SimpleTest.waitForExplicitFinish(); -function run() -{ - var svgDoc = document.getElementById('svg'); +function run() { + var svgDoc = document.getElementById("svg"); var div = document.getElementById("div"); // Get the coords of the origin of the SVG canvas: var originX = div.offsetLeft; var originY = div.offsetTop; - var r1 = document.getElementById('r1'); - var r2 = document.getElementById('r2'); + var r1 = document.getElementById("r1"); + var r2 = document.getElementById("r2"); var element; // Test r1 just outsite the clip area: element = document.elementFromPoint(originX + 19, originY + 19); - is(element, background, 'Should not hit top-left of r1'); + is(element, background, "Should not hit top-left of r1"); element = document.elementFromPoint(originX + 101, originY + 19); - is(element, background, 'Should not hit top-right of r1'); + is(element, background, "Should not hit top-right of r1"); element = document.elementFromPoint(originX + 101, originY + 101); - is(element, background, 'Should not hit bottom-right of r1'); + is(element, background, "Should not hit bottom-right of r1"); element = document.elementFromPoint(originX + 19, originY + 101); - is(element, background, 'Should not hit bottom-left of r1'); + is(element, background, "Should not hit bottom-left of r1"); // Test r1 just inside the clip area: element = document.elementFromPoint(originX + 21, originY + 21); - is(element, r1, 'Should hit top-left of r1'); + is(element, r1, "Should hit top-left of r1"); element = document.elementFromPoint(originX + 99, originY + 21); - is(element, r1, 'Should hit top-right of r1'); + is(element, r1, "Should hit top-right of r1"); element = document.elementFromPoint(originX + 99, originY + 99); - is(element, r1, 'Should hit bottom-right of r1'); + is(element, r1, "Should hit bottom-right of r1"); element = document.elementFromPoint(originX + 21, originY + 99); - is(element, r1, 'Should hit bottom-left of r1'); + is(element, r1, "Should hit bottom-left of r1"); // Test r2 just outsite the clip area: element = document.elementFromPoint(originX + 109, originY + 19); - is(element, background, 'Should not hit top-left of r2'); + is(element, background, "Should not hit top-left of r2"); element = document.elementFromPoint(originX + 201, originY + 19); - is(element, background, 'Should not hit top-right of r2'); + is(element, background, "Should not hit top-right of r2"); element = document.elementFromPoint(originX + 201, originY + 101); - is(element, background, 'Should not hit bottom-right of r2'); + is(element, background, "Should not hit bottom-right of r2"); element = document.elementFromPoint(originX + 109, originY + 101); - is(element, background, 'Should not hit bottom-left of r2'); + is(element, background, "Should not hit bottom-left of r2"); // Test r2 just inside the clip area: element = document.elementFromPoint(originX + 121, originY + 21); - is(element, r2, 'Should hit top-left of r2'); + is(element, r2, "Should hit top-left of r2"); element = document.elementFromPoint(originX + 199, originY + 21); - is(element, r2, 'Should hit top-right of r2'); + is(element, r2, "Should hit top-right of r2"); element = document.elementFromPoint(originX + 199, originY + 99); - is(element, r2, 'Should hit bottom-right of r2'); + is(element, r2, "Should hit bottom-right of r2"); element = document.elementFromPoint(originX + 121, originY + 99); - is(element, r2, 'Should hit bottom-left of r2'); + is(element, r2, "Should hit bottom-left of r2"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_pointer-events-5.xhtml b/dom/svg/test/test_pointer-events-5.xhtml index afe63b3f0c4d..0c638c78bc7a 100644 --- a/dom/svg/test/test_pointer-events-5.xhtml +++ b/dom/svg/test/test_pointer-events-5.xhtml @@ -13,25 +13,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174 SimpleTest.waitForExplicitFinish(); -function run() -{ - var svgDoc = document.getElementById('svg'); +function run() { + var svgDoc = document.getElementById("svg"); var div = document.getElementById("div"); // Get the coords of the origin of the SVG canvas: var originX = div.offsetLeft; var originY = div.offsetTop; - var circle = document.getElementById('circle'); - var path = document.getElementById('path'); + var circle = document.getElementById("circle"); + var path = document.getElementById("path"); var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55); is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"'); elementFromPoint = document.elementFromPoint(originX + 205, originY + 55); - is(elementFromPoint, circle, 'Over foreignObject, outside clip path'); + is(elementFromPoint, circle, "Over foreignObject, outside clip path"); elementFromPoint = document.elementFromPoint(originX + 225, originY + 75); // XXX disabled. See See https://bugzilla.mozilla.org/show_bug.cgi?id=580983#c116 - //is(elementFromPoint, path, 'Over foreignObject, inside clip path'); + // is(elementFromPoint, path, 'Over foreignObject, inside clip path'); SimpleTest.finish(); } diff --git a/dom/svg/test/test_pointer-events-6.xhtml b/dom/svg/test/test_pointer-events-6.xhtml index 7ec590d09c9d..9e3ad722056d 100644 --- a/dom/svg/test/test_pointer-events-6.xhtml +++ b/dom/svg/test/test_pointer-events-6.xhtml @@ -13,8 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174 SimpleTest.waitForExplicitFinish(); -function run() -{ +function run() { var div = document.getElementById("div"); // Get the coords of the origin of the SVG canvas: var originX = div.offsetLeft; @@ -22,28 +21,28 @@ function run() var elementFromPoint; elementFromPoint = document.elementFromPoint(originX + 18, originY + 30); - isnot(elementFromPoint, div, 'Outside left edge of clipped area'); + isnot(elementFromPoint, div, "Outside left edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 22, originY + 30); - is(elementFromPoint, div, 'Inside left edge of clipped area'); + is(elementFromPoint, div, "Inside left edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 30, originY + 18); - isnot(elementFromPoint, div, 'Outside top edge of clipped area'); + isnot(elementFromPoint, div, "Outside top edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 30, originY + 22); - is(elementFromPoint, div, 'Inside top edge of clipped area'); + is(elementFromPoint, div, "Inside top edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 42, originY + 30); - isnot(elementFromPoint, div, 'Outside right edge of clipped area'); + isnot(elementFromPoint, div, "Outside right edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 38, originY + 30); - is(elementFromPoint, div, 'Inside right edge of clipped area'); + is(elementFromPoint, div, "Inside right edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 30, originY + 42); - isnot(elementFromPoint, div, 'Outside bottom edge of clipped area'); + isnot(elementFromPoint, div, "Outside bottom edge of clipped area"); elementFromPoint = document.elementFromPoint(originX + 30, originY + 38); - is(elementFromPoint, div, 'Inside bottom edge of clipped area'); + is(elementFromPoint, div, "Inside bottom edge of clipped area"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_pointer-events-7.xhtml b/dom/svg/test/test_pointer-events-7.xhtml index 3ac95cb303c3..bfeb9c4af4f9 100644 --- a/dom/svg/test/test_pointer-events-7.xhtml +++ b/dom/svg/test/test_pointer-events-7.xhtml @@ -13,31 +13,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1119698 SimpleTest.waitForExplicitFinish(); -function run() -{ - var svgDoc = document.getElementById('svg'); +function run() { + var svgDoc = document.getElementById("svg"); var div = document.getElementById("div"); // Get the coords of the origin of the SVG canvas: var originX = div.offsetLeft; var originY = div.offsetTop; - var image4 = document.getElementById('image4'); - var image5 = document.getElementById('image5'); + var image4 = document.getElementById("image4"); + var image5 = document.getElementById("image5"); var element; element = document.elementFromPoint(originX + 20, originY + 20); - is(element, background, 'Should not hit visibility:hidden image by default'); + is(element, background, "Should not hit visibility:hidden image by default"); element = document.elementFromPoint(originX + 120, originY + 20); - is(element, background, 'Should not hit pointer-events:none image'); + is(element, background, "Should not hit pointer-events:none image"); element = document.elementFromPoint(originX + 220, originY + 20); - is(element, background, 'Should not hit pointer-events:visible visibility:hidden image'); + is(element, background, "Should not hit pointer-events:visible visibility:hidden image"); element = document.elementFromPoint(originX + 320, originY + 20); - is(element, image4, 'Should hit pointer-events:painted visibility:hidden image'); + is(element, image4, "Should hit pointer-events:painted visibility:hidden image"); element = document.elementFromPoint(originX + 420, originY + 20); - is(element, image5, 'Should hit pointer-events:stroke visibility:hidden image'); + is(element, image5, "Should hit pointer-events:stroke visibility:hidden image"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_scientific.html b/dom/svg/test/test_scientific.html index 25dce7e904bb..187878cc0a42 100644 --- a/dom/svg/test/test_scientific.html +++ b/dom/svg/test/test_scientific.html @@ -19,8 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=302971 diff --git a/dom/svg/test/test_stroke-hit-testing.xhtml b/dom/svg/test/test_stroke-hit-testing.xhtml index 04021905ec27..08fca2313302 100644 --- a/dom/svg/test/test_stroke-hit-testing.xhtml +++ b/dom/svg/test/test_stroke-hit-testing.xhtml @@ -18,28 +18,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=676001 SimpleTest.waitForExplicitFinish(); -function run() -{ - var div = document.getElementById('div'); - var line = document.getElementById('line'); - var circle = document.getElementById('circle'); +function run() { + var div = document.getElementById("div"); + var line = document.getElementById("line"); + var circle = document.getElementById("circle"); var offsetX = div.offsetLeft; var offsetY = div.offsetTop; var got; // line got = document.elementFromPoint(offsetX + 116, offsetY + 103); - is(got, line, 'Should hit line (1)'); + is(got, line, "Should hit line (1)"); got = document.elementFromPoint(offsetX + 123, offsetY + 108); - is(got, line, 'Should hit line (2)'); + is(got, line, "Should hit line (2)"); // circle got = document.elementFromPoint(offsetX + 188, offsetY + 158); - is(got, circle, 'Should hit circle (1)'); + is(got, circle, "Should hit circle (1)"); got = document.elementFromPoint(offsetX + 185, offsetY + 162); - is(got, circle, 'Should hit circle (2)'); + is(got, circle, "Should hit circle (2)"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_stroke-linecap-hit-testing.xhtml b/dom/svg/test/test_stroke-linecap-hit-testing.xhtml index da9bfb002e39..a32fcbfc6f77 100644 --- a/dom/svg/test/test_stroke-linecap-hit-testing.xhtml +++ b/dom/svg/test/test_stroke-linecap-hit-testing.xhtml @@ -13,17 +13,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589648 SimpleTest.waitForExplicitFinish(); -function run() -{ - var svg = document.getElementById('svg'); +function run() { + var svg = document.getElementById("svg"); var div = document.getElementById("div"); var x = div.offsetLeft; var y = div.offsetTop; var got, expected; got = document.elementFromPoint(5 + x, 5 + y); - expected = document.getElementById('zero-length-square-caps'); - is(got, expected, 'Check hit on zero length subpath\'s square caps'); + expected = document.getElementById("zero-length-square-caps"); + is(got, expected, "Check hit on zero length subpath's square caps"); SimpleTest.finish(); } diff --git a/dom/svg/test/test_switch.xhtml b/dom/svg/test/test_switch.xhtml index d220240202a3..b2ecfe2c47ff 100644 --- a/dom/svg/test/test_switch.xhtml +++ b/dom/svg/test/test_switch.xhtml @@ -22,8 +22,7 @@ SimpleTest.waitForExplicitFinish(); var test = 1; -function checkBounds(element, x, y, w, h) -{ +function checkBounds(element, x, y, w, h) { var bbox = element.getBBox(); var name = element.nodeName; @@ -34,8 +33,7 @@ function checkBounds(element, x, y, w, h) ++test; } -function checkWidth(element, w) -{ +function checkWidth(element, w) { var bbox = element.getBBox(); var name = element.nodeName; @@ -43,21 +41,19 @@ function checkWidth(element, w) ++test; } -function run() -{ +function run() { // Set accept_languages to something we know SpecialPowers.pushPrefEnv({"set": [["intl.accept_languages", "en-gb,en,it"]]}, run1); } -function run1() -{ +function run1() { try { var doc = $("svg").contentDocument; var s = doc.getElementById("s"); var first = doc.getElementById("first"); var second = doc.getElementById("second"); var third = doc.getElementById("third"); - + first.setAttribute("systemLanguage", "fr"); /* test for an exact match */ @@ -75,7 +71,7 @@ function run1() /* test that we use the default if nothing matches */ second.setAttribute("systemLanguage", "fr"); checkWidth(s, 80); - + /* test we still ignore non-matches */ second.removeAttribute("systemLanguage"); third.setAttribute("systemLanguage", "fr"); @@ -89,7 +85,6 @@ function run1() first.setAttribute("systemLanguage", "en"); second.setAttribute("systemLanguage", "en-gb"); checkWidth(s, 50); - } finally { SimpleTest.finish(); } diff --git a/dom/svg/test/test_tabindex.html b/dom/svg/test/test_tabindex.html index 91674bca3659..62ecd818e305 100644 --- a/dom/svg/test/test_tabindex.html +++ b/dom/svg/test/test_tabindex.html @@ -31,13 +31,12 @@