Skip to main content

Bug Tracker

Side navigation

#7409 closed bug (wontfix)

Opened November 05, 2010 09:07AM UTC

Closed November 11, 2010 05:37PM UTC

Last modified August 12, 2012 01:05AM UTC

jQuery.fn.css('border-width') is seriously flawed

Reported by: boecko Owned by:
Priority: low Milestone:
Component: css Version: 1.4.4rc
Keywords: Cc:
Blocked by: Blocking:
Description

see: Attachments (0)

Change History (17)

Changed November 05, 2010 09:29AM UTC by boecko comment:2

the above output is from WebKit.

Firefox reports this:

1.4.2 -> border-width 4px (still right, css('border-width') is empty)

1.4.3 -> border-width (nothing!!)

1.4.4rc2 -> border-width auto auto

Changed November 05, 2010 02:59PM UTC by boushley comment:3

The test case is reproduceable and this seems like a valid issue.

Changed November 05, 2010 05:33PM UTC by rwaldron comment:4

cc: → john, snover
component: unfiledcss
keywords: → needsreview
priority: undecidedblocker
status: newopen

Changed November 06, 2010 12:15PM UTC by boecko comment:5

As a already said in #7283

this is definitely the desired result now
  • I think it's not good to change the expected result between minor versions.
  • a cleaner solution would be:

a) to introduce a unit converter function (unitInPixels), which can be called if desired

b) a cssCurrent - function or something , which reports back the current value in pixels or whatever.

3. for mmToPixels i'm using following function to get the dpi

    function getDpi() {
        var mm = 100000;
        var dpitest = $('<div id="dpitest" style="disply:none;width:'+ mm + 'mm;height:10px"/>');
        var inch2mm = 25.4;
        dpitest.appendTo('body');
        var px = dpitest.outerWidth();
        var dpi = Math.round(px / (mm / inch2mm) * 1000) / 1000;
        dpitest.remove();
        return dpi;
    };

:

Changed November 10, 2010 10:49PM UTC by rwaldron comment:6

cc: john, snover
milestone: 1.51.4.5

The behavior for >=1.4.3 is markedly regressed

Changed November 11, 2010 02:27PM UTC by boecko comment:7

_comment0: next one in here RC3 ... \ http://jsfiddle.net/boecko/3EdaS/ \ \ \ {{{ \ 1.4.2 -> border-width 4px 4px (right) \ 1.4.3 -> border-width (nothing!!) \ 1.4.4rc2 -> border-width auto auto \ 1.4.4rc3 -> border-width (nothing! \ }}} \ \ 1289485714522120

next one in here RC3 ...

http://jsfiddle.net/boecko/3EdaS/

1.4.2 -> border-width 4px 4px (right)
1.4.3 -> border-width (nothing!!)
1.4.4rc2 -> border-width auto auto
1.4.4rc3 -> border-width (nothing!!)

Changed November 11, 2010 05:17PM UTC by rwaldron comment:8

_comment0: Confirmed. This issue very, very broken. \ \ \ jQuery 0 GIT: \ http://jsfiddle.net/rwaldron/3EdaS/10/ \ \ jQuery 1.4.4rc3: \ http://jsfiddle.net/rwaldron/3EdaS/13/ \ \ jQuery 1.4.3: \ http://jsfiddle.net/rwaldron/3EdaS/12/ \ \ jQuery 1.4.2: \ http://jsfiddle.net/rwaldron/3EdaS/9/ \ \ jQuery 1.3.2: \ http://jsfiddle.net/rwaldron/3EdaS/11/ \ \ 1289495924716166
cc: → snover, john
keywords: needsreviewneedsreview, regression
milestone: 1.4.51.4.4

Changed November 11, 2010 05:21PM UTC by rwaldron comment:9

keywords: needsreview, regressionneedsreview, regression, needstest

Changed November 11, 2010 05:25PM UTC by rwaldron comment:10

keywords: needsreview, regression, needstest
milestone: 1.4.41.5
priority: blockerlow

Changed November 11, 2010 05:37PM UTC by rwaldron comment:11

_comment0: use .css("border-width-top") \ \ See also: \ \ https://github.com/brandonaaron/jquery-cssHooks \ \ http://blog.petersendidit.com/1289497150452490
cc: snover, john
milestone: 1.5
resolution: → wontfix
status: openclosed

Changed November 11, 2010 07:18PM UTC by boecko comment:12

_comment0: this is fucked up .... \ csshooks may bee fine, but have you ever heard the word compatibility between minor versions? \ \ so why don't implement the basic versions via csshooks like it was and let it extend to whatever nifty feature you want? \ \ Think about the plethora of plugins which breaks, because of that! \ my jquery-plugin (here in action http://www.logowein.de/designer.php?_theme=polaroid) reads the css-value of a html-template (e.g in mm) to modify this value via a JQ UI-Slider. \ \ Now, because some genius thinks he can break a stable api, i have to maintain to versions of that. \ \ BTW: Where in hell is the behavior change documented? \ http://blog.jquery.com/2010/10/16/jquery-143-released/ this way to little info for my taste .. \ Couldn't you just give a simple function/hint for the old behavior? \ \ This isn't even consistent! Apparently you should get the computed value as number, BUT you have to unset it via string and not null (#7233). Don't tell me, that this well thought: just to clarify \ \ {{{ \ \ $.css('width') -> gets a computed number instead of a string \ $.css('width',null) doesn't work, because it exepects a string \ -> $.css('width', "") \ \ }}} \ \ 1289503122290206
_comment1: this is fucked up .... \ csshooks may be fine, but have you ever heard the word compatibility between minor versions? \ \ so why don't implement the basic versions via csshooks like it was and let it extend to whatever nifty feature you want? \ \ Think about the plethora of plugins which breaks, because of that! \ my jquery-plugin (here in action http://www.logowein.de/designer.php?_theme=polaroid) reads the css-value of a html-template (e.g in mm) to modify this value via a JQ UI-Slider. \ \ Now, because some genius thinks he can break a stable api, i have to maintain to versions of that. \ \ BTW: Where in hell is the behavior change documented? \ http://blog.jquery.com/2010/10/16/jquery-143-released/ this way to little info for my taste .. \ Couldn't you just give a simple function/hint for the old behavior? \ \ This isn't even consistent! Apparently you should get the computed value as number, BUT you have to unset it via string and not null (#7233). Don't tell me, that this well thought: just to clarify \ \ {{{ \ \ $.css('width') -> gets a computed number instead of a string \ $.css('width',null) doesn't work, because it exepects a string \ -> $.css('width', "") \ \ }}} \ \ 1289503196037241

this is fucked up ....

csshooks may be fine, but have you ever heard the 4 words "compatibility between minor versions"?

so why don't implement the basic versions via csshooks like it was and let it extend to whatever nifty feature you want?

Think about the plethora of plugins which breaks, because of that!

my jquery-plugin (here in action http://www.logowein.de/designer.php?_theme=polaroid) reads the css-value of a html-template (e.g in mm) to modify this value via a JQ UI-Slider.

Now, because some genius thinks he can break a stable api, i have to maintain to versions of that.

BTW: Where in hell is the behavior change documented?

http://blog.jquery.com/2010/10/16/jquery-143-released/ this way to little info for my taste ..

Couldn't you just give a simple function/hint for the old behavior?

This isn't even consistent! Apparently you should get the computed value as number, BUT you have to unset it via string and not null (#7233). Don't tell me, that this well thought: just to clarify


$.css('width') -> gets a computed number instead of a string
$.css('width',null) doesn't work, because it exepects a string
-> $.css('width', "") 

Changed November 11, 2010 08:17PM UTC by boecko comment:13

JESUS!..

http://jsfiddle.net/boecko/3EdaS/14/

instead of ..

$('#foo').css('borderWidth');

i have to use

$.style($('#foo')[0], 'borderWidth');

now, to get the expected behavior. really nice.

Changed November 11, 2010 08:25PM UTC by boecko comment:14

_comment0: BTW: \ Your suggestion \ > use .css("border-width-top") \ \ doesn't work.So how on earth can you close this bug!?1289507188555317

BTW:

Your suggestion

use .css("border-width-top")

doesn't work.So how on earth can you close this bug!?

http://jsfiddle.net/boecko/3EdaS/15/

Changed November 11, 2010 08:43PM UTC by kswedberg comment:15

@boecko, use .css('border-top-width") or .css("borderTopWidth")

http://jsfiddle.net/3EdaS/16/

Changed November 11, 2010 09:18PM UTC by boecko comment:16

@ kswedberg

agreed .. it works .. but it's not intuitive, because i'm interested in the style value.

Changed August 12, 2012 01:05AM UTC by anonymous comment:17

Issue still at large and very frustrating. Furthermore, chrome and opera (latest builds) deal with it by reading the general border-width value as one would hope, internet explorer (8&9) and safari effectively and such call and walk on past, but in firefox calling css("border-width") breaks the code. At a minimum this represents a lack of cross browser support.