WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17421 closed defect (bug) (fixed)

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

Reported by: 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 3 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 3 years ago.
Change .attr to .prop as a result of jQuery 1.6.1
17421.diff (574 bytes) - added by duck_ 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 rossdev3 years ago

Looks like a javascript error.

comment:2 rossdev3 years ago

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

comment:3 rossdev3 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 )

JDTrower3 years ago

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

JDTrower3 years ago

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

comment:4 JDTrower3 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_3 years ago

comment:5 follow-up: duck_3 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.

comment:6 azaozz3 years ago

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

In [17923]

comment:7 in reply to: ↑ 5 azaozz3 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.

comment:8 follow-up: nacin3 years ago

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

comment:9 JDTrower3 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.

comment:10 in reply to: ↑ 8 duck_3 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.

comment:11 azaozz3 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.