formtastic-jquery_inputmask 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bowerrc +3 -0
- data/bower.json +19 -0
- data/lib/formtastic/jquery_inputmask/engine.rb +1 -1
- data/lib/formtastic/jquery_inputmask/version.rb +1 -1
- data/vendor/inputmask/.bower.json +59 -0
- data/vendor/inputmask/bower.json +40 -0
- data/vendor/inputmask/dist/inputmask/bindings/inputmask.binding.js +21 -0
- data/vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js +62 -0
- data/vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js +13 -0
- data/vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.js +133 -0
- data/vendor/inputmask/dist/inputmask/global/document.js +11 -0
- data/vendor/inputmask/dist/inputmask/global/window.js +11 -0
- data/vendor/inputmask/dist/inputmask/inputmask.date.extensions.js +490 -0
- data/vendor/inputmask/dist/inputmask/inputmask.extensions.js +97 -0
- data/vendor/inputmask/dist/inputmask/inputmask.js +1643 -0
- data/vendor/inputmask/dist/inputmask/inputmask.numeric.extensions.js +347 -0
- data/vendor/inputmask/dist/inputmask/inputmask.phone.extensions.js +61 -0
- data/vendor/inputmask/dist/inputmask/inputmask.regex.extensions.js +115 -0
- data/vendor/inputmask/dist/inputmask/jquery.inputmask.js +62 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-be.js +244 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-nl.js +924 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-ru.js +19240 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-uk.js +1009 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone.js +2111 -0
- data/vendor/inputmask/dist/jquery.inputmask.bundle.js +3085 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.date.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.min.js +10 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.numeric.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.phone.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.regex.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/jquery.inputmask.min.js +9 -0
- data/vendor/inputmask/dist/min/jquery.inputmask.bundle.min.js +11 -0
- data/vendor/jquery/.bower.json +25 -0
- data/vendor/jquery/AUTHORS.txt +301 -0
- data/vendor/jquery/LICENSE.txt +36 -0
- data/vendor/jquery/README.md +67 -0
- data/vendor/jquery/bower.json +14 -0
- data/vendor/jquery/dist/core.js +476 -0
- data/vendor/jquery/dist/jquery.js +10253 -0
- data/vendor/jquery/dist/jquery.min.js +4 -0
- data/vendor/jquery/dist/jquery.min.map +1 -0
- data/vendor/jquery/dist/jquery.slim.js +8160 -0
- data/vendor/jquery/dist/jquery.slim.min.js +4 -0
- data/vendor/jquery/dist/jquery.slim.min.map +1 -0
- data/vendor/jquery/external/sizzle/LICENSE.txt +36 -0
- data/vendor/jquery/external/sizzle/dist/sizzle.js +2272 -0
- data/vendor/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/vendor/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/vendor/jquery/src/.eslintrc.json +5 -0
- data/vendor/jquery/src/ajax.js +855 -0
- data/vendor/jquery/src/ajax/jsonp.js +102 -0
- data/vendor/jquery/src/ajax/load.js +76 -0
- data/vendor/jquery/src/ajax/parseXML.js +30 -0
- data/vendor/jquery/src/ajax/script.js +77 -0
- data/vendor/jquery/src/ajax/var/location.js +5 -0
- data/vendor/jquery/src/ajax/var/nonce.js +7 -0
- data/vendor/jquery/src/ajax/var/rquery.js +5 -0
- data/vendor/jquery/src/ajax/xhr.js +169 -0
- data/vendor/jquery/src/attributes.js +13 -0
- data/vendor/jquery/src/attributes/attr.js +141 -0
- data/vendor/jquery/src/attributes/classes.js +174 -0
- data/vendor/jquery/src/attributes/prop.js +143 -0
- data/vendor/jquery/src/attributes/support.js +33 -0
- data/vendor/jquery/src/attributes/val.js +190 -0
- data/vendor/jquery/src/callbacks.js +234 -0
- data/vendor/jquery/src/core.js +476 -0
- data/vendor/jquery/src/core/DOMEval.js +16 -0
- data/vendor/jquery/src/core/access.js +70 -0
- data/vendor/jquery/src/core/init.js +128 -0
- data/vendor/jquery/src/core/nodeName.js +13 -0
- data/vendor/jquery/src/core/parseHTML.js +65 -0
- data/vendor/jquery/src/core/ready-no-deferred.js +96 -0
- data/vendor/jquery/src/core/ready.js +86 -0
- data/vendor/jquery/src/core/readyException.js +13 -0
- data/vendor/jquery/src/core/stripAndCollapse.js +14 -0
- data/vendor/jquery/src/core/support.js +20 -0
- data/vendor/jquery/src/core/var/rsingleTag.js +6 -0
- data/vendor/jquery/src/css.js +438 -0
- data/vendor/jquery/src/css/addGetHookIf.js +26 -0
- data/vendor/jquery/src/css/adjustCSS.js +71 -0
- data/vendor/jquery/src/css/curCSS.js +65 -0
- data/vendor/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/vendor/jquery/src/css/showHide.js +105 -0
- data/vendor/jquery/src/css/support.js +89 -0
- data/vendor/jquery/src/css/var/cssExpand.js +5 -0
- data/vendor/jquery/src/css/var/getStyles.js +17 -0
- data/vendor/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/vendor/jquery/src/css/var/rmargin.js +5 -0
- data/vendor/jquery/src/css/var/rnumnonpx.js +7 -0
- data/vendor/jquery/src/css/var/swap.js +26 -0
- data/vendor/jquery/src/data.js +179 -0
- data/vendor/jquery/src/data/Data.js +161 -0
- data/vendor/jquery/src/data/var/acceptData.js +19 -0
- data/vendor/jquery/src/data/var/dataPriv.js +7 -0
- data/vendor/jquery/src/data/var/dataUser.js +7 -0
- data/vendor/jquery/src/deferred.js +391 -0
- data/vendor/jquery/src/deferred/exceptionHook.js +21 -0
- data/vendor/jquery/src/deprecated.js +40 -0
- data/vendor/jquery/src/dimensions.js +56 -0
- data/vendor/jquery/src/effects.js +699 -0
- data/vendor/jquery/src/effects/Tween.js +123 -0
- data/vendor/jquery/src/effects/animatedSelector.js +15 -0
- data/vendor/jquery/src/event.js +746 -0
- data/vendor/jquery/src/event/ajax.js +22 -0
- data/vendor/jquery/src/event/alias.js +29 -0
- data/vendor/jquery/src/event/focusin.js +55 -0
- data/vendor/jquery/src/event/support.js +11 -0
- data/vendor/jquery/src/event/trigger.js +185 -0
- data/vendor/jquery/src/exports/amd.js +26 -0
- data/vendor/jquery/src/exports/global.js +34 -0
- data/vendor/jquery/src/jquery.js +41 -0
- data/vendor/jquery/src/manipulation.js +488 -0
- data/vendor/jquery/src/manipulation/_evalUrl.js +23 -0
- data/vendor/jquery/src/manipulation/buildFragment.js +104 -0
- data/vendor/jquery/src/manipulation/getAll.js +32 -0
- data/vendor/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/vendor/jquery/src/manipulation/support.js +35 -0
- data/vendor/jquery/src/manipulation/var/rcheckableType.js +5 -0
- data/vendor/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/vendor/jquery/src/manipulation/var/rtagName.js +5 -0
- data/vendor/jquery/src/manipulation/wrapMap.js +29 -0
- data/vendor/jquery/src/offset.js +229 -0
- data/vendor/jquery/src/queue.js +145 -0
- data/vendor/jquery/src/queue/delay.js +24 -0
- data/vendor/jquery/src/selector-native.js +237 -0
- data/vendor/jquery/src/selector-sizzle.js +19 -0
- data/vendor/jquery/src/selector.js +3 -0
- data/vendor/jquery/src/serialize.js +130 -0
- data/vendor/jquery/src/traversing.js +191 -0
- data/vendor/jquery/src/traversing/findFilter.js +106 -0
- data/vendor/jquery/src/traversing/var/dir.js +22 -0
- data/vendor/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/vendor/jquery/src/traversing/var/siblings.js +17 -0
- data/vendor/jquery/src/var/ObjectFunctionString.js +7 -0
- data/vendor/jquery/src/var/arr.js +5 -0
- data/vendor/jquery/src/var/class2type.js +6 -0
- data/vendor/jquery/src/var/concat.js +7 -0
- data/vendor/jquery/src/var/document.js +5 -0
- data/vendor/jquery/src/var/documentElement.js +7 -0
- data/vendor/jquery/src/var/fnToString.js +7 -0
- data/vendor/jquery/src/var/getProto.js +5 -0
- data/vendor/jquery/src/var/hasOwn.js +7 -0
- data/vendor/jquery/src/var/indexOf.js +7 -0
- data/vendor/jquery/src/var/pnum.js +5 -0
- data/vendor/jquery/src/var/push.js +7 -0
- data/vendor/jquery/src/var/rcssNum.js +9 -0
- data/vendor/jquery/src/var/rnothtmlwhite.js +8 -0
- data/vendor/jquery/src/var/slice.js +7 -0
- data/vendor/jquery/src/var/support.js +6 -0
- data/vendor/jquery/src/var/toString.js +7 -0
- data/vendor/jquery/src/wrap.js +77 -0
- metadata +152 -3
- data/.gitmodules +0 -3
@@ -0,0 +1,141 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../core/access",
|
4
|
+
"../core/nodeName",
|
5
|
+
"./support",
|
6
|
+
"../var/rnothtmlwhite",
|
7
|
+
"../selector"
|
8
|
+
], function( jQuery, access, nodeName, support, rnothtmlwhite ) {
|
9
|
+
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
var boolHook,
|
13
|
+
attrHandle = jQuery.expr.attrHandle;
|
14
|
+
|
15
|
+
jQuery.fn.extend( {
|
16
|
+
attr: function( name, value ) {
|
17
|
+
return access( this, jQuery.attr, name, value, arguments.length > 1 );
|
18
|
+
},
|
19
|
+
|
20
|
+
removeAttr: function( name ) {
|
21
|
+
return this.each( function() {
|
22
|
+
jQuery.removeAttr( this, name );
|
23
|
+
} );
|
24
|
+
}
|
25
|
+
} );
|
26
|
+
|
27
|
+
jQuery.extend( {
|
28
|
+
attr: function( elem, name, value ) {
|
29
|
+
var ret, hooks,
|
30
|
+
nType = elem.nodeType;
|
31
|
+
|
32
|
+
// Don't get/set attributes on text, comment and attribute nodes
|
33
|
+
if ( nType === 3 || nType === 8 || nType === 2 ) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
|
37
|
+
// Fallback to prop when attributes are not supported
|
38
|
+
if ( typeof elem.getAttribute === "undefined" ) {
|
39
|
+
return jQuery.prop( elem, name, value );
|
40
|
+
}
|
41
|
+
|
42
|
+
// Attribute hooks are determined by the lowercase version
|
43
|
+
// Grab necessary hook if one is defined
|
44
|
+
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
45
|
+
hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
|
46
|
+
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
|
47
|
+
}
|
48
|
+
|
49
|
+
if ( value !== undefined ) {
|
50
|
+
if ( value === null ) {
|
51
|
+
jQuery.removeAttr( elem, name );
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
|
55
|
+
if ( hooks && "set" in hooks &&
|
56
|
+
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
|
57
|
+
return ret;
|
58
|
+
}
|
59
|
+
|
60
|
+
elem.setAttribute( name, value + "" );
|
61
|
+
return value;
|
62
|
+
}
|
63
|
+
|
64
|
+
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
|
65
|
+
return ret;
|
66
|
+
}
|
67
|
+
|
68
|
+
ret = jQuery.find.attr( elem, name );
|
69
|
+
|
70
|
+
// Non-existent attributes return null, we normalize to undefined
|
71
|
+
return ret == null ? undefined : ret;
|
72
|
+
},
|
73
|
+
|
74
|
+
attrHooks: {
|
75
|
+
type: {
|
76
|
+
set: function( elem, value ) {
|
77
|
+
if ( !support.radioValue && value === "radio" &&
|
78
|
+
nodeName( elem, "input" ) ) {
|
79
|
+
var val = elem.value;
|
80
|
+
elem.setAttribute( "type", value );
|
81
|
+
if ( val ) {
|
82
|
+
elem.value = val;
|
83
|
+
}
|
84
|
+
return value;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
},
|
89
|
+
|
90
|
+
removeAttr: function( elem, value ) {
|
91
|
+
var name,
|
92
|
+
i = 0,
|
93
|
+
|
94
|
+
// Attribute names can contain non-HTML whitespace characters
|
95
|
+
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
|
96
|
+
attrNames = value && value.match( rnothtmlwhite );
|
97
|
+
|
98
|
+
if ( attrNames && elem.nodeType === 1 ) {
|
99
|
+
while ( ( name = attrNames[ i++ ] ) ) {
|
100
|
+
elem.removeAttribute( name );
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
} );
|
105
|
+
|
106
|
+
// Hooks for boolean attributes
|
107
|
+
boolHook = {
|
108
|
+
set: function( elem, value, name ) {
|
109
|
+
if ( value === false ) {
|
110
|
+
|
111
|
+
// Remove boolean attributes when set to false
|
112
|
+
jQuery.removeAttr( elem, name );
|
113
|
+
} else {
|
114
|
+
elem.setAttribute( name, name );
|
115
|
+
}
|
116
|
+
return name;
|
117
|
+
}
|
118
|
+
};
|
119
|
+
|
120
|
+
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
|
121
|
+
var getter = attrHandle[ name ] || jQuery.find.attr;
|
122
|
+
|
123
|
+
attrHandle[ name ] = function( elem, name, isXML ) {
|
124
|
+
var ret, handle,
|
125
|
+
lowercaseName = name.toLowerCase();
|
126
|
+
|
127
|
+
if ( !isXML ) {
|
128
|
+
|
129
|
+
// Avoid an infinite loop by temporarily removing this function from the getter
|
130
|
+
handle = attrHandle[ lowercaseName ];
|
131
|
+
attrHandle[ lowercaseName ] = ret;
|
132
|
+
ret = getter( elem, name, isXML ) != null ?
|
133
|
+
lowercaseName :
|
134
|
+
null;
|
135
|
+
attrHandle[ lowercaseName ] = handle;
|
136
|
+
}
|
137
|
+
return ret;
|
138
|
+
};
|
139
|
+
} );
|
140
|
+
|
141
|
+
} );
|
@@ -0,0 +1,174 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../core/stripAndCollapse",
|
4
|
+
"../var/rnothtmlwhite",
|
5
|
+
"../data/var/dataPriv",
|
6
|
+
"../core/init"
|
7
|
+
], function( jQuery, stripAndCollapse, rnothtmlwhite, dataPriv ) {
|
8
|
+
|
9
|
+
"use strict";
|
10
|
+
|
11
|
+
function getClass( elem ) {
|
12
|
+
return elem.getAttribute && elem.getAttribute( "class" ) || "";
|
13
|
+
}
|
14
|
+
|
15
|
+
jQuery.fn.extend( {
|
16
|
+
addClass: function( value ) {
|
17
|
+
var classes, elem, cur, curValue, clazz, j, finalValue,
|
18
|
+
i = 0;
|
19
|
+
|
20
|
+
if ( jQuery.isFunction( value ) ) {
|
21
|
+
return this.each( function( j ) {
|
22
|
+
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
|
23
|
+
} );
|
24
|
+
}
|
25
|
+
|
26
|
+
if ( typeof value === "string" && value ) {
|
27
|
+
classes = value.match( rnothtmlwhite ) || [];
|
28
|
+
|
29
|
+
while ( ( elem = this[ i++ ] ) ) {
|
30
|
+
curValue = getClass( elem );
|
31
|
+
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
|
32
|
+
|
33
|
+
if ( cur ) {
|
34
|
+
j = 0;
|
35
|
+
while ( ( clazz = classes[ j++ ] ) ) {
|
36
|
+
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
37
|
+
cur += clazz + " ";
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// Only assign if different to avoid unneeded rendering.
|
42
|
+
finalValue = stripAndCollapse( cur );
|
43
|
+
if ( curValue !== finalValue ) {
|
44
|
+
elem.setAttribute( "class", finalValue );
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
return this;
|
51
|
+
},
|
52
|
+
|
53
|
+
removeClass: function( value ) {
|
54
|
+
var classes, elem, cur, curValue, clazz, j, finalValue,
|
55
|
+
i = 0;
|
56
|
+
|
57
|
+
if ( jQuery.isFunction( value ) ) {
|
58
|
+
return this.each( function( j ) {
|
59
|
+
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
|
60
|
+
} );
|
61
|
+
}
|
62
|
+
|
63
|
+
if ( !arguments.length ) {
|
64
|
+
return this.attr( "class", "" );
|
65
|
+
}
|
66
|
+
|
67
|
+
if ( typeof value === "string" && value ) {
|
68
|
+
classes = value.match( rnothtmlwhite ) || [];
|
69
|
+
|
70
|
+
while ( ( elem = this[ i++ ] ) ) {
|
71
|
+
curValue = getClass( elem );
|
72
|
+
|
73
|
+
// This expression is here for better compressibility (see addClass)
|
74
|
+
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
|
75
|
+
|
76
|
+
if ( cur ) {
|
77
|
+
j = 0;
|
78
|
+
while ( ( clazz = classes[ j++ ] ) ) {
|
79
|
+
|
80
|
+
// Remove *all* instances
|
81
|
+
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
|
82
|
+
cur = cur.replace( " " + clazz + " ", " " );
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// Only assign if different to avoid unneeded rendering.
|
87
|
+
finalValue = stripAndCollapse( cur );
|
88
|
+
if ( curValue !== finalValue ) {
|
89
|
+
elem.setAttribute( "class", finalValue );
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
return this;
|
96
|
+
},
|
97
|
+
|
98
|
+
toggleClass: function( value, stateVal ) {
|
99
|
+
var type = typeof value;
|
100
|
+
|
101
|
+
if ( typeof stateVal === "boolean" && type === "string" ) {
|
102
|
+
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
103
|
+
}
|
104
|
+
|
105
|
+
if ( jQuery.isFunction( value ) ) {
|
106
|
+
return this.each( function( i ) {
|
107
|
+
jQuery( this ).toggleClass(
|
108
|
+
value.call( this, i, getClass( this ), stateVal ),
|
109
|
+
stateVal
|
110
|
+
);
|
111
|
+
} );
|
112
|
+
}
|
113
|
+
|
114
|
+
return this.each( function() {
|
115
|
+
var className, i, self, classNames;
|
116
|
+
|
117
|
+
if ( type === "string" ) {
|
118
|
+
|
119
|
+
// Toggle individual class names
|
120
|
+
i = 0;
|
121
|
+
self = jQuery( this );
|
122
|
+
classNames = value.match( rnothtmlwhite ) || [];
|
123
|
+
|
124
|
+
while ( ( className = classNames[ i++ ] ) ) {
|
125
|
+
|
126
|
+
// Check each className given, space separated list
|
127
|
+
if ( self.hasClass( className ) ) {
|
128
|
+
self.removeClass( className );
|
129
|
+
} else {
|
130
|
+
self.addClass( className );
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
// Toggle whole class name
|
135
|
+
} else if ( value === undefined || type === "boolean" ) {
|
136
|
+
className = getClass( this );
|
137
|
+
if ( className ) {
|
138
|
+
|
139
|
+
// Store className if set
|
140
|
+
dataPriv.set( this, "__className__", className );
|
141
|
+
}
|
142
|
+
|
143
|
+
// If the element has a class name or if we're passed `false`,
|
144
|
+
// then remove the whole classname (if there was one, the above saved it).
|
145
|
+
// Otherwise bring back whatever was previously saved (if anything),
|
146
|
+
// falling back to the empty string if nothing was stored.
|
147
|
+
if ( this.setAttribute ) {
|
148
|
+
this.setAttribute( "class",
|
149
|
+
className || value === false ?
|
150
|
+
"" :
|
151
|
+
dataPriv.get( this, "__className__" ) || ""
|
152
|
+
);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
} );
|
156
|
+
},
|
157
|
+
|
158
|
+
hasClass: function( selector ) {
|
159
|
+
var className, elem,
|
160
|
+
i = 0;
|
161
|
+
|
162
|
+
className = " " + selector + " ";
|
163
|
+
while ( ( elem = this[ i++ ] ) ) {
|
164
|
+
if ( elem.nodeType === 1 &&
|
165
|
+
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
|
166
|
+
return true;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
return false;
|
171
|
+
}
|
172
|
+
} );
|
173
|
+
|
174
|
+
} );
|
@@ -0,0 +1,143 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../core/access",
|
4
|
+
"./support",
|
5
|
+
"../selector"
|
6
|
+
], function( jQuery, access, support ) {
|
7
|
+
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
var rfocusable = /^(?:input|select|textarea|button)$/i,
|
11
|
+
rclickable = /^(?:a|area)$/i;
|
12
|
+
|
13
|
+
jQuery.fn.extend( {
|
14
|
+
prop: function( name, value ) {
|
15
|
+
return access( this, jQuery.prop, name, value, arguments.length > 1 );
|
16
|
+
},
|
17
|
+
|
18
|
+
removeProp: function( name ) {
|
19
|
+
return this.each( function() {
|
20
|
+
delete this[ jQuery.propFix[ name ] || name ];
|
21
|
+
} );
|
22
|
+
}
|
23
|
+
} );
|
24
|
+
|
25
|
+
jQuery.extend( {
|
26
|
+
prop: function( elem, name, value ) {
|
27
|
+
var ret, hooks,
|
28
|
+
nType = elem.nodeType;
|
29
|
+
|
30
|
+
// Don't get/set properties on text, comment and attribute nodes
|
31
|
+
if ( nType === 3 || nType === 8 || nType === 2 ) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
|
35
|
+
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
36
|
+
|
37
|
+
// Fix name and attach hooks
|
38
|
+
name = jQuery.propFix[ name ] || name;
|
39
|
+
hooks = jQuery.propHooks[ name ];
|
40
|
+
}
|
41
|
+
|
42
|
+
if ( value !== undefined ) {
|
43
|
+
if ( hooks && "set" in hooks &&
|
44
|
+
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
|
45
|
+
return ret;
|
46
|
+
}
|
47
|
+
|
48
|
+
return ( elem[ name ] = value );
|
49
|
+
}
|
50
|
+
|
51
|
+
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
|
52
|
+
return ret;
|
53
|
+
}
|
54
|
+
|
55
|
+
return elem[ name ];
|
56
|
+
},
|
57
|
+
|
58
|
+
propHooks: {
|
59
|
+
tabIndex: {
|
60
|
+
get: function( elem ) {
|
61
|
+
|
62
|
+
// Support: IE <=9 - 11 only
|
63
|
+
// elem.tabIndex doesn't always return the
|
64
|
+
// correct value when it hasn't been explicitly set
|
65
|
+
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
66
|
+
// Use proper attribute retrieval(#12072)
|
67
|
+
var tabindex = jQuery.find.attr( elem, "tabindex" );
|
68
|
+
|
69
|
+
if ( tabindex ) {
|
70
|
+
return parseInt( tabindex, 10 );
|
71
|
+
}
|
72
|
+
|
73
|
+
if (
|
74
|
+
rfocusable.test( elem.nodeName ) ||
|
75
|
+
rclickable.test( elem.nodeName ) &&
|
76
|
+
elem.href
|
77
|
+
) {
|
78
|
+
return 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
return -1;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
},
|
85
|
+
|
86
|
+
propFix: {
|
87
|
+
"for": "htmlFor",
|
88
|
+
"class": "className"
|
89
|
+
}
|
90
|
+
} );
|
91
|
+
|
92
|
+
// Support: IE <=11 only
|
93
|
+
// Accessing the selectedIndex property
|
94
|
+
// forces the browser to respect setting selected
|
95
|
+
// on the option
|
96
|
+
// The getter ensures a default option is selected
|
97
|
+
// when in an optgroup
|
98
|
+
// eslint rule "no-unused-expressions" is disabled for this code
|
99
|
+
// since it considers such accessions noop
|
100
|
+
if ( !support.optSelected ) {
|
101
|
+
jQuery.propHooks.selected = {
|
102
|
+
get: function( elem ) {
|
103
|
+
|
104
|
+
/* eslint no-unused-expressions: "off" */
|
105
|
+
|
106
|
+
var parent = elem.parentNode;
|
107
|
+
if ( parent && parent.parentNode ) {
|
108
|
+
parent.parentNode.selectedIndex;
|
109
|
+
}
|
110
|
+
return null;
|
111
|
+
},
|
112
|
+
set: function( elem ) {
|
113
|
+
|
114
|
+
/* eslint no-unused-expressions: "off" */
|
115
|
+
|
116
|
+
var parent = elem.parentNode;
|
117
|
+
if ( parent ) {
|
118
|
+
parent.selectedIndex;
|
119
|
+
|
120
|
+
if ( parent.parentNode ) {
|
121
|
+
parent.parentNode.selectedIndex;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
};
|
126
|
+
}
|
127
|
+
|
128
|
+
jQuery.each( [
|
129
|
+
"tabIndex",
|
130
|
+
"readOnly",
|
131
|
+
"maxLength",
|
132
|
+
"cellSpacing",
|
133
|
+
"cellPadding",
|
134
|
+
"rowSpan",
|
135
|
+
"colSpan",
|
136
|
+
"useMap",
|
137
|
+
"frameBorder",
|
138
|
+
"contentEditable"
|
139
|
+
], function() {
|
140
|
+
jQuery.propFix[ this.toLowerCase() ] = this;
|
141
|
+
} );
|
142
|
+
|
143
|
+
} );
|