Skip to main content

Bug Tracker

Side navigation

#8244 closed bug (invalid)

Opened February 11, 2011 03:05AM UTC

Closed February 11, 2011 03:22AM UTC

Last modified February 11, 2011 04:12AM UTC

jQuery can't correctly handle font names that end with a number

Reported by: Owned by:
Priority: undecided Milestone:
Component: unfiled Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

This is a weird behavior, and an admittedly limited use case, but:

If you try to change an element's font-family css attribute using jQuery, and the font-family you are specifying ends in something other than a letter, it doesn't work.

For instance, this works:


This, however, will not:

$('h1').css('font-family','Goudy Bookletter 1911');

jQuery just won't perform the function. The selected element retains whatever font-family has been assigned by other means.

I've tested it with the console, and can verify this is the case in both 1.4.2 and 1.5.

Attachments (0)
Change History (3)

Changed February 11, 2011 03:22AM UTC by snover comment:1

resolution: → invalid
status: newclosed

Thanks for the report, but this is not a jQuery bug. If you are specifying a font family with spaces in it, you must enclose it in quotes. If this is still a problem, please reply with a working test case as per the bug reporting guidelines that are linked on the home page of the bug tracker. Otherwise, please use the jQuery Forum for support requests.

Changed February 11, 2011 03:58AM UTC by comment:2

I'm sorry - I didn't supply enough examples, and that seems to have clouded the issue. The example I should have left was:

These work:


$('h1').css('font-family','Times New Roman');

$('h1').css('font-family','Courier New');

These do not:

$('h1').css('font-family','Goudy Bookletter 1911');

$('h1').css('font-family','Another font name!#2');

The enclosing of the font name, with or without spaces, works fine. It's only when the *font name ends in something other than a letter* that jQuery stops working.

Does that help?

Changed February 11, 2011 04:12AM UTC by snover comment:3

It doesn’t help because you are misidentifying the issue and did not read what I already told you was the problem. Please see this test case demonstrating your problem. If you submit a bug report in the future, please include a test case like the one I just linked to.