From: dhrname Date: Wed, 21 Oct 2015 14:31:34 +0000 (+0900) Subject: Add the accessKey property to the object X-Git-Tag: version22~25 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=642a9b3b293e2bd496306d03fa54c98fa3468e73;p=sie%2Fsie.git Add the accessKey property to the object --- diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 082fced..39674aa 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -222,7 +222,7 @@ base("$frame").mix ( { /*repeat(1)など文字列内に書かれたリピート回数*/ repeat: 0, - /*accessKey("a")の"a"などキーイベントの対象となる文字列*/ + /*accessKey(a)の"a"などキーイベントの対象となる文字列*/ accessKey: "", /*trim メソッド @@ -310,6 +310,8 @@ base("$frame").mix ( { } /*もしもあれば、リピートの回数を求める*/ this.repeat = /repeat\((\d+)\)/.test(str) ? +RegExp.$1 : 0; + /*もしもあれば、押されるはずのキーを求める*/ + this.accessKey = /accessKey\(([^\)]+?)\)/.test(str) ? RegExp.$1 : ""; this.begin = Math.floor( this.begin * this.fpms); if (event) { ele = event.id ? this.eventTarget.ownerDocument.getElementById(event.id) @@ -321,6 +323,11 @@ base("$frame").mix ( { if (evt.detail === this.repeat) { this.listener(evt); } }).bind(this), false); + } else if (this.accessKey) { + ele && ele.addEventListener("keydown", (function(evt) { + if (evt.detail === this.repeat) { + this.listener(evt); + } }).bind(this), false); } else { var evtName = /^(?:begin|end|repeat)$/.test(event.event) ? event.event + "Event" : event.event; diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 1d86ef5..8cca18b 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -2397,6 +2397,12 @@ describe("SMIL Animation Spec", function() { expect(begin.eventOffset).toBe(0); expect(begin.repeat).toBe(1); expect(begin.accessKey).toBe(""); + + begin.string = "accessKey(a)"; + expect(begin.parse().begin).toBe(0); + expect(begin.eventOffset).toBe(0); + expect(begin.repeat).toBe(0); + expect(begin.accessKey).toBe("a"); } ); /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ it("should be this for the value (the valid partion)", function() {