[Sie-announce] SIEコード [1645] DOMImplementationの整理

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 2月 6日 (土) 23:39:11 JST


Revision: 1645
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1645
Author:   dhrname
Date:     2010-02-06 23:39:11 +0900 (Sat, 06 Feb 2010)

Log Message:
-----------
DOMImplementationの整理

Modified Paths:
--------------
    branches/ufltima/core.js

Modified: branches/ufltima/core.js
===================================================================
--- branches/ufltima/core.js	2010-02-05 12:45:19 UTC (rev 1644)
+++ branches/ufltima/core.js	2010-02-06 14:39:11 UTC (rev 1645)
@@ -158,52 +158,60 @@
 /*DOMImplementation
  *DOMの基本的な機能をつかさどる
  */
-DOMImplementation = {};
-
-/* hasFeature
- *文字列によって、機能をサポートしているかどうかをチェックする。削除不可。
- */
-/*boolean*/ DOMImplementation.hasFeature = function(/*string*/ feature, version) {
-  switch (feature) {
-    case "CORE" :
-    case "XML" :
-    case "Events" :              //DOM level2 Eventを参照
-    case "StyleSheets" :         //DOM level2 StyleSheetを参照
-    case "org.w3c.svg.static" :  //SVG1.1の仕様を参照
-    case "org.w3c.dom.svg.static" :
-      return true;
-    default :
-      if (version === "2.0") {   //DOM level2 Coreにおいて策定されたバージョン情報
-        return true;
-      } else {
-        return false;
+DOMImplementation = {
+    /*_map
+     *この中に、名前空間とローカル名を手がかりとしたオブジェクトを収納しておく(DOMでは規定されていない)
+     */
+    _map: {},
+    /* hasFeature
+     *文字列によって、機能をサポートしているかどうかをチェックする。削除不可。
+     */
+    /*boolean*/ hasFeature : function(/*string*/ feature, version) {
+      switch (feature) {
+        case "CORE" :
+        case "XML" :
+        case "Events" :              //DOM level2 Eventを参照
+        case "StyleSheets" :         //DOM level2 StyleSheetを参照
+        case "org.w3c.svg.static" :  //SVG1.1の仕様を参照
+        case "org.w3c.dom.svg.static" :
+          return true;
+        default :
+          if (version === "2.0") {   //DOM level2 Coreにおいて策定されたバージョン情報
+            return true;
+          } else {
+            return false;
+          }
       }
-  }
-};
+    },
 
-/* createDocumentType
- *ドキュメントタイプを作るためのもの。削除可。
- */
-/*DocumentType*/ DOMImplementation.createDocumentType = function(/*string*/ qualifiedName, publicId, systemId) {
-  var s = new Node();
-  s.publicId = publicId;
-  s.systemId = systemId;
-  return s;
-};
+    /* createDocumentType
+     *ドキュメントタイプを作るためのもの。削除可。
+     */
+    /*DocumentType*/ createDocumentType : function(/*string*/ qualifiedName, publicId, systemId) {
+      var s = new Node();
+      s.publicId = publicId;
+      s.systemId = systemId;
+      return s;
+    },
+    /* createDocument
+     * ドキュメントオブジェクトを作るためのもの。削除不可。
+     */
+    /*Document*/ createDocument : function( /*string*/ ns, qname, /*DocumentType*/ doctype) {
+      try {
+        var s;
+        if (ns) {
+          s = new (DOMImplementation._map[ns].Document);
+        } else {
+          s = new Document();
+        }
+        s.documentElement = s.createElementNS(ns,qname); //ルート要素を作る
+        s.implementation = this;
+        s.doctype = doctype;
+        return s;
+      } catch(e){alert(e.message);}
+    }
+}
 
-/* createDocument
- * ドキュメントオブジェクトを作るためのもの。削除不可。
- */
-/*Document*/ DOMImplementation.createDocument = function( /*string*/ ns, qname, /*DocumentType*/ doctype) {
-  try {
-    var s =  new Document();
-    s.documentElement = s.createElementNS(ns,qname); //ルート要素を作る
-    s.implementation = this;
-    s.doctype = doctype;
-    return s;
-  } catch(e){alert(e.message);}
-};
-
 /* Node
  *ノード(節)はすべての雛形となる重要なものである。削除不可。
  *




Sie-announce メーリングリストの案内
Back to archive index