Ticket #5583 (closed bug: worksforme)
Patch: .css() appends 'px' to all numeric values, IE barfs with "Invalid argument."
|Reported by:||Catrope||Owned by:|
When calling $('something').css('z-index', 10) , jQuery.prop() incorrectly transforms the 10 to '10px' . Firefox doesn't seem to mind, but IE throws a JS error.
jQuery.prop() does check for z-index and some other numeric non-pixel properties with !exclude.test(name) , but that doesn't help much with:
var exclude = / z - ? index | font - ? weight | opacity | zoom | line - ? height /i,
It sure does look nice with all those spaces, but it doesn't match any of the intended properties any more. The correct regex is:
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
This bug only happens when using jQuery in non-minified form, because the minifier (wrongly!) removes the spaces in the regex.
- Status changed from new to closed
- Resolution set to worksforme