diff --git a/src/dom/DomUtil.js b/src/dom/DomUtil.js index 2224293d..5ad4d18c 100644 --- a/src/dom/DomUtil.js +++ b/src/dom/DomUtil.js @@ -241,44 +241,46 @@ L.DomUtil.TRANSITION_END = var userSelectProperty = L.DomUtil.testProp( ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']); - L.DomUtil.disableTextSelection = function () { - if (userSelectProperty) { - var style = document.documentElement.style; - this._userSelect = style[userSelectProperty]; - style[userSelectProperty] = 'none'; - } else { - L.DomEvent.on(window, 'selectstart', L.DomEvent.stop); - } - }; - - L.DomUtil.enableTextSelection = function () { - if (userSelectProperty) { - document.documentElement.style[userSelectProperty] = this._userSelect; - delete this._userSelect; - } else { - L.DomEvent.off(window, 'selectstart', L.DomEvent.stop); - } - }; - var userDragProperty = L.DomUtil.testProp( ['userDrag', 'WebkitUserDrag', 'OUserDrag', 'MozUserDrag', 'msUserDrag']); - L.DomUtil.disableImageDrag = function () { - if (userDragProperty) { - var style = document.documentElement.style; - this._userDrag = style[userDragProperty]; - style[userDragProperty] = 'none'; - } else { - L.DomEvent.on(window, 'dragstart', L.DomEvent.stop); - } - }; + L.extend(L.DomUtil, { + disableTextSelection: function () { + if (userSelectProperty) { + var style = document.documentElement.style; + this._userSelect = style[userSelectProperty]; + style[userSelectProperty] = 'none'; + } else { + L.DomEvent.on(window, 'selectstart', L.DomEvent.stop); + } + }, - L.DomUtil.enableImageDrag = function () { - if (userDragProperty) { - document.documentElement.style[userDragProperty] = this._userDrag; - delete this._userDrag; - } else { - L.DomEvent.off(window, 'dragstart', L.DomEvent.stop); + enableTextSelection: function () { + if (userSelectProperty) { + document.documentElement.style[userSelectProperty] = this._userSelect; + delete this._userSelect; + } else { + L.DomEvent.off(window, 'selectstart', L.DomEvent.stop); + } + }, + + disableImageDrag: function () { + if (userDragProperty) { + var style = document.documentElement.style; + this._userDrag = style[userDragProperty]; + style[userDragProperty] = 'none'; + } else { + L.DomEvent.on(window, 'dragstart', L.DomEvent.stop); + } + }, + + enableImageDrag: function () { + if (userDragProperty) { + document.documentElement.style[userDragProperty] = this._userDrag; + delete this._userDrag; + } else { + L.DomEvent.off(window, 'dragstart', L.DomEvent.stop); + } } - }; + }); })();