WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#38585 closed defect (bug) (fixed)

Exit `wp-custom-header.js` gracefully in browsers without `addEventListener` support.

Reported by: peterwilsoncc Owned by: peterwilsoncc
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Themes Keywords: has-patch
Focuses: javascript Cc:

Description

wp-custom-header.js throws an error in browsers that don't support document.addEventListener.

Add a check for browser support and fail gracefully if it doesn't pass.

Attachments (1)

38585.diff (439 bytes) - added by peterwilsoncc 4 years ago.

Download all attachments as: .zip

Change History (3)

@peterwilsoncc
4 years ago

#1 @peterwilsoncc
4 years ago

  • Keywords has-patch added
  • Version set to trunk

38585.diff adds required check.

#2 @peterwilsoncc
4 years ago

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

In 39050:

Themes: Exit wp-custom-header.js early in browsers wihout modern events.

Adds a check for window.addEventListener support before attempting to use it. In browsers without support, the file is exited early to avoid throwing a JavaScript error.

Fixes #38585.

Note: See TracTickets for help on using tickets.