-/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
- *公式ページは http://sie.sourceforge.jp/
- *利用方法は <script defer="defer" type="text/javascript" src="sie.js"></script>
- *http://sie.sourceforge.jp/
- *Usage: <script defer="defer" type="text/javascript" src="sie.js"></script>
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Mozilla SVG Cairo Renderer project.
- *
- * The Initial Developer of the Original Code is IBM Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Parts of this file contain code derived from the following files(s)
- * of the Mozilla SVG project (these parts are Copyright (C) by their
- * respective copyright-holders):
- * layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp
- *
- * Contributor(s):DHRNAME revulo
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-/*
-
-// File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.idl
-
-#ifndef _EVENTS_IDL_
-#define _EVENTS_IDL_
-
-#include "dom.idl"
-#include "views.idl"
-
-#pragma prefix "dom.w3c.org"
-module events
-{
-
- typedef dom::DOMString DOMString;
- typedef dom::DOMTimeStamp DOMTimeStamp;
- typedef dom::Node Node;
-
- interface EventListener;
- interface Event;
-*/
-/*EventExceptionクラス
- *イベント専用の例外クラス。
- */
-function EventException() {
- DOMException.call(this,arguments);
- if (this.code === 0) {
- this.message = "Uuspecified Event Type Error";
- }
- return this;
-};
-/*unsigned short EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0;*/
-
-EventException.prototype = Object._create(DOMException);
-
-
-/* // Introduced in DOM Level 2:
- interface EventTarget {*/
-/*void*/ Node.prototype.addEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {
- this.removeEventListener(type, listener, useCapture); //いったん、(あれば)リスナーを離す。
- var s = new EventListener(useCapture, type, listener), //リスナーを作成
- t = type.charAt(0),
- that;
- this._capter.push(s); //このノードにリスナーを登録しておく
- if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば
- that = this;
- that._tar && that._tar.attachEvent("on" +type, (function(node, type) {
- return function(){
- var evt = node.ownerDocument.createEvent("MouseEvents");
- evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0);
- node.dispatchEvent(evt);
- /*cancelBubbleプロパティについては、IEのMSDNなどを参照*/
- node.ownerDocument._window.event.cancelBubble = true;
- evt = void 0;
- };
- })(that, type)
- );
- }
- type = listener = useCapture = s = t = that = void 0;
-};
-/*void*/ Node.prototype.removeEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {
- var tce = this._capter;
- for (var i=0,tcli=tce.length;i<tcli;i++){
- if (tce[i]._listener === listener) { //登録したリスナーと一致すれば
- tce[i] = void 0;
- }
- }
- i = tcli = tce = void 0;
-};
-/*boolean*/ Node.prototype.dispatchEvent = function( /*Event*/ evt) {
- if (!evt.type) { //Eventの型が設定されていないとき
- throw new EventException(/*EventException.UNSPECIFIED_EVENT_TYPE_ERR*/ 0);
- }
- var te = this,
- td = te.ownerDocument,
- etime = evt.timeStamp,
- etype = evt.type,
- ebub = evt.bubbles,
- tob,
- toli,
- type = /*Event.CAPTURING_PHASE*/ 1,
- ecptype = /*Event.CAPTURING_PHASE*/ "1",
- ebptype = /*Event.BUBBLING_PHASE*/ "3",
- tce;
- if (!td._isLoaded) {
- /*以下では、画像の処理に時間がかかりそうな場合、処理落ちとして、遅延処理
- *を行い、バッファリングにイベント送付処理をためていく作業となる
- */
- if (!td._limit_time_) {
- td._limit_time_ = etime;
- } else if ((etime - td._limit_time_) > 1000) {
- /*1秒を超えたらバッファにため込んで後で使う*/
- tob = td.implementation._buffer_ || [];
- toli = tob.length
- tob[toli] = this;
- tob[toli+1] = evt;
- td.implementation._buffer_ = tob;
- te = td = etime = etype = ebub = tob = toli = type = void 0;
- return true;
- }
- }
- evt.target = te;
- evt.eventPhase = 1;//Event.CAPTURING_PHASE
- //このノードからドキュメントノードにいたるまでの、DOMツリーのリストを作成しておく
- td[ebptype] = null;
- /*以下の処理では、documentElementのparentNodeが
- *Documentノードではなく、nullになっていることを前提としている。
- *したがって、documentElementのparentNodeがもし、Documentノードのオブジェクトならば、以下を書き換えるべきである
- */
- while (te.parentNode) {
- te.parentNode[ecptype] = te;
- te[ebptype] = te.parentNode;
- te = te.parentNode;
- }
- td[ecptype] = te;
- te[ebptype] = td;
- /*最初に捕獲フェーズでDOMツリーを下っていき、イベントのターゲットについたら、
- *そこで、浮上フェーズとして折り返すように、反復処理をおこなう。
- */
- te = this;
- while (td) {
- evt.currentTarget = td;
- if (td === te) { //イベントのターゲットに到着(折り返し地点)
- type = 2;//Event.AT_TARGET;
- }
- evt.eventPhase = type;
- tce = td._capter; //tceは登録しておいたリスナーのリスト
- for (var j=0,tcli=tce.length;j<tcli;++j){
- if (tce[j] && (etype === tce[j]._type)) {
- tce[j].handleEvent(evt);
- }
- }
- if (evt._stop) {
- break; //stopPropagationメソッドが呼ばれたら、停止する
- }
- if (td === te) {
- if (!ebub) {
- break; //浮上フェーズに移行せず、停止する
- }
- type = 3;//Event.BUBBLING_PHASE;
- }
- td = td[type];
- }
- var ed = evt._default;
- evt = te = tce = n = td = type = tob = j = tcli = etype = etime = ebub = ecptype = ebptype = void 0;
- return ed;
-};
-
-function EventListener(cap,type,listener) {
- this._cap = cap;
- this._type = type;
- this._listener = listener;
- return this;
-};
-
-EventListener.prototype = {
-/*void*/ handleEvent : function( /*Event*/ evt) {
- try {
- var ph = evt.eventPhase,
- cap = this._cap;
- if (ph === /*Event.CAPTURING_PHASE*/ 1) { //イベントフェーズが捕獲段階であることを示し
- cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。
- }
- if (!cap && (evt.type === this._type)) {
- this._listener(evt);
- }
- evt = ph = cap = void 0;
- } catch (e) {
-
- }
- }
-};
-
-/*Eventクラス
- *イベントの雛形となる。プロパティもすべて含めて、必須
- */
-function Event() {
- return this;
-};
-// PhaseType
-/*unsigned short Event.CAPTURING_PHASE = 1;
-/*unsigned short Event.AT_TARGET = 2;
-/*unsigned short Event.BUBBLING_PHASE = 3;*/
-
-Event.prototype = {
- /*DOMTimeStamp*/ timeStamp : 0,
- /*DOMString*/ type : null,
- /*EventTarget*/ target : null,
- /*EventTarget*/ currentTarget : null,
- /*unsigned short*/ eventPhase : /*Event.CAPTURING_PHASE*/ 1,
- /*boolean*/ bubbles : false,
- /*boolean*/ cancelable : false,
- _stop : false, //stopPropagationメソッドで使う
- _default : true, //preventDefaultメソッドで使う
- /*void*/ stopPropagation : function(){
- this._stop = true;
- },
- /*void*/ preventDefault : function(){
- if (this.cancelable) {
- this._default = false;
- /*IEのみで使えるreturnValueプロパティ*/
- this.target.ownerDocument._window.event.returnValue = false;
- }
- },
- /*void*/ initEvent : function( /*string*/ eventTypeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg) {
- this.type = eventTypeArg;
- this.bubbles = canBubbleArg;
- this.cancelable = cancelableArg;
- eventTypeArg = canBubbleArg = cancelableArg = void 0;
- }
-};
-/*Documentノードに直接結びつける
-function DocumentEvent() {
- return this;
-}*/
-/*Event*/ Document.prototype.createEvent = function( /*string*/ eventType) {
- var evt,
- tc = this._cevent[eventType];
- if (tc) {
- evt = new tc();
- } else if (eventType === "SVGEvents") {
- evt = new SVGEvent();
- } else if (eventType === "TimeEvents") {
- evt = new TimeEvent();
- } else {
- evt = new Event();
- }
- evt.type = eventType;
- evt.timeStamp = +(new Date());
- tc = eventType = void 0;
- return evt;
-};
-
-function UIEvent() {
-/*views::AbstractView*/ this.view;
-/*long*/ this.detail = 0;
- return this;
-};
-
-UIEvent.prototype = Object._create(Event);
-/*void*/ UIEvent.prototype.initUIEvent = function( /*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*views::AbstractView*/ viewArg, /*long*/ detailArg) {
- this.initEvent(typeArg, canBubbleArg, cancelableArg);
- this.detail = detailArg;
- this.view = viewArg;
-};
-function MouseEvent(evt) {
- UIEvent.call(this, arguments);
-/*long*/ this.screenX;
-/*long*/ this.screenY;
-/*long*/ this.clientX = this.clientY = 0;
-/*boolean*/ this.ctrlKey = this.shiftKey = this.altKey = this.metaKey = false;
-/*unsigned short*/ this.button;
-/*EventTarget*/ this.relatedTarget;
- return this;
-};
-MouseEvent.prototype = Object._create(UIEvent);
-/*void*/ MouseEvent.prototype.initMouseEvent = function( /*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*views::AbstractView*/ viewArg, /*long*/ detailArg, /*long*/ screenXArg, /*long*/ screenYArg, /*long*/ clientXArg, /*long*/ clientYArg, /*boolean*/ ctrlKeyArg, /*boolean*/ altKeyArg, /*boolean*/ shiftKeyArg, /*boolean*/ metaKeyArg, /*unsigned short*/ buttonArg, /*EventTarget*/ relatedTargetArg) {
- this.initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
- this.screenX = screenXArg;
- this.screenY = screenYArg;
- this.clientX = clientXArg;
- this.clientY = clientYArg;
- this.ctrlKey = ctrlKeyArg;
- this.shiftKey = shiftKeyArg;
- this.altKey = altKeyArg;
- this.metaKey = metaKeyArg;
- this.button = buttonArg;
- this.relatedTarget = relatedTargetArg;
-};
-
-function MutationEvent(){
- return this;
-};
-MutationEvent.prototype = Object._create(Event);
-(function() {
-/*void*/ this.initMutationEvent = function(/*string*/ typeArg, /*boolean*/ canBubbleArg,
- /*boolean*/ cancelableArg, /*Node*/ relatedNodeArg, /*string*/ prevValueArg, /*string*/ newValueArg,
- /*string*/ attrNameArg, /*unsigned short*/ attrChangeArg) {
- this.initEvent(typeArg, canBubbleArg, cancelableArg);
- this.relatedNode = relatedNodeArg;
- this.prevValue = prevValueArg;
- this.newValue = newValueArg;
- this.attrName = attrNameArg;
- this.attrChange = attrChangeArg;
- typeArg = canBubbleArg = cancelableArg = relatedNodeArg = prevValueArg = newValueArg = attrNameArg = attrChangeArg = void 0;
- };
- /*Node*/ this.relatedNode = null;
- /*string*/ this.prevValue = this.newValue = this.attrName = null;
- /*unsigned short*/ this.attrChange = 2;
-}).apply(MutationEvent.prototype);
- // attrChangeType
-/*unsigned short MutationEvent.MODIFICATION = 1;
-/*unsigned short MutationEvent.ADDITION = 2;
-/*unsigned short MutationEvent.REMOVAL = 3;*/
-
-/*MutationEventsの発動のために、setAttributeNodeNSを上書きする。ファイル統合やmakeの際は、
- *重複するのでコアモジュールのメソッドは削除する。モジュールテストを行うために、
- *このような形式をとることにする。なお、追加部分には区別を付けるために、前後にコメントを挿入する。
- */
-/*Attr*/ Element.prototype.setAttributeNodeNS = function( /*Attr*/ newAttr){
- if (newAttr.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合
- throw (new DOMException(/*DOMException.WRONG_DOCUMENT_ERR*/ 4));
- }
- var s = this.attributes.setNamedItemNS(newAttr);
- newAttr.ownerElement = this;
- if ((newAttr.localName === "id") && !this.ownerDocument._id[newAttr.nodeValue]) { //id属性であったならば
- this.ownerDocument._id[newAttr.nodeValue] = this; //ドキュメントに登録しておく
- }
- /*ここから*/
- var evt = this.ownerDocument.createEvent("MutationEvents");
- if (!s) { //ノードがなければ
- /*initMutationEventメソッドは軽量化のため省略する*/
- evt.initEvent("DOMAttrModified", true, false);
- evt.relatedNode = newAttr;
- evt.newValue = newAttr.nodeValue;
- evt.attrName = newAttr.nodeName;
- } else {
- evt.initMutationEvent("DOMAttrModified", true, false, newAttr, s.nodeValue, newAttr.nodeValue, newAttr.nodeName, /*MutationEvent.MODIFICATION*/ 1);
- }
- this.dispatchEvent(evt); //このとき、MutationEventsが発動
- evt = void 0;
- /*ここまで追加*/
- return s;
-};
-
-/*Node*/ Node.prototype.insertBefore = function( /*Node*/ n, ref) {
- var tp = this.parentNode,
- rp, evt,
- te = this,
- j = 0,
- t,
- s, descend, di;
- while (tp) { //先祖をたどっていく
- if (tp === n) { //先祖要素が追加ノードならばエラー
- throw (new DOMException(/*DOMException.HIERARCHY_REQUEST_ERR*/ 3));
- }
- tp = tp.parentNode;
- }
- if (this.ownerDocument !== n.ownerDocument) { //所属Documentの生成元が違うならば
- throw (new DOMException(/*DOMException.WRONG_DOCUMENT_ERR*/ 4));
- }
- if (n.parentNode) { //親要素があれば
- n.parentNode.removeChild(n);
- }
- if (!ref) {
- /*参照要素がNULLの場合、要素を追加する(appendChildと同じ効果)*/
- if (!this.firstChild) {
- this.firstChild = n;
- }
- if (this.lastChild) {
- n.previousSibling = this.lastChild;
- this.lastChild.nextSibling = n;
- }
- this.lastChild = n;
- this.childNodes.push(n);
- n.nextSibling = null;
- } else {
- if (ref.parentNode !== this) { //参照ノードが子要素でない場合
- throw (new DOMException(/*DOMException.NOT_FOUND_ERR*/ 8));
- }
- t = this.firstChild;
- if (t === ref) {
- this.firstChild = n;
- }
- while (t) {
- if (t === ref) {
- this.childNodes.splice(j, 1, n, ref); //Arrayのspliceを利用して、リストにnノードを追加
- break;
- }
- ++j;
- t = t.nextSibling;
- }
- rp = ref.previousSibling;
- if (rp) {
- rp.nextSibling = n;
- }
- ref.previousSibling = n;
- n.previousSibling = rp;
- n.nextSibling = ref;
- }
- n.parentNode = this;
- if ((n.nodeType===/*Node.ENTITY_REFERENCE_NODE*/ 5) || (n.nodeType===/*Node.DOCUMENT_FRAGMENT_NODE*/ 11)) {
- /*実体参照や、文書フラグメントノードだけは子ノードを検索して、
- *それらを直接文書に埋め込む作業を以下で行う
- */
- var ch = n.childNodes.concat([]); //Arrayのコピー
- for (var i=0,chli=ch.length;i<chli;i++) {
- this.insertBefore(ch[i], n);
- }
- ch = void 0;
- }
- /*ここから*/
- evt = this.ownerDocument.createEvent("MutationEvents");
- evt.initMutationEvent("DOMNodeInserted", true, false, this, null, null, null, null);
- n.dispatchEvent(evt);
- /*以下のDOMNodeInsertedIntoDocumentイベントは、間接的、あるいは直接ノードが
- *挿入されたときに発火する。間接的な挿入とは、サブツリーを作っておいて、それをいっぺんに挿入する場合など。
- *このイベントは浮上しないことに注意を要する
- */
- do {
- s = te;
- te = te.parentNode;
- } while (te);
- if (s !== this.ownerDocument.documentElement) {
- evt = descend = tp = rp = te = s = di = void 0;
- return n;
- }
- evt = this.ownerDocument.createEvent("MutationEvents");
- evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
- n.dispatchEvent(evt);
- if (!n.hasChildNodes()) { //子ノードがないので終了
- return n;
- }
- if (n.getElementsByTagNameNS) {
- descend = n.getElementsByTagNameNS("*", "*"); //全子孫要素を取得
- } else {
- descend = n.childNodes;
- }
- if (descend) {
- for (var i=0,dli=descend.length;i<dli;++i) {
- di = descend[i];
- di.dispatchEvent(evt);
- di = null;
- }
- }
- evt = descend = tp = rp = j = t = te = s = di = void 0;
- return n;
-};
-
-/*Node*/ Node.prototype.removeChild = function( /*Node*/ ele) {
- if (!(ele instanceof Node)) { //Nodeでなければ
- throw (new Error());
- }
- if (ele.parentNode !== this) { //親が違う場合
- throw (new DOMException(/*DOMException.NOT_FOUND_ERR*/ 8));
- }
- if (ele.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合
- throw (new Error());
- }
- /*ここから*/
- var evt = this.ownerDocument.createEvent("MutationEvents"),
- descend;
- /*以下のDOMNodeRemovedFromDocumentイベントは、間接的、あるいは直接ノードが
- *除去されたときに発火する。間接的な除去とは、サブツリーをいっぺんに除去する場合など。
- *このイベントは浮上しないことに注意を要する
- */
- evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);
- ele.dispatchEvent(evt);
- if (ele.getElementsByTagNameNS) {
- descend = ele.getElementsByTagNameNS("*", "*"); //全子孫要素を取得
- } else {
- descend = ele.childNodes;
- }
- if (descend) {
- evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);
- for (var i=0,dli=descend.length;i<dli;++i) {
- var di = descend[i];
- evt.target = di;
- di.dispatchEvent(evt);
- di = void 0;
- }
- }
- evt.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null);
- ele.dispatchEvent(evt);
- evt = descend = void 0;
- /*ここまで追加*/
- ele.parentNode = null;
- var t = this.firstChild,
- j = 0;
- while (t) {
- if (t === ele) {
- this.childNodes.splice(j, 1); //Arrayのspliceを利用して、リストからeleノードを排除
- break;
- }
- ++j;
- t = t.nextSibling;
- }
- if (this.firstChild === ele) {
- this.firstChild = ele.nextSibling;
- }
- if (this.lastChild === ele) {
- this.lastChild = ele.previousSibling;
- }
- ele.previousSibling && (ele.previousSibling.nextSibling = ele.nextSibling);
- ele.nextSibling && (ele.nextSibling.previousSibling = ele.previousSibling);
- ele.nextSibling = ele.previousSibling = null;
- t = j = void 0;
- return ele;
-};
-
-/*void*/ CharacterData.prototype.appendData = function( /*string*/ arg) {
- var pd = this.data,
- evt;
- this.data += arg;
- this.length = this.data.length;
- /*ここから*/
- evt = this.ownerDocument.createEvent("MutationEvents");
- evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);
- this.parentNode.dispatchEvent(evt);
- evt = arg = pd = void 0;
- /*ここまで追加*/
-};
-/*void*/ CharacterData.prototype.insertData = function( /*long*/ offset, /*string*/ arg) {
- var pd = this.data,
- pre = this.substring(0, offset - 1), //文字列を二つに分けた、前半部分
- next = this.substring(offset, this.length - offset), //後半部分
- evt;
- this.data = pre + this.data + next;
- this.length = this.data.length;
- /*ここから*/
- evt = this.ownerDocument.createEvent("MutationEvents");
- evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);
- this.parentNode.dispatchEvent(evt);
- evt = arg = pd = pre = next = void 0;
- /*ここまで追加*/
-};
-/*void*/ CharacterData.prototype.deleteData = function( /*long*/ offset, /*long*/ count) {
- var pd = this.data;
- pre = this.substring(0, offset - 1), //残すべき前半部分
- next = this.substring(offset + count, this.length - 1), //後半部分
- evt;
- if (offset + count > this.length) { //offsetとcountの和が文字全体の長さを超える場合、offsetから最後までのを削除
- next = "";
- }
- this.data = pre + next;
- this.length = this.data.length;
- /*ここから*/
- evt = this.ownerDocument.createEvent("MutationEvents");
- evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);
- this.parentNode.dispatchEvent(evt);
- evt = pd = void 0;
- /*ここまで追加*/
-};
-
-/*_ceventプロパティはcreateEventメソッドで軽量化のために使う。*/
-Document.prototype._cevent = {
- "MutationEvents" : MutationEvent,
- "MouseEvents" : MouseEvent,
- "UIEvents" : UIEvent
-};
-
-
-// _EVENTS_IDL_
+/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence\r
+ *公式ページは http://sie.sourceforge.jp/\r
+ *利用方法は <script defer="defer" type="text/javascript" src="sie.js"></script>\r
+ *http://sie.sourceforge.jp/\r
+ *Usage: <script defer="defer" type="text/javascript" src="sie.js"></script>\r
+ */\r
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is the Mozilla SVG Cairo Renderer project.\r
+ *\r
+ * The Initial Developer of the Original Code is IBM Corporation.\r
+ * Portions created by the Initial Developer are Copyright (C) 2004\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Parts of this file contain code derived from the following files(s)\r
+ * of the Mozilla SVG project (these parts are Copyright (C) by their\r
+ * respective copyright-holders):\r
+ * layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp\r
+ *\r
+ * Contributor(s):DHRNAME revulo\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either of the GNU General Public License Version 2 or later (the "GPL"),\r
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),\r
+ * in which case the provisions of the GPL or the LGPL are applicable instead\r
+ * of those above. If you wish to allow use of your version of this file only\r
+ * under the terms of either the GPL or the LGPL, and not to allow others to\r
+ * use your version of this file under the terms of the MPL, indicate your\r
+ * decision by deleting the provisions above and replace them with the notice\r
+ * and other provisions required by the GPL or the LGPL. If you do not delete\r
+ * the provisions above, a recipient may use your version of this file under\r
+ * the terms of any one of the MPL, the GPL or the LGPL.\r
+ *\r
+ * ***** END LICENSE BLOCK ***** */\r
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+/*\r
+\r
+// File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.idl\r
+\r
+#ifndef _EVENTS_IDL_\r
+#define _EVENTS_IDL_\r
+\r
+#include "dom.idl"\r
+#include "views.idl"\r
+\r
+#pragma prefix "dom.w3c.org"\r
+module events\r
+{\r
+\r
+ typedef dom::DOMString DOMString;\r
+ typedef dom::DOMTimeStamp DOMTimeStamp;\r
+ typedef dom::Node Node;\r
+\r
+ interface EventListener;\r
+ interface Event;\r
+*/\r
+/*EventExceptionクラス\r
+ *イベント専用の例外クラス。\r
+ */\r
+function EventException() {\r
+ DOMException.call(this,arguments);\r
+ if (this.code === 0) {\r
+ this.message = "Uuspecified Event Type Error";\r
+ }\r
+ return this;\r
+};\r
+/*unsigned short EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0;*/\r
+\r
+EventException.prototype = Object._create(DOMException);\r
+\r
+\r
+/* // Introduced in DOM Level 2:\r
+ interface EventTarget {*/\r
+/*void*/ Node.prototype.addEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {\r
+ this.removeEventListener(type, listener, useCapture); //いったん、(あれば)リスナーを離す。\r
+ var s = new EventListener(useCapture, type, listener), //リスナーを作成\r
+ t = type.charAt(0),\r
+ that;\r
+ this._capter.push(s); //このノードにリスナーを登録しておく\r
+ if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば\r
+ that = this;\r
+ that._tar && that._tar.attachEvent("on" +type, (function(node, type) { \r
+ return function(){\r
+ var evt = node.ownerDocument.createEvent("MouseEvents");\r
+ evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0);\r
+ node.dispatchEvent(evt);\r
+ /*cancelBubbleプロパティについては、IEのMSDNなどを参照*/\r
+ node.ownerDocument._window.event.cancelBubble = true;\r
+ evt = void 0;\r
+ };\r
+ })(that, type)\r
+ );\r
+ }\r
+ type = listener = useCapture = s = t = that = void 0;\r
+};\r
+/*void*/ Node.prototype.removeEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {\r
+ var tce = this._capter;\r
+ for (var i=0,tcli=tce.length;i<tcli;i++){\r
+ if (tce[i]._listener === listener) { //登録したリスナーと一致すれば\r
+ tce[i] = void 0;\r
+ }\r
+ }\r
+ i = tcli = tce = void 0;\r
+};\r
+/*boolean*/ Node.prototype.dispatchEvent = function( /*Event*/ evt) {\r
+ if (!evt.type) { //Eventの型が設定されていないとき\r
+ throw new EventException(/*EventException.UNSPECIFIED_EVENT_TYPE_ERR*/ 0);\r
+ }\r
+ var te = this,\r
+ td = te.ownerDocument,\r
+ etime = evt.timeStamp,\r
+ etype = evt.type,\r
+ ebub = evt.bubbles,\r
+ tob,\r
+ toli,\r
+ type = /*Event.CAPTURING_PHASE*/ 1,\r
+ ecptype = /*Event.CAPTURING_PHASE*/ "1",\r
+ ebptype = /*Event.BUBBLING_PHASE*/ "3",\r
+ tce;\r
+ if (!td._isLoaded) {\r
+ /*以下では、画像の処理に時間がかかりそうな場合、処理落ちとして、遅延処理\r
+ *を行い、バッファリングにイベント送付処理をためていく作業となる\r
+ */\r
+ if (!td._limit_time_) {\r
+ td._limit_time_ = etime;\r
+ } else if ((etime - td._limit_time_) > 1000) {\r
+ /*1秒を超えたらバッファにため込んで後で使う*/\r
+ tob = td.implementation._buffer_ || [];\r
+ toli = tob.length;\r
+ tob[toli] = this;\r
+ tob[toli+1] = evt;\r
+ td.implementation._buffer_ = tob;\r
+ te = td = etime = etype = ebub = tob = toli = type = void 0;\r
+ return true;\r
+ }\r
+ }\r
+ evt.target = te;\r
+ evt.eventPhase = 1;//Event.CAPTURING_PHASE\r
+ //このノードからドキュメントノードにいたるまでの、DOMツリーのリストを作成しておく\r
+ td[ebptype] = null;\r
+ /*以下の処理では、documentElementのparentNodeが\r
+ *Documentノードではなく、nullになっていることを前提としている。\r
+ *したがって、documentElementのparentNodeがもし、Documentノードのオブジェクトならば、以下を書き換えるべきである\r
+ */\r
+ while (te.parentNode) {\r
+ te.parentNode[ecptype] = te;\r
+ te[ebptype] = te.parentNode;\r
+ te = te.parentNode;\r
+ }\r
+ td[ecptype] = te;\r
+ te[ebptype] = td;\r
+ /*最初に捕獲フェーズでDOMツリーを下っていき、イベントのターゲットについたら、\r
+ *そこで、浮上フェーズとして折り返すように、反復処理をおこなう。\r
+ */\r
+ te = this;\r
+ while (td) {\r
+ evt.currentTarget = td;\r
+ if (td === te) { //イベントのターゲットに到着(折り返し地点)\r
+ type = 2;//Event.AT_TARGET;\r
+ }\r
+ evt.eventPhase = type;\r
+ tce = td._capter; //tceは登録しておいたリスナーのリスト\r
+ for (var j=0,tcli=tce.length;j<tcli;++j){\r
+ if (tce[j] && (etype === tce[j]._type)) {\r
+ tce[j].handleEvent(evt);\r
+ }\r
+ }\r
+ if (evt._stop) {\r
+ break; //stopPropagationメソッドが呼ばれたら、停止する\r
+ }\r
+ if (td === te) {\r
+ if (!ebub) {\r
+ break; //浮上フェーズに移行せず、停止する\r
+ }\r
+ type = 3;//Event.BUBBLING_PHASE;\r
+ }\r
+ td = td[type];\r
+ }\r
+ var ed = evt._default;\r
+ evt = te = tce = n = td = type = tob = j = tcli = etype = etime = ebub = ecptype = ebptype = void 0;\r
+ return ed;\r
+};\r
+\r
+function EventListener(cap,type,listener) {\r
+ this._cap = cap;\r
+ this._type = type;\r
+ this._listener = listener;\r
+ return this;\r
+};\r
+\r
+EventListener.prototype = {\r
+/*void*/ handleEvent : function( /*Event*/ evt) {\r
+ try {\r
+ var ph = evt.eventPhase,\r
+ cap = this._cap;\r
+ if (ph === /*Event.CAPTURING_PHASE*/ 1) { //イベントフェーズが捕獲段階であることを示し\r
+ cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。\r
+ }\r
+ if (!cap && (evt.type === this._type)) {\r
+ this._listener(evt);\r
+ }\r
+ evt = ph = cap = void 0;\r
+ } catch (e) {\r
+ \r
+ }\r
+ }\r
+};\r
+\r
+/*Eventクラス\r
+ *イベントの雛形となる。プロパティもすべて含めて、必須\r
+ */\r
+function Event() {\r
+ return this;\r
+};\r
+// PhaseType\r
+/*unsigned short Event.CAPTURING_PHASE = 1;\r
+/*unsigned short Event.AT_TARGET = 2;\r
+/*unsigned short Event.BUBBLING_PHASE = 3;*/\r
+\r
+Event.prototype = {\r
+ /*DOMTimeStamp*/ timeStamp : 0,\r
+ /*DOMString*/ type : null,\r
+ /*EventTarget*/ target : null,\r
+ /*EventTarget*/ currentTarget : null,\r
+ /*unsigned short*/ eventPhase : /*Event.CAPTURING_PHASE*/ 1,\r
+ /*boolean*/ bubbles : false,\r
+ /*boolean*/ cancelable : false,\r
+ _stop : false, //stopPropagationメソッドで使う\r
+ _default : true, //preventDefaultメソッドで使う\r
+ /*void*/ stopPropagation : function(){\r
+ this._stop = true;\r
+ },\r
+ /*void*/ preventDefault : function(){\r
+ if (this.cancelable) {\r
+ this._default = false;\r
+ /*IEのみで使えるreturnValueプロパティ*/\r
+ this.target.ownerDocument._window.event.returnValue = false;\r
+ }\r
+ },\r
+ /*void*/ initEvent : function( /*string*/ eventTypeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg) {\r
+ this.type = eventTypeArg;\r
+ this.bubbles = canBubbleArg;\r
+ this.cancelable = cancelableArg;\r
+ eventTypeArg = canBubbleArg = cancelableArg = void 0;\r
+ }\r
+};\r
+/*Documentノードに直接結びつける\r
+function DocumentEvent() {\r
+ return this;\r
+}*/\r
+/*Event*/ Document.prototype.createEvent = function( /*string*/ eventType) {\r
+ var evt,\r
+ tc = this._cevent[eventType];\r
+ if (tc) {\r
+ evt = new tc();\r
+ } else if (eventType === "SVGEvents") {\r
+ evt = new SVGEvent();\r
+ } else if (eventType === "TimeEvents") {\r
+ evt = new TimeEvent();\r
+ } else {\r
+ evt = new Event();\r
+ }\r
+ evt.type = eventType;\r
+ evt.timeStamp = +(new Date());\r
+ tc = eventType = void 0;\r
+ return evt;\r
+};\r
+\r
+function UIEvent() {\r
+/*views::AbstractView*/ this.view;\r
+/*long*/ this.detail = 0;\r
+ return this;\r
+};\r
+\r
+UIEvent.prototype = Object._create(Event);\r
+/*void*/ UIEvent.prototype.initUIEvent = function( /*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*views::AbstractView*/ viewArg, /*long*/ detailArg) {\r
+ this.initEvent(typeArg, canBubbleArg, cancelableArg);\r
+ this.detail = detailArg;\r
+ this.view = viewArg;\r
+};\r
+function MouseEvent(evt) {\r
+ UIEvent.call(this, arguments);\r
+/*long*/ this.screenX;\r
+/*long*/ this.screenY;\r
+/*long*/ this.clientX = this.clientY = 0;\r
+/*boolean*/ this.ctrlKey = this.shiftKey = this.altKey = this.metaKey = false;\r
+/*unsigned short*/ this.button;\r
+/*EventTarget*/ this.relatedTarget;\r
+ return this;\r
+};\r
+MouseEvent.prototype = Object._create(UIEvent);\r
+/*void*/ MouseEvent.prototype.initMouseEvent = function( /*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*views::AbstractView*/ viewArg, /*long*/ detailArg, /*long*/ screenXArg, /*long*/ screenYArg, /*long*/ clientXArg, /*long*/ clientYArg, /*boolean*/ ctrlKeyArg, /*boolean*/ altKeyArg, /*boolean*/ shiftKeyArg, /*boolean*/ metaKeyArg, /*unsigned short*/ buttonArg, /*EventTarget*/ relatedTargetArg) {\r
+ this.initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);\r
+ this.screenX = screenXArg;\r
+ this.screenY = screenYArg;\r
+ this.clientX = clientXArg;\r
+ this.clientY = clientYArg;\r
+ this.ctrlKey = ctrlKeyArg;\r
+ this.shiftKey = shiftKeyArg;\r
+ this.altKey = altKeyArg;\r
+ this.metaKey = metaKeyArg;\r
+ this.button = buttonArg;\r
+ this.relatedTarget = relatedTargetArg;\r
+};\r
+\r
+function MutationEvent(){\r
+ return this;\r
+};\r
+MutationEvent.prototype = Object._create(Event);\r
+(function() {\r
+/*void*/ this.initMutationEvent = function(/*string*/ typeArg, /*boolean*/ canBubbleArg,\r
+ /*boolean*/ cancelableArg, /*Node*/ relatedNodeArg, /*string*/ prevValueArg, /*string*/ newValueArg,\r
+ /*string*/ attrNameArg, /*unsigned short*/ attrChangeArg) {\r
+ this.initEvent(typeArg, canBubbleArg, cancelableArg);\r
+ this.relatedNode = relatedNodeArg;\r
+ this.prevValue = prevValueArg;\r
+ this.newValue = newValueArg;\r
+ this.attrName = attrNameArg;\r
+ this.attrChange = attrChangeArg;\r
+ typeArg = canBubbleArg = cancelableArg = relatedNodeArg = prevValueArg = newValueArg = attrNameArg = attrChangeArg = void 0;\r
+ };\r
+ /*Node*/ this.relatedNode = null;\r
+ /*string*/ this.prevValue = this.newValue = this.attrName = null;\r
+ /*unsigned short*/ this.attrChange = 2;\r
+}).apply(MutationEvent.prototype);\r
+ // attrChangeType\r
+/*unsigned short MutationEvent.MODIFICATION = 1;\r
+/*unsigned short MutationEvent.ADDITION = 2;\r
+/*unsigned short MutationEvent.REMOVAL = 3;*/\r
+\r
+/*MutationEventsの発動のために、setAttributeNodeNSを上書きする。ファイル統合やmakeの際は、\r
+ *重複するのでコアモジュールのメソッドは削除する。モジュールテストを行うために、\r
+ *このような形式をとることにする。なお、追加部分には区別を付けるために、前後にコメントを挿入する。\r
+ */\r
+/*Attr*/ Element.prototype.setAttributeNodeNS = function( /*Attr*/ newAttr){\r
+ if (newAttr.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合\r
+ throw (new DOMException(/*DOMException.WRONG_DOCUMENT_ERR*/ 4));\r
+ }\r
+ var s = this.attributes.setNamedItemNS(newAttr);\r
+ newAttr.ownerElement = this;\r
+ if ((newAttr.localName === "id") && !this.ownerDocument._id[newAttr.nodeValue]) { //id属性であったならば\r
+ this.ownerDocument._id[newAttr.nodeValue] = this; //ドキュメントに登録しておく\r
+ }\r
+ /*ここから*/\r
+ var evt = this.ownerDocument.createEvent("MutationEvents");\r
+ if (!s) { //ノードがなければ\r
+ /*initMutationEventメソッドは軽量化のため省略する*/\r
+ evt.initEvent("DOMAttrModified", true, false);\r
+ evt.relatedNode = newAttr;\r
+ evt.newValue = newAttr.nodeValue;\r
+ evt.attrName = newAttr.nodeName;\r
+ } else {\r
+ evt.initMutationEvent("DOMAttrModified", true, false, newAttr, s.nodeValue, newAttr.nodeValue, newAttr.nodeName, /*MutationEvent.MODIFICATION*/ 1);\r
+ }\r
+ this.dispatchEvent(evt); //このとき、MutationEventsが発動\r
+ evt = void 0;\r
+ /*ここまで追加*/\r
+ return s;\r
+};\r
+\r
+/*Node*/ Node.prototype.insertBefore = function( /*Node*/ n, ref) {\r
+ var tp = this.parentNode,\r
+ rp, evt,\r
+ te = this,\r
+ j = 0,\r
+ t,\r
+ s, descend, di;\r
+ while (tp) { //先祖をたどっていく\r
+ if (tp === n) { //先祖要素が追加ノードならばエラー\r
+ throw (new DOMException(/*DOMException.HIERARCHY_REQUEST_ERR*/ 3));\r
+ }\r
+ tp = tp.parentNode;\r
+ }\r
+ if (this.ownerDocument !== n.ownerDocument) { //所属Documentの生成元が違うならば\r
+ throw (new DOMException(/*DOMException.WRONG_DOCUMENT_ERR*/ 4));\r
+ }\r
+ if (n.parentNode) { //親要素があれば\r
+ n.parentNode.removeChild(n);\r
+ }\r
+ if (!ref) {\r
+ /*参照要素がNULLの場合、要素を追加する(appendChildと同じ効果)*/\r
+ if (!this.firstChild) {\r
+ this.firstChild = n;\r
+ }\r
+ if (this.lastChild) {\r
+ n.previousSibling = this.lastChild;\r
+ this.lastChild.nextSibling = n;\r
+ }\r
+ this.lastChild = n;\r
+ this.childNodes.push(n);\r
+ n.nextSibling = null;\r
+ } else {\r
+ if (ref.parentNode !== this) { //参照ノードが子要素でない場合\r
+ throw (new DOMException(/*DOMException.NOT_FOUND_ERR*/ 8));\r
+ }\r
+ t = this.firstChild;\r
+ if (t === ref) {\r
+ this.firstChild = n;\r
+ }\r
+ while (t) {\r
+ if (t === ref) {\r
+ this.childNodes.splice(j, 1, n, ref); //Arrayのspliceを利用して、リストにnノードを追加\r
+ break;\r
+ }\r
+ ++j;\r
+ t = t.nextSibling;\r
+ }\r
+ rp = ref.previousSibling;\r
+ if (rp) {\r
+ rp.nextSibling = n;\r
+ }\r
+ ref.previousSibling = n;\r
+ n.previousSibling = rp;\r
+ n.nextSibling = ref;\r
+ }\r
+ n.parentNode = this;\r
+ if ((n.nodeType===/*Node.ENTITY_REFERENCE_NODE*/ 5) || (n.nodeType===/*Node.DOCUMENT_FRAGMENT_NODE*/ 11)) {\r
+ /*実体参照や、文書フラグメントノードだけは子ノードを検索して、\r
+ *それらを直接文書に埋め込む作業を以下で行う\r
+ */\r
+ var ch = n.childNodes.concat([]); //Arrayのコピー\r
+ for (var i=0,chli=ch.length;i<chli;i++) {\r
+ this.insertBefore(ch[i], n);\r
+ }\r
+ ch = void 0;\r
+ }\r
+ /*ここから*/\r
+ evt = this.ownerDocument.createEvent("MutationEvents");\r
+ evt.initMutationEvent("DOMNodeInserted", true, false, this, null, null, null, null);\r
+ n.dispatchEvent(evt);\r
+ /*以下のDOMNodeInsertedIntoDocumentイベントは、間接的、あるいは直接ノードが\r
+ *挿入されたときに発火する。間接的な挿入とは、サブツリーを作っておいて、それをいっぺんに挿入する場合など。\r
+ *このイベントは浮上しないことに注意を要する\r
+ */\r
+ do {\r
+ s = te;\r
+ te = te.parentNode;\r
+ } while (te);\r
+ if (s !== this.ownerDocument.documentElement) {\r
+ evt = descend = tp = rp = te = s = di = void 0;\r
+ return n;\r
+ }\r
+ evt = this.ownerDocument.createEvent("MutationEvents");\r
+ evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);\r
+ n.dispatchEvent(evt);\r
+ if (!n.hasChildNodes()) { //子ノードがないので終了\r
+ return n;\r
+ }\r
+ if (n.getElementsByTagNameNS) {\r
+ descend = n.getElementsByTagNameNS("*", "*"); //全子孫要素を取得\r
+ } else {\r
+ descend = n.childNodes;\r
+ }\r
+ if (descend) {\r
+ for (var i=0,dli=descend.length;i<dli;++i) {\r
+ di = descend[i];\r
+ di.dispatchEvent(evt);\r
+ di = null;\r
+ }\r
+ }\r
+ evt = descend = tp = rp = j = t = te = s = di = void 0;\r
+ return n;\r
+};\r
+\r
+/*Node*/ Node.prototype.removeChild = function( /*Node*/ ele) {\r
+ if (!(ele instanceof Node)) { //Nodeでなければ\r
+ throw (new Error());\r
+ }\r
+ if (ele.parentNode !== this) { //親が違う場合\r
+ throw (new DOMException(/*DOMException.NOT_FOUND_ERR*/ 8));\r
+ }\r
+ if (ele.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合\r
+ throw (new Error());\r
+ }\r
+ /*ここから*/\r
+ var evt = this.ownerDocument.createEvent("MutationEvents"),\r
+ descend;\r
+ /*以下のDOMNodeRemovedFromDocumentイベントは、間接的、あるいは直接ノードが\r
+ *除去されたときに発火する。間接的な除去とは、サブツリーをいっぺんに除去する場合など。\r
+ *このイベントは浮上しないことに注意を要する\r
+ */\r
+ evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);\r
+ ele.dispatchEvent(evt);\r
+ if (ele.getElementsByTagNameNS) {\r
+ descend = ele.getElementsByTagNameNS("*", "*"); //全子孫要素を取得\r
+ } else {\r
+ descend = ele.childNodes;\r
+ }\r
+ if (descend) {\r
+ evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);\r
+ for (var i=0,dli=descend.length;i<dli;++i) {\r
+ var di = descend[i];\r
+ evt.target = di;\r
+ di.dispatchEvent(evt);\r
+ di = void 0;\r
+ }\r
+ }\r
+ evt.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null);\r
+ ele.dispatchEvent(evt);\r
+ evt = descend = void 0;\r
+ /*ここまで追加*/\r
+ ele.parentNode = null;\r
+ var t = this.firstChild,\r
+ j = 0;\r
+ while (t) {\r
+ if (t === ele) {\r
+ this.childNodes.splice(j, 1); //Arrayのspliceを利用して、リストからeleノードを排除\r
+ break;\r
+ }\r
+ ++j;\r
+ t = t.nextSibling;\r
+ }\r
+ if (this.firstChild === ele) {\r
+ this.firstChild = ele.nextSibling;\r
+ }\r
+ if (this.lastChild === ele) {\r
+ this.lastChild = ele.previousSibling;\r
+ }\r
+ ele.previousSibling && (ele.previousSibling.nextSibling = ele.nextSibling);\r
+ ele.nextSibling && (ele.nextSibling.previousSibling = ele.previousSibling);\r
+ ele.nextSibling = ele.previousSibling = null;\r
+ t = j = void 0;\r
+ return ele;\r
+};\r
+\r
+/*void*/ CharacterData.prototype.appendData = function( /*string*/ arg) {\r
+ var pd = this.data,\r
+ evt;\r
+ this.data += arg;\r
+ this.length = this.data.length;\r
+ /*ここから*/\r
+ evt = this.ownerDocument.createEvent("MutationEvents");\r
+ evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);\r
+ this.parentNode.dispatchEvent(evt);\r
+ evt = arg = pd = void 0;\r
+ /*ここまで追加*/\r
+};\r
+/*void*/ CharacterData.prototype.insertData = function( /*long*/ offset, /*string*/ arg) {\r
+ var pd = this.data,\r
+ pre = this.substring(0, offset - 1), //文字列を二つに分けた、前半部分\r
+ next = this.substring(offset, this.length - offset), //後半部分\r
+ evt;\r
+ this.data = pre + this.data + next;\r
+ this.length = this.data.length;\r
+ /*ここから*/\r
+ evt = this.ownerDocument.createEvent("MutationEvents");\r
+ evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);\r
+ this.parentNode.dispatchEvent(evt);\r
+ evt = arg = pd = pre = next = void 0;\r
+ /*ここまで追加*/\r
+};\r
+/*void*/ CharacterData.prototype.deleteData = function( /*long*/ offset, /*long*/ count) {\r
+ var pd = this.data;\r
+ pre = this.substring(0, offset - 1), //残すべき前半部分\r
+ next = this.substring(offset + count, this.length - 1), //後半部分\r
+ evt;\r
+ if (offset + count > this.length) { //offsetとcountの和が文字全体の長さを超える場合、offsetから最後までのを削除\r
+ next = "";\r
+ }\r
+ this.data = pre + next;\r
+ this.length = this.data.length;\r
+ /*ここから*/\r
+ evt = this.ownerDocument.createEvent("MutationEvents");\r
+ evt.initMutationEvent("DOMCharacterDataModified", true, false, null, pd, this.data, null, null);\r
+ this.parentNode.dispatchEvent(evt);\r
+ evt = pd = void 0;\r
+ /*ここまで追加*/\r
+};\r
+\r
+/*_ceventプロパティはcreateEventメソッドで軽量化のために使う。*/\r
+Document.prototype._cevent = {\r
+ "MutationEvents" : MutationEvent,\r
+ "MouseEvents" : MouseEvent,\r
+ "UIEvents" : UIEvent\r
+};\r
+\r
+\r
+// _EVENTS_IDL_\r