Bug Tracker

Modify

Ticket #8244 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: chip.cullen@… Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description

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:

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

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

comment:1 Changed 2 years ago by snover

  • Status changed from new to closed
  • Resolution set to invalid

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 2 years ago by chip.cullen@…

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 2 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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.