#7267 closed bug (duplicate)
Problem with $("").css('width') when upgrading from Jquery 1.4.2 to 1.4.3
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.5 |
Component: | unfiled | Version: | 1.4.3 |
Keywords: | css width inline definition | Cc: | |
Blocked by: | Blocking: |
Description
Maybe this problem is with other .css() parameters, but in my case, Jquery behaves really strange.
When I use 1.4.2, these both cases below return the same output, that is "700px". But when I use 1.4.3, only in the first case the result is "700px", in the second case the result is "0px"
FIRST CASE: var div = $('<div id="product_edit_text" style="width:700px;height:300px;background-color:#fff"> </div>'); console.log(div.css('width')); returns "700px" in both 1.4.2 and 1.4.3
SECOND CASE: var div = $('<div id="product_edit_text" style="width: 700px; height: 300px; background-color: rgb(255, 255, 255); "> </div>'); console.log(div.css('width')); returns "700px" in 1.4.2, but "0px" in 1.4.3 - BUG ?!
Change History (3)
comment:1 Changed 12 years ago by
Keywords: | css width inline definition added |
---|---|
Priority: | undecided → low |
comment:2 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
The test code provided in the initial description is invalid, as it contains zero-width spaces.
All of the tests that I've run on your code are returning 0px for 1.4.3 and auto for 1.4.2. Live test case
Bare in mind that this doesn't just apply for the width value, it also applies to height, background-color etc.
Ideally, adding inline styles in this manner is strongly unrecommended as using class-names (or even correct CSS style definitions outside of the string would make your solution both work and be a lot more clean).