scratch – Blame information for rev 125

Subversion Repositories:
Rev:
Rev Author Line No. Line
125 office 1 define([
58 office 2 "../core",
3 "../core/access",
125 office 4 "./support"
58 office 5 ], function( jQuery, access, support ) {
6  
125 office 7 var rfocusable = /^(?:input|select|textarea|button)$/i;
58 office 8  
125 office 9 jQuery.fn.extend({
58 office 10 prop: function( name, value ) {
11 return access( this, jQuery.prop, name, value, arguments.length > 1 );
12 },
13  
14 removeProp: function( name ) {
125 office 15 return this.each(function() {
58 office 16 delete this[ jQuery.propFix[ name ] || name ];
125 office 17 });
58 office 18 }
125 office 19 });
58 office 20  
125 office 21 jQuery.extend({
22 propFix: {
23 "for": "htmlFor",
24 "class": "className"
25 },
26  
58 office 27 prop: function( elem, name, value ) {
125 office 28 var ret, hooks, notxml,
58 office 29 nType = elem.nodeType;
30  
31 // Don't get/set properties on text, comment and attribute nodes
125 office 32 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
58 office 33 return;
34 }
35  
125 office 36 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
58 office 37  
125 office 38 if ( notxml ) {
58 office 39 // Fix name and attach hooks
40 name = jQuery.propFix[ name ] || name;
41 hooks = jQuery.propHooks[ name ];
42 }
43  
44 if ( value !== undefined ) {
125 office 45 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
46 ret :
47 ( elem[ name ] = value );
58 office 48  
125 office 49 } else {
50 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
51 ret :
52 elem[ name ];
58 office 53 }
54 },
55  
56 propHooks: {
57 tabIndex: {
58 get: function( elem ) {
125 office 59 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
60 elem.tabIndex :
61 -1;
58 office 62 }
63 }
64 }
125 office 65 });
58 office 66  
67 if ( !support.optSelected ) {
68 jQuery.propHooks.selected = {
69 get: function( elem ) {
70 var parent = elem.parentNode;
71 if ( parent && parent.parentNode ) {
72 parent.parentNode.selectedIndex;
73 }
74 return null;
75 }
76 };
77 }
78  
125 office 79 jQuery.each([
58 office 80 "tabIndex",
81 "readOnly",
82 "maxLength",
83 "cellSpacing",
84 "cellPadding",
85 "rowSpan",
86 "colSpan",
87 "useMap",
88 "frameBorder",
89 "contentEditable"
90 ], function() {
91 jQuery.propFix[ this.toLowerCase() ] = this;
125 office 92 });
58 office 93  
125 office 94 });