OSDN Git Service

Add the accessKey property to the object
authordhrname <dhrname@users.sourceforge.jp>
Wed, 21 Oct 2015 14:31:34 +0000 (23:31 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 21 Oct 2015 14:31:34 +0000 (23:31 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 082fced..39674aa 100644 (file)
@@ -222,7 +222,7 @@ base("$frame").mix ( {
     /*repeat(1)など文字列内に書かれたリピート回数*/\r
     repeat: 0,\r
     \r
-    /*accessKey("a")の"a"などキーイベントの対象となる文字列*/\r
+    /*accessKey(a)の"a"などキーイベントの対象となる文字列*/\r
     accessKey: "",\r
 \r
     /*trim メソッド\r
@@ -310,6 +310,8 @@ base("$frame").mix ( {
       }\r
       /*もしもあれば、リピートの回数を求める*/\r
       this.repeat = /repeat\((\d+)\)/.test(str) ? +RegExp.$1 : 0;\r
+      /*もしもあれば、押されるはずのキーを求める*/\r
+      this.accessKey = /accessKey\(([^\)]+?)\)/.test(str) ? RegExp.$1 : "";\r
       this.begin = Math.floor( this.begin * this.fpms);\r
       if (event) {\r
         ele = event.id ? this.eventTarget.ownerDocument.getElementById(event.id)\r
@@ -321,6 +323,11 @@ base("$frame").mix ( {
             if (evt.detail === this.repeat) {\r
               this.listener(evt);\r
             } }).bind(this), false);\r
+        } else if (this.accessKey) {\r
+          ele && ele.addEventListener("keydown", (function(evt) {\r
+          if (evt.detail === this.repeat) {\r
+              this.listener(evt);\r
+            } }).bind(this), false);\r
         } else {\r
           var evtName = /^(?:begin|end|repeat)$/.test(event.event) ? event.event + "Event"\r
                           : event.event;\r
index 1d86ef5..8cca18b 100644 (file)
@@ -2397,6 +2397,12 @@ describe("SMIL Animation Spec", function() {
         expect(begin.eventOffset).toBe(0);\r
         expect(begin.repeat).toBe(1);\r
         expect(begin.accessKey).toBe("");\r
+        \r
+        begin.string = "accessKey(a)";\r
+        expect(begin.parse().begin).toBe(0);\r
+        expect(begin.eventOffset).toBe(0);\r
+        expect(begin.repeat).toBe(0);\r
+        expect(begin.accessKey).toBe("a");\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion)", function() {\r