2014-10-02 04:36:39 -05:00
|
|
|
/*jshint strict:false, undef:false, unused:false */
|
2013-04-07 22:27:06 -05:00
|
|
|
|
|
|
|
var DOCUMENT_POSITION_PRECEDING = 2; // Node.DOCUMENT_POSITION_PRECEDING
|
|
|
|
var ELEMENT_NODE = 1; // Node.ELEMENT_NODE;
|
|
|
|
var TEXT_NODE = 3; // Node.TEXT_NODE;
|
2016-03-22 01:57:00 -05:00
|
|
|
var DOCUMENT_NODE = 9; // Node.DOCUMENT_NODE;
|
2015-06-21 21:59:34 -05:00
|
|
|
var DOCUMENT_FRAGMENT_NODE = 11; // Node.DOCUMENT_FRAGMENT_NODE;
|
2013-04-07 22:27:06 -05:00
|
|
|
var SHOW_ELEMENT = 1; // NodeFilter.SHOW_ELEMENT;
|
|
|
|
var SHOW_TEXT = 4; // NodeFilter.SHOW_TEXT;
|
|
|
|
|
|
|
|
var START_TO_START = 0; // Range.START_TO_START
|
|
|
|
var START_TO_END = 1; // Range.START_TO_END
|
|
|
|
var END_TO_END = 2; // Range.END_TO_END
|
|
|
|
var END_TO_START = 3; // Range.END_TO_START
|
|
|
|
|
2016-07-06 12:27:22 -05:00
|
|
|
var HIGHLIGHT_CLASS = 'highlight';
|
|
|
|
var COLOUR_CLASS = 'colour';
|
|
|
|
var FONT_FAMILY_CLASS = 'font';
|
|
|
|
var FONT_SIZE_CLASS = 'size';
|
|
|
|
|
2014-12-25 03:09:46 -05:00
|
|
|
var ZWS = '\u200B';
|
|
|
|
|
2013-04-07 22:27:06 -05:00
|
|
|
var win = doc.defaultView;
|
|
|
|
|
|
|
|
var ua = navigator.userAgent;
|
2013-05-20 01:14:28 -05:00
|
|
|
|
|
|
|
var isIOS = /iP(?:ad|hone|od)/.test( ua );
|
|
|
|
var isMac = /Mac OS X/.test( ua );
|
|
|
|
|
2016-07-13 20:32:38 -05:00
|
|
|
var isAndroid = /Android/.test( ua );
|
|
|
|
|
2013-04-07 22:27:06 -05:00
|
|
|
var isGecko = /Gecko\//.test( ua );
|
2014-12-26 02:10:37 -05:00
|
|
|
var isIElt11 = /Trident\/[456]\./.test( ua );
|
2014-10-02 04:22:51 -05:00
|
|
|
var isPresto = !!win.opera;
|
2016-03-10 23:22:49 -05:00
|
|
|
var isEdge = /Edge\//.test( ua );
|
|
|
|
var isWebKit = !isEdge && /WebKit\//.test( ua );
|
2013-04-07 22:27:06 -05:00
|
|
|
|
2013-05-20 01:14:28 -05:00
|
|
|
var ctrlKey = isMac ? 'meta-' : 'ctrl-';
|
|
|
|
|
2014-12-26 02:10:37 -05:00
|
|
|
var useTextFixer = isIElt11 || isPresto;
|
|
|
|
var cantFocusEmptyTextNodes = isIElt11 || isWebKit;
|
|
|
|
var losesSelectionOnBlur = isIElt11;
|
2013-04-07 22:27:06 -05:00
|
|
|
|
2014-12-27 01:48:15 -05:00
|
|
|
var canObserveMutations = typeof MutationObserver !== 'undefined';
|
|
|
|
|
2013-11-04 02:21:57 -05:00
|
|
|
// Use [^ \t\r\n] instead of \S so that nbsp does not count as white-space
|
|
|
|
var notWS = /[^ \t\r\n]/;
|
2013-04-07 22:27:06 -05:00
|
|
|
|
|
|
|
var indexOf = Array.prototype.indexOf;
|
2015-04-28 23:16:11 -05:00
|
|
|
|
|
|
|
// Polyfill for FF3.5
|
|
|
|
if ( !Object.create ) {
|
|
|
|
Object.create = function ( proto ) {
|
|
|
|
var F = function () {};
|
|
|
|
F.prototype = proto;
|
|
|
|
return new F();
|
|
|
|
};
|
|
|
|
}
|