/*a要素の場合はtarをすりかえておく*/
tar = tar.firstChild;
}
- if ((eph === /*Event.CAPTURING_PHASE*/ 1) && (tar.nodeType === /*Node.TEXT_NODE*/ 3) && !!!tar._tars) {
+ if ((eph === /*Event.CAPTURING_PHASE*/ 1) && (tar.nodeType === /*Node.TEXT_NODE*/ 3) && !tar._tars) {
/*Textノードにdiv要素を格納したリストをプロパティとして蓄えておく*/
tar._tars = [];
var data = tar.data.replace(/^\s+/, "").replace(/\s+$/, "");
tar._tars[tar._tars.length] = d;
}
data = void 0;
- cur._length += tar._tars.length;
- } else if ((eph === /*Event.CAPTURING_PHASE*/ 1) && (tar instanceof SVGTextContentElement) && !!!tar._tars) {
- cur._length += tar._length;
}
evt = tar = cur = eph = void 0;
}, true);
+ this.addEventListener("DOMNodeRemoved", function(evt){
+ var tar = evt.target;
+ if ((evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) && (tar.nodeType === /*Node.TEXT_NODE*/ 3)) {
+ delete evt.currentTarget._length;
+ tar = evt = void 0;
+ }
+ }, false);
return this;
};
/*unsigned short*/ t.LENGTHADJUST_SPACING = 1;
/*unsigned short*/ t.LENGTHADJUST_SPACINGANDGLYPHS = 2;
t.prototype._list = null; //文字の位置を格納しておくリストのキャッシュ
- t.prototype._length = 0; //全文字数
+ t.prototype._length = null; //全文字数のキャッシュ
t.prototype._stx = t.prototype._sty = 0; //初めの文字の位置
t.prototype._chars = 0; //tspan (tref)要素が全体の何文字目から始まっているか
- t.prototype._isYokogaki = true; //横書きかどうか
+ t.prototype._isYokogaki = true; //横書きかどうか
/*long*/ t.prototype.getNumberOfChars = function() {
- return (this._length);
+ if (this._length) {
+ return (this._length);
+ } else {
+ var t = this.firstChild,
+ s = 0;
+ while (t) {
+ if (t.length && (t.nodeType === /*Node.TEXT_NODE*/ 3)) {
+ s += t.length;
+ } else if (t.getNumberOfChars) { //tspan要素などであれば
+ s += t.getNumberOfChars();
+ }
+ t = t.nextSibling;
+ }
+ this._length = s;
+ t = void 0;
+ return s;
+ }
};
/*float*/ t.prototype.getComputedTextLength = function() {
var l = this.textLength.baseVal;