[wp-trac] [WordPress Trac] #46540: Admin bar CSS shouldn't be added in the customizer
WordPress Trac
noreply at wordpress.org
Wed Mar 20 23:49:28 UTC 2019
#46540: Admin bar CSS shouldn't be added in the customizer
-------------------------------------+-----------------------------
Reporter: nabil_kadimi | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.2
Component: Customize | Version: 4.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: administration
-------------------------------------+-----------------------------
Comment (by westonruter):
Replying to [comment:5 nabil_kadimi]:
> But I'm thinking that the customizer shouldn't make any difference
between HTML in `body` or `head`.
I think it would still be problematic because things in the `head` are
generally special in controlling the page.
I think actually actually this isn't a good fit for selective refresh.
Since everything is in an external stylesheet, the only thing needed is to
update the URL of the stylesheet, no? So then what if you used
`postMessage` and then added some JS to the preview like this:
{{{#!js
wp.customize( 'my-custom-stylesheet', ( setting ) => {
setting.bind( () => {
const link = document.querySelector( 'link#my-stylesheet' );
const url = new URL( link.href );
url.searchParams.set( 'cache-bust', Math.random() );
link.href = url.href;
} );
} );
}}}
So this would just update the URL to the stylesheet whenever the relevant
setting changes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46540#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list