/**
* Full HTML5 compatibility rule set
* These rules define which tags and css classes are supported and which tags should be specially treated.
*
* Examples based on this rule set:
*
* foo
* ... becomes ...
* foo
*
*
* ... becomes ...
*
*
*
foo
* ... becomes ...
* foo
*
*
* ... becomes ...
* foo
*
* foo
bar
* ... becomes ...
* foo
bar
*
* hello
* ... becomes ...
* hello
*
* hello
* ... becomes ...
* hello
*/
var wysihtml5ParserRules = {
/**
* CSS Class white-list
* Following css classes won't be removed when parsed by the wysihtml5 html parser
*/
"classes": {
"wysiwyg-clear-both": 1,
"wysiwyg-clear-left": 1,
"wysiwyg-clear-right": 1,
"wysiwyg-color-aqua": 1,
"wysiwyg-color-black": 1,
"wysiwyg-color-blue": 1,
"wysiwyg-color-fuchsia": 1,
"wysiwyg-color-gray": 1,
"wysiwyg-color-green": 1,
"wysiwyg-color-lime": 1,
"wysiwyg-color-maroon": 1,
"wysiwyg-color-navy": 1,
"wysiwyg-color-olive": 1,
"wysiwyg-color-purple": 1,
"wysiwyg-color-red": 1,
"wysiwyg-color-silver": 1,
"wysiwyg-color-teal": 1,
"wysiwyg-color-white": 1,
"wysiwyg-color-yellow": 1,
"wysiwyg-float-left": 1,
"wysiwyg-float-right": 1,
"wysiwyg-font-size-large": 1,
"wysiwyg-font-size-larger": 1,
"wysiwyg-font-size-medium": 1,
"wysiwyg-font-size-small": 1,
"wysiwyg-font-size-smaller": 1,
"wysiwyg-font-size-x-large": 1,
"wysiwyg-font-size-x-small": 1,
"wysiwyg-font-size-xx-large": 1,
"wysiwyg-font-size-xx-small": 1,
"wysiwyg-text-align-center": 1,
"wysiwyg-text-align-justify": 1,
"wysiwyg-text-align-left": 1,
"wysiwyg-text-align-right": 1
},
/**
* Tag list
*
* Following options are available:
*
* - add_class: converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
* The following methods are implemented in wysihtml5.dom.parse:
* - align_text: converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
foo
... becomes ... class="wysiwyg-text-align-center">foo
* - clear_br: converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
*
... becomes ...
* - align_img: converts align attribute values (right/left) on to their corresponding css class "wysiwyg-float-*"
*
* - remove: removes the element and it's content
*
* - rename_tag: renames the element to the given tag
*
* - set_class: adds the given class to the element (note: make sure that the class is in the "classes" white list above)
*
* - set_attributes: sets/overrides the given attributes
*
* - check_attributes: checks the given HTML attribute via the given method
* - url: checks whether the given string is an url, deletes the attribute if not
* - alt: strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
* - numbers: ensures that the attribute only contains numeric characters
*/
"tags": {
"tr": {
"add_class": {
"align": "align_text"
}
},
"strike": {
"remove": 1
},
"form": {
"rename_tag": "div"
},
"rt": {
"rename_tag": "span"
},
"code": {},
"acronym": {
"rename_tag": "span"
},
"br": {
"add_class": {
"clear": "clear_br"
}
},
"details": {
"rename_tag": "div"
},
"h4": {
"add_class": {
"align": "align_text"
}
},
"em": {},
"title": {
"remove": 1
},
"multicol": {
"rename_tag": "div"
},
"figure": {
"rename_tag": "div"
},
"xmp": {
"rename_tag": "span"
},
"small": {
"rename_tag": "span",
"set_class": "wysiwyg-font-size-smaller"
},
"area": {
"remove": 1
},
"time": {
"rename_tag": "span"
},
"dir": {
"rename_tag": "ul"
},
"bdi": {
"rename_tag": "span"
},
"command": {
"remove": 1
},
"ul": {},
"progress": {
"rename_tag": "span"
},
"dfn": {
"rename_tag": "span"
},
"iframe": {
"remove": 1
},
"figcaption": {
"rename_tag": "div"
},
"a": {
"check_attributes": {
"href": "url"
},
"set_attributes": {
"rel": "nofollow",
"target": "_blank"
}
},
"img": {
"check_attributes": {
"width": "numbers",
"alt": "alt",
"src": "url",
"height": "numbers"
},
"add_class": {
"align": "align_img"
}
},
"rb": {
"rename_tag": "span"
},
"footer": {
"rename_tag": "div"
},
"noframes": {
"remove": 1
},
"abbr": {
"rename_tag": "span"
},
"u": {},
"bgsound": {
"remove": 1
},
"sup": {
"rename_tag": "span"
},
"address": {
"rename_tag": "div"
},
"basefont": {
"remove": 1
},
"nav": {
"rename_tag": "div"
},
"h1": {
"add_class": {
"align": "align_text"
}
},
"head": {
"remove": 1
},
"tbody": {
"add_class": {
"align": "align_text"
}
},
"dd": {
"rename_tag": "div"
},
"s": {
"rename_tag": "span"
},
"li": {},
"td": {
"check_attributes": {
"rowspan": "numbers",
"colspan": "numbers"
},
"add_class": {
"align": "align_text"
}
},
"object": {
"remove": 1
},
"div": {
"add_class": {
"align": "align_text"
}
},
"option": {
"rename_tag": "span"
},
"select": {
"rename_tag": "span"
},
"i": {},
"track": {
"remove": 1
},
"wbr": {
"remove": 1
},
"fieldset": {
"rename_tag": "div"
},
"big": {
"rename_tag": "span",
"set_class": "wysiwyg-font-size-larger"
},
"button": {
"rename_tag": "span"
},
"noscript": {
"remove": 1
},
"svg": {
"remove": 1
},
"input": {
"remove": 1
},
"table": {},
"keygen": {
"remove": 1
},
"h5": {
"add_class": {
"align": "align_text"
}
},
"meta": {
"remove": 1
},
"map": {
"rename_tag": "div"
},
"isindex": {
"remove": 1
},
"mark": {
"rename_tag": "span"
},
"caption": {
"add_class": {
"align": "align_text"
}
},
"tfoot": {
"add_class": {
"align": "align_text"
}
},
"base": {
"remove": 1
},
"video": {
"remove": 1
},
"strong": {},
"canvas": {
"remove": 1
},
"output": {
"rename_tag": "span"
},
"marquee": {
"rename_tag": "span"
},
"b": {},
"q": {
"check_attributes": {
"cite": "url"
}
},
"applet": {
"remove": 1
},
"span": {},
"rp": {
"rename_tag": "span"
},
"spacer": {
"remove": 1
},
"source": {
"remove": 1
},
"aside": {
"rename_tag": "div"
},
"frame": {
"remove": 1
},
"section": {
"rename_tag": "div"
},
"body": {
"rename_tag": "div"
},
"ol": {},
"nobr": {
"rename_tag": "span"
},
"html": {
"rename_tag": "div"
},
"summary": {
"rename_tag": "span"
},
"var": {
"rename_tag": "span"
},
"del": {
"remove": 1
},
"blockquote": {
"check_attributes": {
"cite": "url"
}
},
"style": {
"remove": 1
},
"device": {
"remove": 1
},
"meter": {
"rename_tag": "span"
},
"h3": {
"add_class": {
"align": "align_text"
}
},
"textarea": {
"rename_tag": "span"
},
"embed": {
"remove": 1
},
"hgroup": {
"rename_tag": "div"
},
"font": {
"rename_tag": "span",
"add_class": {
"size": "size_font"
}
},
"tt": {
"rename_tag": "span"
},
"noembed": {
"remove": 1
},
"thead": {
"add_class": {
"align": "align_text"
}
},
"blink": {
"rename_tag": "span"
},
"plaintext": {
"rename_tag": "span"
},
"xml": {
"remove": 1
},
"h6": {
"add_class": {
"align": "align_text"
}
},
"param": {
"remove": 1
},
"th": {
"check_attributes": {
"rowspan": "numbers",
"colspan": "numbers"
},
"add_class": {
"align": "align_text"
}
},
"legend": {
"rename_tag": "span"
},
"hr": {},
"label": {
"rename_tag": "span"
},
"dl": {
"rename_tag": "div"
},
"kbd": {
"rename_tag": "span"
},
"listing": {
"rename_tag": "div"
},
"dt": {
"rename_tag": "span"
},
"nextid": {
"remove": 1
},
"pre": {},
"center": {
"rename_tag": "div",
"set_class": "wysiwyg-text-align-center"
},
"audio": {
"remove": 1
},
"datalist": {
"rename_tag": "span"
},
"samp": {
"rename_tag": "span"
},
"col": {
"remove": 1
},
"article": {
"rename_tag": "div"
},
"cite": {},
"link": {
"remove": 1
},
"script": {
"remove": 1
},
"bdo": {
"rename_tag": "span"
},
"menu": {
"rename_tag": "ul"
},
"colgroup": {
"remove": 1
},
"ruby": {
"rename_tag": "span"
},
"h2": {
"add_class": {
"align": "align_text"
}
},
"ins": {
"rename_tag": "span"
},
"p": {
"add_class": {
"align": "align_text"
}
},
"sub": {
"rename_tag": "span"
},
"comment": {
"remove": 1
},
"frameset": {
"remove": 1
},
"optgroup": {
"rename_tag": "span"
},
"header": {
"rename_tag": "div"
}
}
};/*
wysihtml5 v0.3.0
https://github.com/xing/wysihtml5
Author: Christopher Blum (https://github.com/tiff)
Copyright (C) 2012 XING AG
Licensed under the MIT license (MIT)
Rangy, a cross-browser JavaScript range and selection library
http://code.google.com/p/rangy/
Copyright 2011, Tim Down
Licensed under the MIT license.
Version: 1.2.2
Build date: 13 November 2011
*/
var wysihtml5={version:"0.3.0",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46};
window.rangy=function(){function b(a,b){var c=typeof a[b];return c==k||!!(c==h&&a[b])||"unknown"==c}function c(a,b){return!!(typeof a[b]==h&&a[b])}function a(a,b){return typeof a[b]!=j}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&m(a,r)&&x(a,q)}function f(a){window.alert("Rangy not supported in your browser. Reason: "+a);o.initialized=!0;o.supported=!1}function g(){if(!o.initialized){var a,d=!1,h=!1;b(document,"createRange")&&
(a=document.createRange(),m(a,p)&&x(a,n)&&(d=!0),a.detach());if((a=c(document,"body")?document.body:document.getElementsByTagName("body")[0])&&b(a,"createTextRange"))a=a.createTextRange(),e(a)&&(h=!0);!d&&!h&&f("Neither Range nor TextRange are implemented");o.initialized=!0;o.features={implementsDomRange:d,implementsTextRange:h};d=w.concat(z);h=0;for(a=d.length;h["+a.childNodes.length+"]":a.nodeName}function k(a){this._next=this.root=a}function j(a,b){this.node=a;this.offset=b}function n(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}
var p="undefined",q=b.util;q.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");q.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var r=document.createElement("div");q.areHostMethods(r,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");q.isHostProperty(r,"innerHTML")||c.fail("Element is missing innerHTML property");r=document.createTextNode("test");
q.areHostMethods(r,["splitText","deleteData","insertData","appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var m=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};k.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=
null}};j.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+h(this.node)+":"+this.offset+")]"}};n.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};n.prototype.toString=function(){return this.message};b.dom={arrayContains:m,isHtmlNamespace:function(a){var b;return typeof a.namespaceURI==p||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==
b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:a,getNodeLength:function(a){var b;return f(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,isCharacterDataNode:f,insertAfter:g,splitDataNode:function(a,b){var c=a.cloneNode(!1);c.deleteData(0,b);a.deleteData(b,a.length-b);g(c,a);return c},getDocument:i,getWindow:function(a){a=i(a);
if(typeof a.defaultView!=p)return a.defaultView;if(typeof a.parentWindow!=p)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=p)return a.contentWindow;if(typeof a.contentDocument!=p)return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=p)return a.contentDocument;if(typeof a.contentWindow!=p)return a.contentWindow.document;
throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return q.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},comparePoints:function(b,c,h,j){var k;if(b==h)return c===j?0:c=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return d}function i(b){for(var c,d,h=a(b.range).createDocumentFragment();d=b.next();){c=b.isPartiallySelectedSubtree();d=d.cloneNode(!c);c&&(c=b.getSubtreeIterator(),d.appendChild(i(c)),c.detach(!0));if(10==d.nodeType)throw new B("HIERARCHY_REQUEST_ERR");h.appendChild(d)}return h}function h(a,b,c){for(var d,e,c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree())if(!1===
b(d)){c.stop=!0;break}else{if(d=a.getSubtreeIterator(),h(d,b,c),d.detach(!0),c.stop)break}else for(d=l.createIterator(d);e=d.next();)if(!1===b(e)){c.stop=!0;return}}function k(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),k(b),b.detach(!0)):a.remove()}function j(b){for(var c,d=a(b.range).createDocumentFragment(),h;c=b.next();){b.isPartiallySelectedSubtree()?(c=c.cloneNode(!1),h=b.getSubtreeIterator(),c.appendChild(j(h)),h.detach(!0)):b.remove();if(10==c.nodeType)throw new B("HIERARCHY_REQUEST_ERR");
d.appendChild(c)}return d}function n(a,b,c){var d=!(!b||!b.length),e,j=!!c;d&&(e=RegExp("^("+b.join("|")+")$"));var k=[];h(new q(a,!1),function(a){(!d||e.test(a.nodeType))&&(!j||c(a))&&k.push(a)});return k}function p(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+l.inspectNode(a.startContainer)+":"+a.startOffset+", "+l.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function q(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;
this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&l.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===c&&!l.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:l.getClosestAncestorIn(this.sc,c,!0),this._last=this.ec===c&&!l.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:l.getClosestAncestorIn(this.ec,c,!0))}}function r(a){this.code=
this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function m(a,b,c){this.nodes=n(a,b,c);this._next=this.nodes[0];this._position=0}function s(a){return function(b,c){for(var d,h=c?b:b.parentNode;h;){d=h.nodeType;if(l.arrayContains(a,d))return h;h=h.parentNode}return null}}function x(a,b){if($(a,b))throw new r("INVALID_NODE_TYPE_ERR");}function o(a){if(!a.startContainer)throw new B("INVALID_STATE_ERR");}function z(a,b){if(!l.arrayContains(b,a.nodeType))throw new r("INVALID_NODE_TYPE_ERR");
}function w(a,b){if(0>b||b>(l.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new B("INDEX_SIZE_ERR");}function y(a,b){if(O(a,!0)!==O(b,!0))throw new B("WRONG_DOCUMENT_ERR");}function A(a){if(aa(a,!0))throw new B("NO_MODIFICATION_ALLOWED_ERR");}function t(a,b){if(!a)throw new B(b);}function v(a){o(a);if(!l.arrayContains(G,a.startContainer.nodeType)&&!O(a.startContainer,!0)||!l.arrayContains(G,a.endContainer.nodeType)&&!O(a.endContainer,!0)||!(a.startOffset<=(l.isCharacterDataNode(a.startContainer)?
a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(l.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function D(){}function K(a){a.START_TO_START=Q;a.START_TO_END=U;a.END_TO_END=ba;a.END_TO_START=V;a.NODE_BEFORE=W;a.NODE_AFTER=X;a.NODE_BEFORE_AND_AFTER=Y;a.NODE_INSIDE=R}function F(a){K(a);K(a.prototype)}function E(a,b){return function(){v(this);
var c=this.startContainer,d=this.startOffset,e=this.commonAncestorContainer,j=new q(this,!0);c!==e&&(c=l.getClosestAncestorIn(c,e,!0),d=f(c),c=d.node,d=d.offset);h(j,A);j.reset();e=a(j);j.detach();b(this,c,d,c,d);return e}}function I(a,d,h){function g(a,b){return function(c){o(this);z(c,L);z(M(c),G);c=(a?e:f)(c);(b?i:n)(this,c.node,c.offset)}}function i(a,b,c){var h=a.endContainer,e=a.endOffset;if(b!==a.startContainer||c!==a.startOffset){if(M(b)!=M(h)||1==l.comparePoints(b,c,h,e))h=b,e=c;d(a,b,c,
h,e)}}function n(a,b,c){var h=a.startContainer,e=a.startOffset;if(b!==a.endContainer||c!==a.endOffset){if(M(b)!=M(h)||-1==l.comparePoints(b,c,h,e))h=b,e=c;d(a,h,e,b,c)}}a.prototype=new D;b.util.extend(a.prototype,{setStart:function(a,b){o(this);x(a,!0);w(a,b);i(this,a,b)},setEnd:function(a,b){o(this);x(a,!0);w(a,b);n(this,a,b)},setStartBefore:g(!0,!0),setStartAfter:g(!1,!0),setEndBefore:g(!0,!1),setEndAfter:g(!1,!1),collapse:function(a){v(this);a?d(this,this.startContainer,this.startOffset,this.startContainer,
this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){o(this);x(a,!0);d(this,a,0,a,l.getNodeLength(a))},selectNode:function(a){o(this);x(a,!1);z(a,L);var b=e(a),a=f(a);d(this,b.node,b.offset,a.node,a.offset)},extractContents:E(j,d),deleteContents:E(k,d),canSurroundContents:function(){v(this);A(this.startContainer);A(this.endContainer);var a=new q(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);a.detach();return!b},
detach:function(){h(this)},splitBoundaries:function(){v(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,h=this.endOffset,e=a===c;l.isCharacterDataNode(c)&&(0=l.getNodeIndex(a)&&h++,b=0);d(this,a,b,c,h)},normalizeBoundaries:function(){v(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,h=this.endOffset,e=function(a){var b=
a.nextSibling;b&&b.nodeType==a.nodeType&&(c=a,h=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},j=function(d){var e=d.previousSibling;if(e&&e.nodeType==d.nodeType){a=d;var j=d.length;b=e.length;d.insertData(0,e.data);e.parentNode.removeChild(e);a==c?(h+=b,c=a):c==d.parentNode&&(e=l.getNodeIndex(d),h==e?(c=d,h=j):h>e&&h--)}},k=!0;l.isCharacterDataNode(c)?c.length==h&&e(c):(0x",S=3==Z.firstChild.nodeType}catch(ca){}b.features.htmlParsingConforms=S;var T="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),Q=0,U=1,ba=2,V=3,W=0,X=1,Y=2,R=3;D.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,b){v(this);
y(this.startContainer,b.startContainer);var c=a==V||a==Q?"start":"end",d=a==U||a==Q?"start":"end";return l.comparePoints(this[c+"Container"],this[c+"Offset"],b[d+"Container"],b[d+"Offset"])},insertNode:function(a){v(this);z(a,P);A(this.startContainer);if(l.isAncestorOf(a,this.startContainer,!0))throw new B("HIERARCHY_REQUEST_ERR");this.setStartBefore(g(a,this.startContainer,this.startOffset))},cloneContents:function(){v(this);var b,c;if(this.collapsed)return a(this).createDocumentFragment();if(this.startContainer===
this.endContainer&&l.isCharacterDataNode(this.startContainer))return b=this.startContainer.cloneNode(!0),b.data=b.data.slice(this.startOffset,this.endOffset),c=a(this).createDocumentFragment(),c.appendChild(b),c;c=new q(this,!0);b=i(c);c.detach();return b},canSurroundContents:function(){v(this);A(this.startContainer);A(this.endContainer);var a=new q(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);a.detach();return!b},surroundContents:function(a){z(a,H);if(!this.canSurroundContents())throw new r("BAD_BOUNDARYPOINTS_ERR");
var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);g(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){v(this);for(var b=new C(a(this)),c=T.length,d;c--;)d=T[c],b[d]=this[d];return b},toString:function(){v(this);var a=this.startContainer;if(a===this.endContainer&&l.isCharacterDataNode(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new q(this,!0);h(a,function(a){(3==
a.nodeType||4==a.nodeType)&&b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){v(this);var b=a.parentNode,c=l.getNodeIndex(a);if(!b)throw new B("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return 0>a?0l.comparePoints(a,b,this.startContainer,this.startOffset)?-1:0=e&&0<=d:0>e&&0=l.comparePoints(a,b,this.endContainer,this.endOffset)},intersectsRange:function(b,c){v(this);if(a(b)!=a(this))throw new B("WRONG_DOCUMENT_ERR");var d=l.comparePoints(this.startContainer,this.startOffset,b.endContainer,b.endOffset),h=l.comparePoints(this.endContainer,this.endOffset,b.startContainer,b.startOffset);return c?0>=d&&0<=h:0>d&&0=this.comparePoint(a,l.getNodeLength(a))},containsRange:function(a){return this.intersection(a).equals(a)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);return 012