#14792 closed bug (fixed)
Inconsistent .css('font-weight') return values
Reported by: | whatthejeff | Owned by: | dmethvin |
---|---|---|---|
Priority: | low | Milestone: | 1.11.1/2.1.1 |
Component: | css | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The origin of this issue is: https://github.com/jquery/jquery/commit/b9b87d53c681a8337cdbdbe81f8f4e577e5ec277
In WebKit/Blink browsers, window.getComputedStyle
returns the following for font-weight
:
- "100"
- "200"
- "300"
- "normal"
- "500"
- "600"
- "bold"
- "800"
- "900"
In WebKit/Blink browsers, .css()
returns the following for font-weight
:
- "100"
- "200"
- "300"
- 400
- "500"
- "600"
- "bold"
- "800"
- "900"
It's inconsistent that the return type for normal/400 is a Number
when the return type for all other values is a String
.
It's also a little confusing that "normal" is converted to a numeric value, but "bold" is not.
In other browsers, both window.getComputedStyle
and .css()
return numeric strings for all values. This seems like the most desirable behavior.
Change History (5)
comment:1 Changed 10 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
comment:2 Changed 10 years ago by
Milestone: | None → 1.11.1/2.1.1 |
---|---|
Status: | new → open |
Let's fix "400" but not "bold".
comment:3 Changed 10 years ago by
Owner: | set to dmethvin |
---|---|
Status: | open → assigned |
comment:4 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
CSS: Return values should be numbers
Fixes #14792
Changeset: f4b37d89820535d6c7503925aa8872645681a865
Seems that once again we're halfway in to fixing a messy rare edge case, one that probably matters for 1% of all users since it's survived this long. The spec does say that "bold" ==> 700 though so we could attempt to fix this.
http://www.w3.org/TR/css-fonts-3/#font-weight-prop