From: dhrname Date: Fri, 1 May 2015 14:11:57 +0000 (+0900) Subject: Change a return value of the setValues method X-Git-Tag: version22~206 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0a14446b575f049e5ab4389ffc2c1cae039c58df;p=sie%2Fsie.git Change a return value of the setValues method --- diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 96cb377..4ff003e 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -693,7 +693,7 @@ base("$calcMode").up("$attribute").mix( { /*引数で指定した要素 ele の属性を解析して、フレームに追加する*/ push: function(/*Element Node*/ ele) { if (!ele) { - return; + return null; } this.element = ele.parentNode || null; if (!( ele.hasAttribute("from") || ele.hasAttribute("to") @@ -705,7 +705,7 @@ base("$calcMode").up("$attribute").mix( { *「3.2.2. Animation function values」より引用 *http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues */ - return; + return null; } /*eleの属性の値を、それぞれオブジェクトに割り当て*/ var $frame = base("$frame"), @@ -729,7 +729,10 @@ base("$calcMode").up("$attribute").mix( { } ); $frame.addLine(frame); this.frame.push(frame); - } + } + getAttr = begin = ele = void 0; + return frame; + /*属性を取得するためのインライン関数*/ function getAttr(name) { /*DOM Level2やIE11では、getAttributeNSメソッドは空文字を返す。他のブラウザではnullを返すことが多い @@ -738,7 +741,6 @@ base("$calcMode").up("$attribute").mix( { * http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElGetAttrNS*/ return (ele.getAttributeNS(null, name) || null); }; - getAttr = begin = ele = void 0; }, /*setValuesメソッド diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 9844f42..d0e10a1 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -3311,7 +3311,7 @@ describe("SMIL Animation Spec", function() { } ); } ); describe("A $attribute object", function() { - describe("An push method", function() { + describe("A push method", function() { var attr, s; beforeEach( function() { attr = base("$calcMode").$attribute.up("width"); @@ -3323,19 +3323,19 @@ describe("SMIL Animation Spec", function() { it("should be this for the value (limit value analysis)", function() { expect(attr.frame.length).toEqual(0); expect(attr.element).toBeNull(); - attr.push(); + expect(attr.push()).toBeNull(); expect(attr.element).toBeNull(); expect(attr.frame.length).toEqual(0); expect(base("$frame").timelines.length).toEqual(0); - attr.push(s); + expect(attr.push(s)).toBeNull(); expect(attr.element).toBeNull(); expect(attr.frame.length).toEqual(0); expect(base("$frame").timelines.length).toEqual(0); var p = document.createElement("g"); p.appendChild(s); - attr.push(s); + expect(attr.push(s)).toBeNull(); expect(attr.element).toBe(p); expect(attr.frame.length).toEqual(0); expect(base("$frame").timelines.length).toEqual(0); @@ -3348,13 +3348,14 @@ describe("SMIL Animation Spec", function() { function check(attrName, num) { s.setAttribute(attrName, "1"); expect(s.hasAttributeNS(null, attrName)).toBeTruthy(); - attr.push(s); + var l = attr.push(s); expect(attr.element).toBe(p); var timelines = base("$frame").timelines; expect(timelines.length).toEqual(num); var line = timelines[num-1]; expect(line).toBe(attr.frame[attr.frame.length-1]); expect(line.string).toBe("0"); + expect(line).toBe(l); //タイムラインのオブジェクトを返す var act = line.$activate; expect(act.dur).toBeNull(); expect(act.end).toBe(0);