Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff75767

Browse files
author
timmywil
committed
Minor adjustments and cleanup, including normalizing the value to a string when setting( list of changes below )
- Normalize set value to string to synchronize return type cross-browser- Add style attrHook to propHooks to support style getting in all browsers for both attr and prop- Extend the selected propHook instead of overriding a possible set function- Remove selected propHook TODO since there is no selected content attribute and it should return null
1 parent8cbf551 commitff75767

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

‎src/attributes.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ jQuery.extend({
313313
returnret;
314314

315315
}else{
316-
elem.setAttribute(name,value);
316+
elem.setAttribute(name,""+value);
317317
returnvalue;
318318
}
319319

@@ -440,10 +440,8 @@ if ( !jQuery.support.getSetAttribute ) {
440440
varret=elem.getAttributeNode(name);
441441
if(ret){
442442
ret.nodeValue=value;
443-
}else{
444-
elem.setAttribute(name,value);
443+
returnvalue;
445444
}
446-
returnvalue;
447445
}
448446
};
449447
}
@@ -458,9 +456,6 @@ jQuery.each([ "selected", "checked", "readonly", "disabled" ], function( i, name
458456
jQuery.removeAttr(elem,name);
459457
returnfalse;
460458
}
461-
462-
elem.setAttribute(name,value);
463-
returnvalue;
464459
}
465460
});
466461
});
@@ -477,7 +472,7 @@ if ( !jQuery.support.hrefNormalized ) {
477472
}
478473

479474
if(!jQuery.support.style){
480-
jQuery.attrHooks.style={
475+
jQuery.propHooks.style=jQuery.attrHooks.style={
481476
get:function(elem){
482477
returnelem.style.cssText;
483478
},
@@ -490,24 +485,20 @@ if ( !jQuery.support.style ) {
490485
// Safari mis-reports the default selected property of an option
491486
// Accessing the parent's selectedIndex property fixes it
492487
if(!jQuery.support.optSelected){
493-
494-
jQuery.propHooks.selected={
488+
jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{
495489
get:function(elem){
496490
varparent=elem.parentNode;
497-
491+
498492
if(parent){
499493
parent.selectedIndex;
500-
501-
// TODO: We may need an attrHook for selected that simply defers to prop?
502-
// The attr is undefined if the option is created with createElement and not on the DOM
503-
494+
504495
// Make sure that it also works with optgroups, see #5701
505496
if(parent.parentNode){
506497
parent.parentNode.selectedIndex;
507498
}
508499
}
509500
}
510-
};
501+
});
511502
}
512503

513504
})(jQuery);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp