svnno****@sourc*****
svnno****@sourc*****
2010年 5月 12日 (水) 23:47:54 JST
Revision: 1819 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1819 Author: dhrname Date: 2010-05-12 23:47:54 +0900 (Wed, 12 May 2010) Log Message: ----------- 1, a要素の実装 2, cursorプロパティに関するバグを修正(autoがデフォルトでなかったのを修正) Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-05-11 14:36:17 UTC (rev 1818) +++ branches/ufltima/dom/svg.js 2010-05-12 14:47:54 UTC (rev 1819) @@ -776,33 +776,45 @@ } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ var tar = evt.target; + /*xlink:href属性とxml:base属性を手がかりに、 + *ハイパーリンクのURIを決定する処理を行う + */ if (tar.href.baseVal !== "") { //xlink:href属性が指定されたとき var base, href = tar.href.baseVal; var egbase = tar.xmlbase; if (!egbase) { var ep = tar.parentNode, b = null; - while(!b && ep) { + while (!b && ep) { b = ep.xmlbase; ep = ep.parentNode; } base = b; - if (!b) { //xml:baseの指定がなければ + if (!b) { //xml:baseの指定がなければ if (href.indexOf("#") !== 0) { //href属性において#が一番につかない場合 var lh = location.href; base = lh.replace(/\/[^\/]+?$/, "/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/ - } else{ + } else { base = location.href; } } - } else{ - base = egbase; + } else { + base = egbase; } - if (href.indexOf(":") === -1) { - tar.xmlbase = base; - } else{ - tar.xmlbase = ""; + if (href.indexOf(":") !== -1) { //絶対URIの場合 + base = ""; } - tar.href.baseVal = href; + var uri = base + href, show = tar.getAttributeNS("http://www.w3.org/1999/xlink", "show"); + if (href.indexOf(".") === 0) { //相対URIの場合 + uri = href; + } + if (!show) { + } else if (show === "replace") { + tar._tar.setAttribute("href", uri); + } else if (show === "new") { + tar._tar.setAttribute("target", "_blank"); + tar._tar.setAttribute("href", uri); + } else if (show === "embed") { + } } }, false); tar = evt = null; @@ -1854,7 +1866,7 @@ el.stroked = "false"; } var cursor = style.getPropertyValue("cursor"); - if (cursor !== "default" || cursor !== "") { + if (cursor !== "auto" && cursor !== "") { el.style.cursor = cursor; } style = cursor = null; @@ -3398,19 +3410,24 @@ SVGElement.apply(this, arguments); this._tar = document.createElement("a"); /*readonly SVGAnimatedString*/ this.target = new SVGAnimatedString(); - SVGURIReference.apply(this, arguments); this.addEventListener("DOMAttrModified", function(evt){ if (evt.attrName === "target") { evt.target.target.baseVal = evt.newValue; } }, false); this.addEventListener("DOMNodeInserted", function(evt){ + var tar = evt.target; if (evt.eventPhase === Event.BUBBLING_PHASE) { return; //強制終了させる } - var tar = evt.target; if (tar.parentNode._tar) { tar.parentNode._tar.appendChild(tar._tar); + var txts = tar._tar.style; + txts.cursor = "hand"; + txts.left = "0px"; + txts.top = "0px"; + txts.textDecoration = "none"; + txts = null; } var t = tar.target.baseVal; var st = "replace"; @@ -3420,6 +3437,17 @@ tar.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", st) tar = evt = null; }, false); + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ + var tar = evt.target; + if (tar._tar) { + var txts = tar._tar.style; + txts.cursor = "hand"; + txts.textDecoration = "none"; + txts = null; + } + return; //強制終了させる + }, true); + SVGURIReference.apply(this, arguments); return this; }; SVGAElement.constructor = SVGElement;