Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8244 closed bug (invalid)

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

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.next
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.

Change History (3)

comment:1 Changed 12 years ago by snover

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.

comment:2 Changed 12 years ago by [email protected]

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','Helvetica'); $('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?

comment:3 Changed 12 years ago by snover

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.

Note: See TracTickets for help on using tickets.