JavaScript utility for working with vendor-prefixed properties.
The Sass part of this module is now deprecated.
Please use an alternative way to provide styles for a specific user agent: conditional comments, selector and property hacks… Feel free to use http://browserhacks.com
This module has been verified in Internet Explorer 7+, modern desktop browsers
(Chrome, Safari, Firefox, …) and mobile browsers (Android browser, iOS safari,
Chrome mobile).
To include o-useragent
in your module follow the instructions in
the module's page in the Origmai registry.
The JS prefixer is now deprecated. Please use an alternative method for testing for and applying
vendor prefixes for JS properties and CSS styles within your JS.
o-useragent.prefixer
retrieves vendor-prefixed properties if the browser
doesn't yet support it unprefixed.
Notes:
The methods below return the unprefixed name if it exists, failing that they
retrieve the prefixed name, or false if the property is not defined at all.
o-useragent#prefixer.css(propertyName)
o-useragent#prefixer.style(propertyName)
o-useragent#prefixer.dom(obj, propertyName)
The methods below retrieve the values of prefixed properties defined on given objects.
o-useragent#prefixer.getStyleValue(element, propertyName)
retrieves the value of a HTML element's style property, or false if not defined.
If propertyName
is a space-separated list of values then an object of the
following form is returned:
{
propertyName1: {
prefixedName: webkitPrefixedName1,
value: 'value1'
},
propertyName2: {
prefixedName: webkitPrefixedName2,
value: 'value2'
}
}
o-useragent#prefixer.getDomProperty(obj, propertyName)
retrieves the value of a DOM object's property, or false if not defined
o-useragent#prefixer.getDomMethod(obj, propertyName, [bindTo])
retrieves a method of a DOM object bound to that object (or to a
different obj if one is passed as a third parameter).
Returns false if the property is undefined or not a function
This software is published by the Financial Times under the MIT licence.