[wp-trac] [WordPress Trac] #36473: JavaScript error in theme customizer a specific value of before_widget
WordPress Trac
noreply at wordpress.org
Mon Apr 11 11:25:45 UTC 2016
#36473: JavaScript error in theme customizer a specific value of before_widget
--------------------------+-----------------------------
Reporter: martin.krcho | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.4.2
Severity: normal | Keywords:
Focuses: ui |
--------------------------+-----------------------------
I just came across an issue with the theme customizer. It is failing with
the following JavaScript error
{{{
Uncaught Error: Syntax error, unrecognized expression:
SECTION.widget.widget-%2$s,SECTION.widget.widget-%2$s,SECTION.widget.widget-%2$s,SECTION.widget.widget-%2$s,SECTION.widget.widget-%2$s,SECTION.widget.widget-%2$s
}}}
I tracked this issue down to the function buildWidgetSelectors in
customize-preview-widgets.min.js, specififcally to this bit of code:
{{{
d.before_widget.replace("%1$s", "").replace("%2$s", "")
}}}
I am using theme called Bearded that defines the "before_widget" as
follows:
{{{
<section id="%1$s" class="widget %2$s widget-%2$s">
}}}
A possible fix would be to make both of the replace actions mentioned
above replace ALL occurencies of the pattern:
{{{
d.before_widget.replace(/%1\$s/g, "").replace(/%2\$s/g, "")
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36473>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list