Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#17421 closed defect (bug) (fixed)

Static page selection is disabled in Reading Settings ( jQuery v1.6.1 issue )

Reported by: rossdev's profile rossdev Owned by:
Milestone: 3.2 Priority: normal
Severity: major Version: 3.2
Component: UI Keywords: has-patch
Focuses: Cc:

Description

When trying to select a static page the selection is under-intensified. When viewing source the options are listed but <select> is set as disabled.

Attachments (3)

t17421-change-attr-to-prop.diff (592 bytes) - added by JDTrower 14 years ago.
Change .attr to .prop as a result of jQuery 1.6.1
t17421-change-attr-to-prop.2.diff (592 bytes) - added by JDTrower 14 years ago.
Change .attr to .prop as a result of jQuery 1.6.1
17421.diff (574 bytes) - added by duck_ 14 years ago.

Download all attachments as: .zip

Change History (14)

#1 @rossdev
14 years ago

Looks like a javascript error.

#2 @rossdev
14 years ago

Found the problem, and it's with jQuery v1.6.1
The issue goes away when jQuery v1.4.4 is loaded.

#3 @rossdev
14 years ago

  • Summary changed from Static page selection is disabled in Reading Settings to Static page selection is disabled in Reading Settings ( jQuery v1.6.1 issue )

@JDTrower
14 years ago

Change .attr to .prop as a result of jQuery 1.6.1

@JDTrower
14 years ago

Change .attr to .prop as a result of jQuery 1.6.1

#4 @JDTrower
14 years ago

  • Keywords has-patch added

Sorry, the patch somehow got added twice. They are the same. I have tested this patch in FF 3.6, FF 4, IE 8, IE 9, Opera 10, Opera 11, Safari 5, and Chrome 10. Changing .attr to .prop allows the dropdown boxes to work correctly again.

@duck_
14 years ago

#5 follow-up: @duck_
14 years ago

  • Milestone changed from Awaiting Review to 3.2

Didn't realise that a patch was attached when I wrote mine, because I did I thought I would upload it anyway. Also changes the staticPage check to use .prop().

I thought 1.6.1 was supposed to make this kind of use of .attr() work again. Should probably report upstream if it hasn't been done so already.

#6 @azaozz
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In [17923]

#7 in reply to: ↑ 5 @azaozz
13 years ago

Replying to duck_:

I thought 1.6.1 was supposed to make this kind of use of .attr() work again. Should probably report upstream if it hasn't been done so already.

Yes, that would be a good idea. You will need to make a small test case for it.

#8 follow-up: @nacin
13 years ago

IIRC is:checked should work fine. The potential bug upstream is an interesting one.

#9 @JDTrower
13 years ago

All it took for me to get things working as intended was changing .attr to .prop, in other words from this

selects.attr('disabled', staticPage.is(':checked') ? '' : 'disabled'); 

to this

selects.prop('disabled', staticPage.is(':checked') ? '' : 'disabled');

I assume the additional code change duck_ did is just as valid, but it wasn't necessary to make the drop down boxes work.

#10 in reply to: ↑ 8 @duck_
13 years ago

Replying to nacin:

IIRC is:checked should work fine.

Correct. As JDTrower says it was unnecessary for that actual bug fix. The reason for the change was because the jQuery 1.6 release post indicated that .prop() is faster than and preferred to the is:checked method. Sorry, I should've made the reasoning clearer in the comment above.

#11 @azaozz
13 years ago

@nacin, @JDTrower yes, staticPage.is(':checked') would work too but as @duck_ mentions .prop() is preferred with jQuery 1.6. Also the

? '' : 'disabled'

bit is not needed any more (think at one point you needed to pass an empty string to .attr() in order to remove an attribute with jQuery).

Note: See TracTickets for help on using tickets.