Skip to main content

Bug Tracker

Side navigation

#8580 closed bug (wontfix)

Opened March 21, 2011 08:51PM UTC

Closed March 30, 2011 02:06PM UTC

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.

Attachments (0)
Change History (4)

Changed March 21, 2011 08:58PM UTC by hannasm comment:1

here's a fiddle for convenience

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

Changed March 24, 2011 09:46PM UTC by dmethvin comment:2

owner: → 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

Changed March 25, 2011 12:20AM UTC by hannasm@gmail.com comment:3

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

Changed March 30, 2011 02:06PM UTC by addyosmani comment:4

_comment0: 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. Although there are occasions where it makes sense for jQuery core to implement workarounds to enable expected or consistent behavior, we believe that this isn't one of those. Thanks for bringing this to our attention, nevertheless :)1301497108078811
component: unfiledcss
keywords: → font-weight,firefox
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 :)