Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#27485 closed defect (bug) (fixed)

Widget Customizer: WidgetCustomizerPreview is undefined in IE8/9

Reported by: ocean90's profile ocean90 Owned by: ocean90's profile ocean90
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: has-patch
Focuses: javascript Cc:

Description (last modified by ocean90)

Message: 'WidgetCustomizerPreview' is undefined
Line: 310
Char: 4
Code: 0
URI: http://trunk.wp.dev/wp-admin/customize.php?theme=twentyfourteen

Attachments (3)

27485.patch (7.6 KB) - added by ocean90 11 years ago.
27485.2.patch (11.2 KB) - added by adamsilverstein 11 years ago.
use underscores indexOf for IE8 compatibility
27485.partial-revert.patch (1.5 KB) - added by westonruter 11 years ago.
Revert some of the indexOf() replacements doing in r27654, as they were methods on Strings not Arrays.

Download all attachments as: .zip

Change History (16)

#1 @ocean90
11 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
11 years ago

#27486 was marked as a duplicate.

#3 @ocean90
11 years ago

  • Keywords needs-patch added
  • Summary changed from Widget Customizer: WidgetCustomizerPreview is undefined in IE8 to Widget Customizer: WidgetCustomizerPreview is undefined in IE8/9

@ocean90
11 years ago

#4 @ocean90
11 years ago

  • Focuses javascript added
  • Keywords has-patch needs-testing added; needs-patch removed

27485.patch:

  • Moves WidgetCustomizerPreview_exports to export_preview_data() too and combines data to _wpWidgetCustomizerPreviewSettings
  • Moves WidgetCustomizerPreview to wp.customize.WidgetCustomizerPreview
  • snake_case to CamelCase

#5 @adamsilverstein
11 years ago

Looks good - I tested this under Windows XP/IE8 and Windows 7 IE8 & IE9 - after the patch is applied the console errors go away when initially loading the page.

Trying to add a widget however, yields a different error - i believe caused by IE8's lack of support for indexOf on arrays: http://cl.ly/image/302447300A1J. Working on a fix.

@adamsilverstein
11 years ago

use underscores indexOf for IE8 compatibility

#6 @adamsilverstein
11 years ago

27485.2.patch builds on 27485.patch and improves IE8 compatibility for the Widget Customizer by swapping JavaScript indexOf (not supported for Arrays in IE8), instead using Underscore's _.indexOf (which provides an IE8 fallback). Other than the order of passed variables, nothing else changes between indexOf and _.indexOf so I don't anticipate unexpected side effects.

After applying this patch I no longer see console errors and I amble to add and remove widgets. One remaining IE8 issue is that when I click the Save & Publish button although the settings are saved, the button does not update to the text 'Saved' as it does in other browsers. No console errors, just no change in the button. Digging more to see why that is.

Last edited 11 years ago by adamsilverstein (previous) (diff)

#7 @ocean90
11 years ago

In 27653:

Widget Customizer: Fix 'WidgetCustomizerPreview' is undefined error in IE8/9.

  • Move WidgetCustomizerPreview to wp.customize.WidgetCustomizerPreview
  • Move WidgetCustomizerPreview_exports to export_preview_data()
  • Use _wpWidgetCustomizerPreviewSettings to transfer settings to wp.customize.WidgetCustomizerPreview

see #27485.

#8 follow-up: @ocean90
11 years ago

In 27654:

Widget Customizer: Use Underscores indexOf for IE8 compatibility.

props adamsilverstein.
see #27485.

#9 in reply to: ↑ 8 ; follow-up: @adamsilverstein
11 years ago

  • Keywords close added; needs-testing removed

Replying to ocean90:

In 27654:

Widget Customizer: Use Underscores indexOf for IE8 compatibility.

props adamsilverstein.
see #27485.

Thanks, I think we can close this ticket.

The other issue I mentioned (the button not changing to Saved) is also present in WordPress 3.8.1 and deserves a separate ticket. I think the bound change handler is failing to fire - this looks like its binding right on an object does not trigger correctly in IE8 (ref)

#10 in reply to: ↑ 9 @ocean90
11 years ago

  • Keywords close removed
  • Resolution set to fixed
  • Status changed from new to closed

Replying to adamsilverstein:

The other issue I mentioned (the button not changing to Saved) is also present in WordPress 3.8.1 and deserves a separate ticket.

Yes please.

#11 follow-up: @westonruter
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Some of the indexOf instances were actually String.indexOf() not Array.indexOf() so they need to be reverted. Attaching patch.

@westonruter
11 years ago

Revert some of the indexOf() replacements doing in r27654, as they were methods on Strings not Arrays.

#12 in reply to: ↑ 11 @adamsilverstein
11 years ago

Replying to westonruter:

Some of the indexOf instances were actually String.indexOf() not Array.indexOf() so they need to be reverted. Attaching patch.

Ack! Good catch, these shouldn't have been changed.

#13 @ocean90
11 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from reopened to closed

In 27890:

Revert [27654] for strings.

props westonruter.
fixes #27485.

Note: See TracTickets for help on using tickets.