Side navigation
#7267 closed bug (duplicate)
Opened October 21, 2010 12:34PM UTC
Closed October 21, 2010 07:30PM UTC
Last modified October 21, 2010 07:30PM UTC
Problem with $("").css('width') when upgrading from Jquery 1.4.2 to 1.4.3
Reported by: | frodik.cz@gmail.com | 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 ?!
Attachments (0)
Change History (3)
Changed October 21, 2010 03:49PM UTC by comment:1
_comment0: | All of the tests that I've run on your code are returning 0px for 1.4.3 and auto for 1.4.2. 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). \ \ → 1287689052526105 |
---|---|
keywords: | → css width inline definition |
priority: | undecided → low |
Changed October 21, 2010 07:30PM UTC by comment:2
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).