Bug Tracker

Modify

Ticket #3731 (closed bug: duplicate)

Opened 4 years ago

Last modified 4 years ago

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
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by dmethvin

  • Cc sanaell added
  • Status changed from new to closed
  • Resolution set to duplicate

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.