scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 58 Rev 125
Line 1... Line 1...
1 define( [ 1 define([
2 "../core", 2 "../core",
3 "../core/access", 3 "../core/access",
4 "./support", 4 "./support"
5 "../selector" -  
6 ], function( jQuery, access, support ) { 5 ], function( jQuery, access, support ) {
Line 7... Line 6...
7   6  
Line 8... Line -...
8 "use strict"; -  
9   -  
10 var rfocusable = /^(?:input|select|textarea|button)$/i, -  
11 rclickable = /^(?:a|area)$/i; 7 var rfocusable = /^(?:input|select|textarea|button)$/i;
12   8  
13 jQuery.fn.extend( { 9 jQuery.fn.extend({
14 prop: function( name, value ) { 10 prop: function( name, value ) {
Line 15... Line 11...
15 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 11 return access( this, jQuery.prop, name, value, arguments.length > 1 );
16 }, 12 },
17   13  
18 removeProp: function( name ) { 14 removeProp: function( name ) {
19 return this.each( function() { 15 return this.each(function() {
20 delete this[ jQuery.propFix[ name ] || name ]; 16 delete this[ jQuery.propFix[ name ] || name ];
-   17 });
-   18 }
-   19 });
-   20  
-   21 jQuery.extend({
-   22 propFix: {
Line 21... Line -...
21 } ); -  
22 } 23 "for": "htmlFor",
23 } ); 24 "class": "className"
24   25 },
Line 25... Line 26...
25 jQuery.extend( { 26  
26 prop: function( elem, name, value ) { 27 prop: function( elem, name, value ) {
27 var ret, hooks, 28 var ret, hooks, notxml,
28 nType = elem.nodeType; 29 nType = elem.nodeType;
Line 29... Line 30...
29   30  
Line -... Line 31...
-   31 // Don't get/set properties on text, comment and attribute nodes
30 // Don't get/set properties on text, comment and attribute nodes 32 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
31 if ( nType === 3 || nType === 8 || nType === 2 ) { 33 return;
32 return; 34 }
33 } 35  
Line 34... Line 36...
34   36 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
35 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { -  
36   37  
37 // Fix name and attach hooks 38 if ( notxml ) {
38 name = jQuery.propFix[ name ] || name; -  
39 hooks = jQuery.propHooks[ name ]; -  
40 } 39 // Fix name and attach hooks
41   -  
42 if ( value !== undefined ) { 40 name = jQuery.propFix[ name ] || name;
-   41 hooks = jQuery.propHooks[ name ];
43 if ( hooks && "set" in hooks && 42 }
-   43  
44 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 44 if ( value !== undefined ) {
45 return ret; 45 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
46 } -  
47   -  
48 return ( elem[ name ] = value ); 46 ret :
Line 49... Line 47...
49 } 47 ( elem[ name ] = value );
50   48  
51 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 49 } else {
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/ 50 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
66 // Use proper attribute retrieval(#12072) -  
67 var tabindex = jQuery.find.attr( elem, "tabindex" ); 51 ret :
68   52 elem[ name ];
69 if ( tabindex ) { -  
70 return parseInt( tabindex, 10 ); -  
71 } -  
72   -  
73 if ( 53 }
74 rfocusable.test( elem.nodeName ) || 54 },
75 rclickable.test( elem.nodeName ) && -  
76 elem.href -  
77 ) { -  
78 return 0; -  
79 } -  
80   55  
81 return -1; 56 propHooks: {
Line 82... Line -...
82 } -  
83 } -  
84 }, -  
85   -  
86 propFix: { -  
87 "for": "htmlFor", -  
88 "class": "className" -  
89 } -  
90 } ); 57 tabIndex: {
91   58 get: function( elem ) {
92 // Support: IE <=11 only 59 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
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 60 elem.tabIndex :
97 // when in an optgroup 61 -1;
98 // eslint rule "no-unused-expressions" is disabled for this code 62 }
99 // since it considers such accessions noop 63 }
100 if ( !support.optSelected ) { 64 }
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" */ 65 });
115   66  
116 var parent = elem.parentNode; 67 if ( !support.optSelected ) {
Line 117... Line 68...
117 if ( parent ) { 68 jQuery.propHooks.selected = {
118 parent.selectedIndex; 69 get: function( elem ) {
119   70 var parent = elem.parentNode;
120 if ( parent.parentNode ) { 71 if ( parent && parent.parentNode ) {
121 parent.parentNode.selectedIndex; 72 parent.parentNode.selectedIndex;
122 } 73 }
Line 136... Line 87...
136 "useMap", 87 "useMap",
137 "frameBorder", 88 "frameBorder",
138 "contentEditable" 89 "contentEditable"
139 ], function() { 90 ], function() {
140 jQuery.propFix[ this.toLowerCase() ] = this; 91 jQuery.propFix[ this.toLowerCase() ] = this;
141 } ); 92 });
Line 142... Line 93...
142   93