Debian Codegraph @

ui/disable-selection.js

raw symbols SCIP
1 /*!
2 * jQuery UI Disable Selection 1.14.2
3 * https://jqueryui.com
4 *
5 * Copyright OpenJS Foundation and other contributors
6 * Released under the MIT license.
7 * https://jquery.org/license
8 */
9
10 //>>label: disableSelection
11 //>>group: Core
12 //>>description: Disable selection of text content within the set of matched elements.
13 //>>docs: https://api.jqueryui.com/disableSelection/
14
15 // This file is deprecated
16 ( function( factory ) {
17 "use strict";
18
19 if ( typeof define === "function" && define.amd ) {
20
21 // AMD. Register as an anonymous module.
22 define( [ "jquery", "./version" ], factory );
23 } else {
24
25 // Browser globals
26 factory( jQuery );
27 }
28 } )( function( $ ) {
29 "use strict";
30
31 return $.fn.extend( {
32 disableSelection: ( function() {
33 var eventType = "onselectstart" in document.createElement( "div" ) ?
34 "selectstart" :
35 "mousedown";
36
37 return function() {
38 return this.on( eventType + ".ui-disableSelection", function( event ) {
39 event.preventDefault();
40 } );
41 };
42 } )(),
43
44 enableSelection: function() {
45 return this.off( ".ui-disableSelection" );
46 }
47 } );
48
49 } );