#30032 closed enhancement (fixed)
Add ID attribute to style element from wp_add_inline_style()
Reported by: | westonruter | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | has-patch |
Focuses: | Cc: |
Description
In order to support partial preview refreshes (#27355), it is important for all partials being updated to have an element with a distinct CSS selector for targeting. In the case of Twenty Fifteen, styles output via wp_add_inline_style()
may be dynamically refreshed by JS and so the style
elements output by this function should have distinct IDs. Once this is in place, then the Twenty Fifteen theme can make use of it in #29988.
Attachments (3)
Change History (13)
#1
@
10 years ago
- Keywords has-patch added
- Summary changed from Add ID to style element output by wp_add_inline_style to Add ID attribute to style element from wp_add_inline_style()
In 30032.diff, add id="wp-inline-style-$handle"
to style
elements added via wp_add_inline_style()
#2
@
10 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 29956:
This ticket was mentioned in IRC in #wordpress-dev by georgestephanis. View the logs.
10 years ago
#5
in reply to:
↑ 4
@
10 years ago
Replying to obenland:
What if there is more than one inline style added to one handle?
The after
data for the style dependency is actually an array and print_inline_style()
concatenates the array into a single string: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class.wp-styles.php#L144
So adding multiple inline styles won't be a problem.
https://github.com/xwpco/wordpress-develop/pull/34