WordPress.org

Make WordPress Core

Opened 23 months ago

Last modified 23 months ago

#42847 new defect (bug)

Twenty Seventeen: Social Menu creates code bloat

Reported by: madriverweb Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.3
Component: Bundled Theme Keywords:
Focuses: Cc:
PR Number:

Description

Theme: Twenty Seventeen
Version: current

The theme has an option to make a social menu.

The Bug
When using the social menu, 150+ lines of code (svg defs) are rendered in source code just above the closing body tag. This code is bloated with all the icons not selected, i.e. about 146 lines not needed when only two icons used.

Steps to replicate:
Add one or more custom links (Facebook) to social menu. Then look at rendered source code.

Change History (2)

#1 @afercia
23 months ago

  • Component changed from General to Bundled Theme

#2 @iCaleb
23 months ago

Looked into this a bit, and seems the SVG defs are always loaded, not only when a social menu is being used. This is because the svg icons are used for more than just social, a couple of examples are the search widget submit button and the left/right archive page arrows.

Reading up on <defs> a bit, this might not really be an issue.

Objects created inside a <defs> element are not rendered immediately; instead, think of them as templates or macros created for future use.

Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs

Note: See TracTickets for help on using tickets.