[wp-trac] [WordPress Trac] #45053: Customizer throws JS errors when page contains <area> tag without href attribute
WordPress Trac
noreply at wordpress.org
Fri Oct 5 08:41:48 UTC 2018
#45053: Customizer throws JS errors when page contains <area> tag without href
attribute
--------------------------+-----------------------------
Reporter: janthiel | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.9.8
Severity: normal | Keywords: has-patch
Focuses: javascript |
--------------------------+-----------------------------
Using the customizer on a page that contains <area> Tags without href
attributes leads to JS errors. api.prepareLinkPreview expects the parsed
elements to have a href attribute.
<area> tags can contain them, but do not have to (
https://www.w3.org/TR/html52/semantics-embedded-content.html#the-area-
element ). <area> Tags are used in Google Maps with Markers for example
(e.g. in Enfolds implementation).
This is the JS error thrown:
{{{
customize-preview.min.js?ver=4.9.8:formatted:131 Uncaught TypeError:
Cannot read property 'substr' of undefined
at Function.d.prepareLinkPreview (customize-
preview.min.js?ver=4.9.8:formatted:131)
at HTMLAreaElement.<anonymous> (customize-
preview.min.js?ver=4.9.8:formatted:102)
at Function.each (jquery.js?ver=1.12.4:2)
at n.fn.init.each (jquery.js?ver=1.12.4:2)
at customize-preview.min.js?ver=4.9.8:formatted:101
at Function.m.each.m.forEach (underscore.min.js?ver=1.8.3:5)
at MutationObserver.<anonymous> (customize-
preview.min.js?ver=4.9.8:formatted:100)
}}}
The attached patch simply narrows the selector to only target <area> tags
WITH href attributes in handleUpdatedChangesetUuid. Other area Tags are no
Links and thus not a target for the prepareLinkPrevie Method.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45053>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list