Separate env helpers.
This commit is contained in:
parent
aa58a8298e
commit
bbab2a3c53
@ -13,8 +13,6 @@ exports.toInt = function (x) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.isWebKit = 'WebkitAppearance' in document.documentElement.style;
|
|
||||||
|
|
||||||
exports.clone = function (obj) {
|
exports.clone = function (obj) {
|
||||||
if (obj === null) {
|
if (obj === null) {
|
||||||
return null;
|
return null;
|
||||||
@ -43,3 +41,9 @@ exports.isEditable = function (el) {
|
|||||||
d.matches(el, "textarea,[contenteditable]") ||
|
d.matches(el, "textarea,[contenteditable]") ||
|
||||||
d.matches(el, "button,[contenteditable]");
|
d.matches(el, "button,[contenteditable]");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.env = {
|
||||||
|
isWebKit: 'WebkitAppearance' in document.documentElement.style,
|
||||||
|
supportsTouch: (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch),
|
||||||
|
supportsIePointer: window.navigator.msMaxTouchPoints !== null
|
||||||
|
};
|
||||||
|
@ -349,7 +349,7 @@ module.exports = function (element, settingOrCommand) {
|
|||||||
// FIXME: this is a quick fix for the select problem in FF and IE.
|
// FIXME: this is a quick fix for the select problem in FF and IE.
|
||||||
// If there comes an effective way to deal with the problem,
|
// If there comes an effective way to deal with the problem,
|
||||||
// this lines should be removed.
|
// this lines should be removed.
|
||||||
if (!h.isWebKit && element.querySelector('select:focus')) {
|
if (!h.env.isWebKit && element.querySelector('select:focus')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,9 +769,6 @@ module.exports = function (element, settingOrCommand) {
|
|||||||
isPluginAlive = false;
|
isPluginAlive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
|
|
||||||
var supportsIePointer = window.navigator.msMaxTouchPoints !== null;
|
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
bindScrollHandler();
|
bindScrollHandler();
|
||||||
@ -781,8 +778,8 @@ module.exports = function (element, settingOrCommand) {
|
|||||||
bindSelectionHandler();
|
bindSelectionHandler();
|
||||||
bindMouseWheelHandler();
|
bindMouseWheelHandler();
|
||||||
|
|
||||||
if (supportsTouch || supportsIePointer) {
|
if (h.env.supportsTouch || h.env.supportsIePointer) {
|
||||||
bindTouchHandler(supportsTouch, supportsIePointer);
|
bindTouchHandler(h.env.supportsTouch, h.env.supportsIePointer);
|
||||||
}
|
}
|
||||||
if (settings.useKeyboard) {
|
if (settings.useKeyboard) {
|
||||||
bindKeyboardHandler();
|
bindKeyboardHandler();
|
||||||
|
Loading…
Reference in New Issue
Block a user