Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11952 closed bug (wontfix)

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

Reported by: christopher@… 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/

Change History (2)

comment:1 Changed 7 years ago by mikesherov

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.

comment:2 Changed 7 years ago by christopher@…

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.

Note: See TracTickets for help on using tickets.