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
|
|
|
|
|
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
|
|
|
|
2016-12-10 20:30:09 -05:00
|
|
|
var isAndroid = /Android/.test( ua );
|
2013-05-20 01:14:28 -05:00
|
|
|
var isMac = /Mac OS X/.test( ua );
|
2016-12-10 20:30:09 -05:00
|
|
|
var isWin = /Windows NT/.test( ua );
|
2020-03-10 22:35:50 -05:00
|
|
|
var isIOS = /iP(?:ad|hone|od)/.test( ua ) ||
|
|
|
|
( isMac && !!navigator.maxTouchPoints );
|
2016-07-13 20:32:38 -05:00
|
|
|
|
2013-04-07 22:27:06 -05:00
|
|
|
var isGecko = /Gecko\//.test( ua );
|
2016-03-10 23:22:49 -05:00
|
|
|
var isEdge = /Edge\//.test( ua );
|
|
|
|
var isWebKit = !isEdge && /WebKit\//.test( ua );
|
2016-07-27 02:33:06 -05:00
|
|
|
var isIE = /Trident\/[4567]\./.test( ua );
|
2013-04-07 22:27:06 -05:00
|
|
|
|
2013-05-20 01:14:28 -05:00
|
|
|
var ctrlKey = isMac ? 'meta-' : 'ctrl-';
|
|
|
|
|
2020-03-10 22:48:30 -05:00
|
|
|
var cantFocusEmptyTextNodes = isWebKit;
|
2013-04-07 22:27:06 -05:00
|
|
|
|
2014-12-27 01:48:15 -05:00
|
|
|
var canObserveMutations = typeof MutationObserver !== 'undefined';
|
2016-11-14 19:07:15 -05:00
|
|
|
var canWeakMap = typeof WeakMap !== 'undefined';
|
2014-12-27 01:48:15 -05:00
|
|
|
|
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;
|