Why jQuery.css does not apply a property if it is not supported and how is this being checked? -


i'm bit confused. expected $.css() method dumbly add css property element no matter what. know, in chrome dev tools, when apply css property element , appears in html. apparently somehow checks if supported. example, if run command:

$('#element').css('display','block'); /* returns jquery object) */ $('#element').css('display') /* returns "block" */ 

but if put like

$('#element').css('hurr','durr'); $('#element').css('hurr') /* returns undefined */ 

so, jquery checks if property appliable?

another example. opera not support css filters. or it? well, used method described here , surprisingly returned true 'filter'. tried apply $.css:

$('#element').css('filter','blur(5px)'); $('#element').css('filter') /*returns "" (an empty string) * 

so, not jquery check if element supported checks if value legit. how that? right way check if property supported?

jquery indeed filtering out values, isn't doing intentionally in case. has how retrieves styles using getcomputedstyle() apparently knows "hurr" isn't valid style isn't returned part of , when jquery looks "hurr" in computed style, isn't there returns undefined.

in chrome, style value appear there on style object, when set via jquery, isn't retrieved .css() because it's not real style.

if want set unsupported style value, can use style object directly according comments in jquery code, versions of ie might throw exception if try set doesn't know about:

var elem = document.getelementbyid("element"); elem.style.hurr = "durr"; console.log(elem.style.hurr);   // in chrome, gives "durr" 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -