Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7409 closed bug (wontfix)

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: http://jsfiddle.net/boecko/3EdaS/2/[[BR]]

1.4.2 -> border-width 4px 4px (right)

1.4.3 -> border-width (nothing!!)

1.4.4rc2 -> border-width auto auto

Change History (17)

comment:1 Changed 12 years ago by boecko

comment:2 Changed 12 years ago by boecko

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

comment:3 Changed 12 years ago by boushley

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

comment:4 Changed 12 years ago by Rick Waldron

Cc: john snover added
Component: unfiledcss
Keywords: needsreview added
Priority: undecidedblocker
Status: newopen

comment:5 Changed 12 years ago by boecko

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.

  1. 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;
    };

:

comment:6 Changed 12 years ago by Rick Waldron

Cc: john snover removed
Milestone: 1.51.4.5

The behavior for >=1.4.3 is markedly regressed

comment:7 Changed 12 years ago by boecko

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!!)
Last edited 12 years ago by boecko (previous) (diff)

comment:8 Changed 12 years ago by Rick Waldron

Cc: snover john added
Keywords: regression added
Milestone: 1.4.51.4.4
Last edited 12 years ago by Rick Waldron (previous) (diff)

comment:9 Changed 12 years ago by Rick Waldron

Keywords: needstest added

comment:10 Changed 12 years ago by Rick Waldron

Keywords: needsreview regression needstest removed
Milestone: 1.4.41.5
Priority: blockerlow

comment:11 Changed 12 years ago by Rick Waldron

Cc: snover john removed
Milestone: 1.5
Resolution: wontfix
Status: openclosed
Last edited 12 years ago by Rick Waldron (previous) (diff)

comment:12 Changed 12 years ago by boecko

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', "") 

Last edited 12 years ago by boecko (previous) (diff)

comment:13 Changed 12 years ago by boecko

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.

comment:14 Changed 12 years ago by boecko

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/

Last edited 12 years ago by boecko (previous) (diff)

comment:15 Changed 12 years ago by kswedberg

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

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

comment:16 Changed 12 years ago by boecko

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

comment:17 Changed 11 years ago by anonymous

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.

Note: See TracTickets for help on using tickets.