Skip to main content

Bug Tracker

Side navigation

#11952 closed bug (wontfix)

Opened June 21, 2012 10:51PM UTC

Closed June 22, 2012 12:22PM UTC

Last modified June 29, 2012 06:42AM UTC

[safari] Font properties not parsed/returned correctly by css function

Reported by: christopher@currie.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Given

<div>Font: <span id="font"></span></div>
<div>Font Size: <span id="fontSize"></span></div>

and

var text = '<div style="font: 10px Verdana; color: Black"></div>'

$('#font').text($(text).css('font'))
$('#fontSize').text($(text).css('font-size'))

On Safari 5.1.7 Mac and Mobile Safari iOS (all versions) css('font-size') returns a value of '' (empty string)

It appears to work correctly on:

  • Chrome 19 Mac and Win
  • Firefox 13 Mac and Win
  • IE 9

http://jsfiddle.net/MeJjZ/

Attachments (0)
Change History (2)

Changed June 22, 2012 12:22PM UTC by mikesherov comment:1

resolution: → wontfix
status: newclosed

"font" is shorthand. The jQuery API does not gaurantee retrieval of shorthand properties. This just happens to work on some browsers, but is not something we intend to support.

Changed June 29, 2012 06:42AM UTC by christopher@currie.com comment:2

Just a quick request for clarification: I understand the documentation says that "retrieval" of shorthand properties is not guaranteed. I would interpret this to mean that a call like "$(elem).css('font')" is not guaranteed.

By your resolution, do you also mean that if the source HTML contains shorthand properties, then the contents of that property are not guaranteed to be available? If so, then it would be helpful if this were explicitly spelled out in the documentation.