Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

revert prop to attr changes Fixes: #3670

  • Loading branch information...
commit c1e230f650a27d26142ba52a42dfa1940e85a46c 1 parent 27a7095
John Bender johnbender authored
25 js/jquery.mobile.forms.checkboxradio.js
View
@@ -60,10 +60,10 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
});
// Wrap the input + label in a div
- var wrapper = document.createElement('div');
- wrapper.className = 'ui-' + inputtype;
+ var wrapper = document.createElement('div');
+ wrapper.className = 'ui-' + inputtype;
input[0].parentNode.insertBefore(wrapper,input[0]);
- wrapper.appendChild(input[0]);
+ wrapper.appendChild(input[0]);
wrapper.appendChild(label[0]);
label.bind({
@@ -80,8 +80,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
self._cacheVals();
- input.attr( "checked", inputtype === "radio" && true || !input.attr( "checked" ) );
- //input.prop( "checked", inputtype === "radio" && true || !input.attr( "checked" ) );
+
+ input.prop( "checked", inputtype === "radio" && true || !input.prop( "checked" ) );
// trigger click handler's bound directly to the input as a substitute for
// how label clicks behave normally in the browsers
@@ -93,7 +93,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
// Input set for common radio buttons will contain all the radio
// buttons, but will not for checkboxes. clearing the checked status
// of other radios ensures the active button state is applied properly
- self._getInputSet().not( input ).removeAttr( "checked" );
+ self._getInputSet().not( input ).prop( "checked", false );
self._updateAll();
return false;
@@ -113,11 +113,11 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
// Adds checked attribute to checked input when keyboard is used
if ( $this.is( ":checked" ) ) {
- $this.attr( "checked", "checked" );
- self._getInputSet().not($this).removeAttr( "checked" );
+ $this.prop( "checked", true);
+ self._getInputSet().not($this).prop( "checked", false );
} else {
- $this.removeAttr( "checked" );
+ $this.prop( "checked", false );
}
self._updateAll();
@@ -161,7 +161,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
// NOTE getAttribute is used here to deal with an issue with the :checked
// selector. see #3597
- if ( this.getAttribute( "checked" ) || self.inputtype === "checkbox" ) {
+ if ( $this.prop( "checked" ) || self.inputtype === "checkbox" ) {
$this.trigger( "change" );
}
})
@@ -175,8 +175,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
// input[0].checked expando doesn't always report the proper value
// for checked='checked'
-
- if ( input[ 0 ].getAttribute( "checked" ) ) {
+ if ( $( input[ 0 ] ).prop( "checked" ) ) {
label.addClass( this.checkedClass ).removeClass( this.uncheckedClass );
icon.addClass( this.checkedicon ).removeClass( this.uncheckedicon );
} else {
@@ -192,7 +191,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
},
disable: function() {
- this.element.attr( "disabled", true ).parent().addClass( "ui-disabled" );
+ this.element.prop( "disabled", true ).parent().addClass( "ui-disabled" );
},
enable: function() {
8 tests/unit/checkboxradio/checkboxradio_core.js
View
@@ -88,11 +88,11 @@
},
function(){
- ok( $radioBtns.last()[0].getAttribute( 'checked' ) == "checked" );
+ ok( $radioBtns.last().prop( 'checked' ), "last input is checked" );
ok( $radioBtns.last().siblings( 'label' ).hasClass( 'ui-radio-on' ),
"last input label is an active button" );
- ok( $radioBtns.first()[0].getAttribute( 'checked' ) !== "checked" );
+ ok( !$radioBtns.first().prop( 'checked' ), "first input label is not active" );
ok( !$radioBtns.first().siblings( 'label' ).hasClass( 'ui-radio-on' ),
"first input label is not active" );
@@ -102,11 +102,11 @@
},
function(){
- ok( $radioBtns.first()[0].getAttribute( 'checked' ) == "checked");
+ ok( $radioBtns.first().prop( 'checked' ));
ok( $radioBtns.first().siblings( 'label' ).hasClass( 'ui-radio-on' ),
"first input label is an active button" );
- ok( $radioBtns.last()[0].getAttribute( 'checked' ) !== "checked");
+ ok( !$radioBtns.last().prop( 'checked' ));
ok( !$radioBtns.last().siblings( 'label' ).hasClass( 'ui-radio-on' ),
"last input label is not active" );
Please sign in to comment.
Something went wrong with that request. Please try again.