Bug Tracker

Opened 14 years ago

Closed 14 years ago

#3562 closed bug (wontfix)

code to get pixel values for other measurement units is lacking

Reported by: koteskie Owned by:
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by davidserduke)

pixel value for a border-width set to for example thin is incorrect. the following code does the trick.

var toPixels = function ( element , value )
        if ( /^(\d+)|(small|medium|large|thin|thick)$/ . test ( value ) )
            var tmp = document.createElement ( 'span' );
            tmp.style.position = 'absolute';
            tmp.style.visibility = 'hidden';
            tmp.style.borderStyle = 'solid';
            tmp.style.borderRightWidth = '0px';
            tmp.style.borderLeftWidth = value;
            element.parentNode.appendChild ( tmp );
            value = tmp.offsetWidth + 'px';
            element.parentNode.removeChild ( tmp );
        return value;

Change History (3)

comment:1 Changed 14 years ago by flesler

Component: unfilledcore
Owner: flesler deleted

comment:2 Changed 14 years ago by davidserduke

Description: modified (diff)

comment:3 Changed 14 years ago by brandon

Resolution: wontfix
Status: newclosed

This would be better as a plugin for those who need this functionality.

Note: See TracTickets for help on using tickets.