Forum
11:08
30/07/2009
There are a few cases where the result of jQuery.css is being used as if it were of type jQuery. IE8 (and probably others) doesnt like that:
grid.base.js:1086
11:55
Moderators
30/10/2007
Hello,
Sorry, but I think that this is not true.
Here is the jQuery css:
css: function( key, value ) {
// ignore negative width and height values
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
value = undefined;
return this.attr( key, value, "curCSS" );
},
And here the attr
attr: function( name, value, type ) {
var options = name;
// Look for the case where we're accessing a style value
if ( typeof name === "string" )
if ( value === undefined )
return this[0] && jQuery[ type || "attr" ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if we're setting style values
return this.each(function(i){
// Set all the styles
for ( name in options )
jQuery.attr(
type ?
this.style :
this,
name, jQuery.prop( this, options[ name ], type, i, name )
);
});
},
So if we set value the css return this.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
15:30
30/07/2009
Sorry, you're right... except that there appears to be a minor bug in jQuery.
If you're setting height or width, and you pass in a -ve value, (eg $("#foo").css("width", "-4px"), then it goes through the "undefined" case in the above, which then /returns/ the width, rather than setting the width, and returning a jQuery.
That's what was happening, and I just jumped to the conclusion that css always returned a string.
So now I need to track down how colModel[i].width gets to be < 0. I think it has something to do with autowidth.
In any case, its probably my bug (in that it doesnt show up in firefox) - but I'd still say that its a good idea not to chain the css method when setting width/height by name unless you're certain the width/height is >= 0.
Mark
01:35
Moderators
30/10/2007
Hello Mark,
Thanks for this. I do not know about this bug. Will try to set the css at end of the expressions, where possible, but I think that this will be fixed in the next release of jQuery.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
87 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66