javascript - CSS - returning different values from different browsers -


when using jquery grab css values objects, each of browsers (ie, mozilla, chrome, etc) returns different values.

for example, in chrome, background image (.css("background-image")) returns:

url(http://i41.tinypic.com/f01zsy.jpg) 

where in mozilla, returns:

url("http://i41.tinypic.com/f01zsy.jpg") 

i having same problem on other aspects, such background-size.

in chrome returns:

50% 50% 

but mozilla returns:

50%+50% 

my problem is, have functions split css (background-size), example based on space .split(" "), not work on mozilla because uses + instead.

is there way can fix problem , make browsers use 1 standard?

is there function write grabs , splits values, based on type of browser user using?

different browsers use different css standards , may have write full-blown parser make them 1 standard.

workaround should split or use css values taking account different browsers standards. css(background-size) problem can solved using this:

space.split("\\s|\\+"); //split string either has space 'or' plus sign 

for css(background-image), solution may replace inverted commas before using it:

space.replace("\"", ""); 

try make splits generallized browsers. hope helps.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -