Skip to content

.css method return wrong value for negative percent margin #1815

@deneb7000

Description

@deneb7000

.css method return wrong value for margin on an hidden element if it is specified as negative percent.
the value of width is returned instead.

examples:
$("<div/>").css({'margin': '-2%'}).css("marginTop"); // return "auto" - WRONG: expected "-2%"

$("<div/>").css({'margin': '-2%', 'width': '60%'}).css("marginTop"); // return "60%" - WRONG: expected "-2%"

$("<div/>").css({'margin': '2%'}).css("marginTop"); // return "2%" - CORRECT

$("<div/>").css({'margin': '-2px'}).css("marginTop"); // return "-2px" - CORRECT

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions