Bug Tracker

Opened 9 years ago

Closed 9 years ago

#8580 closed bug (wontfix)

Firefox versions return incorrect font-weight

Reported by: hannasm Owned by: hannasm
Priority: low Milestone: 1.next
Component: css Version: 1.5
Keywords: font-weight, firefox Cc:
Blocked by: Blocking:

Description

https://bugzilla.mozilla.org/show_bug.cgi?id=77882

I stumbled upon this while trying to measure text with the canvas object.

A <strong> tag defaults font-weight:bolder which in firefox returns 401. Impact is that anything that needs an accurate font-weight (such as configuring canvas for measuring/rendering text) will fail.

<script src="jquery-1.5.min.js" language="javascript" type="text/javascript"></script>
<strong id="myStrong">
test test
</strong>
<script type="text/javascript">
alert($('#myStrong').css('font-weight')); // 401
</script>

This has been tested in firefox 3.6.10 but, from what i've gathered, affects many more versions of firefox both forward and backward.

I admit this is a bug in firefox but for compatibility jquery should probably know how to handle this scenario and give something closer to the real font-weight.

Change History (4)

comment:1 Changed 9 years ago by hannasm

here's a fiddle for convenience

http://jsfiddle.net/H9znQ/1/

comment:2 Changed 9 years ago by dmethvin

Owner: set to hannasm
Status: newpending

So is 401 not an accurate value? If not, I agree that this sounds more like something Firefox needs to fix. Have you reported it via Bugzilla? The closest thing I found was this:

https://bugzilla.mozilla.org/show_bug.cgi?id=604815

comment:3 Changed 9 years ago by hannasm@…

First line of the op has another of the relevant firefox bug reports. It was reported in 2001 so affects *many* versions of the browser. I am just suggesting jquery implement a workaround.

https://bugzilla.mozilla.org/show_bug.cgi?id=77882

comment:4 Changed 9 years ago by addyosmani

Component: unfiledcss
Keywords: font-weight firefox added
Priority: undecidedlow
Resolution: wontfix
Status: pendingclosed

Thanks for submitting your bug report. We've discussed this with other members of the bug triage team and we feel that this is an issue Mozilla/Firefox need to fix on their end as the behavior for it is undefined. If you do need to workaround, normalization should be possible using cssHooks.

Although there are occasions where it makes sense for jQuery core to implement workarounds to enable expected or consistent behavior, we believe that the above ticket isn't one of those.

Thanks for bringing this to our attention, nevertheless :)

Last edited 9 years ago by addyosmani (previous) (diff)
Note: See TracTickets for help on using tickets.