Page MenuHomePhabricator

[WebFonts] Uncaught TypeError: Cannot read property 'replace' of undefined
Closed, ResolvedPublic

Description

Uncaught TypeError: Cannot read property 'replace' of undefined

Caused by:

overridableFontFamilies = $.map( overridableFontFamilies, function( item ) { return item.replace( /[\s'"]/g, '' ); } );

item is undefined because overridableFontFamilies contains undefined. It contains undefined because of:

overridableFontFamilies: [ $( 'h1' ).css( 'font-family' ) ]

This particular page does not have h1 element, so the call returns undefined.


Version: master
Severity: normal

Details

Reference
bz67676

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:26 AM
bzimport set Reference to bz67676.

Happens for example on the translatewiki.net main page.

Change 172022 had a related patch set uploaded by Nikerabbit:
Fix JavaScript error on pages without headings

https://gerrit.wikimedia.org/r/172022

Thanks a lot for the fix. I wondered whether something is broken on my end.

Change 172022 merged by jenkins-bot:
Fix JavaScript error on pages without headings

https://gerrit.wikimedia.org/r/172022