Bug Tracker

Opened 14 years ago

Closed 14 years ago

#3731 closed bug (duplicate)

internet explorer issue with "background-position"

Reported by: sanaell Owned by:
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: background-position, backgroundPosition, IE Cc: sanaell
Blocked by: Blocking:

Description

If you try to do a $(this).css("background-position"); you got "undefined" under internet explorer

But if you do $(this).css("backgroundPosition"); you got an answer

so it's a little problem easy to fix (but maybe exist a better way) my solution is to add few line to the attr function

[code] 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 ) {

var camelCase = name.replace(/\-(\w)/g, function(all, letter){

return letter.toUpperCase();

});

return this[0] && jQuery[ type
"attr" ]( this[0], camelCase );

} 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 )

);

});

},

code

i've tested on one of my website using a lot of jquery & jquery plugin, without bug, and with the good behavior... if someone have a better solution feel free :) (added) line 157 to 163 core.js

if ( value === undefined ) {

var camelCase = name.replace(/\-(\w)/g, function(all, letter){

return letter.toUpperCase();

});

return this[0] && jQuery[ type
"attr" ]( this[0], camelCase );

}

Change History (1)

comment:1 Changed 14 years ago by dmethvin

Cc: sanaell added
Resolution: duplicate
Status: newclosed

Duplicate of #3732. Still need a test case there.

Note: See TracTickets for help on using tickets.