- The stable Firefox release utilizes the W3C-standard non-prefixed
transition-property
CSS property;
- You have to camelCase CSS properties to apply in JS style;
- You're trying to set a style to a nodeList, which is what the DOM QSA method returns. You need to iterate over it.
For a cross-browser solution, using jQuery it'd be as simple as:
$('p').css({transitionProperty: "all", transitionDuration: '2s'});
See fiddle
If you want a pure JS solution, here's the code for testing supported CSS properties from $.cssHooks
:
function styleSupport(prop) {
var vendorProp, supportedProp,
// capitalize first character of the prop to test vendor prefix
capProp = prop.charAt(0).toUpperCase() + prop.slice(1),
prefixes = ["Moz", "Webkit", "O", "ms"],
div = document.createElement("div");
if (prop in div.style) {
// browser supports standard CSS property name
supportedProp = prop;
} else {
// otherwise test support for vendor-prefixed property names
for (var i = 0; i < prefixes.length; i++) {
vendorProp = prefixes[i] + capProp;
if (vendorProp in div.style) {
supportedProp = vendorProp;
break;
}
}
}
// avoid memory leak in IE
div = null;
// add property to $.support so it can be accessed elsewhere
//$.support[prop] = supportedProp;
return supportedProp;
}
Then just use it as such:
(function() {
var transitionProperty = styleSupport("transitionProperty");
var transitionDuration = styleSupport("transitionDuration");
var actor_object = document.querySelectorAll("p");
for (var i = 0, l = actor_object.length; i < l; i++) {
actor_object[i].style[transitionProperty] = "all";
actor_object[i].style[transitionDuration] = "2s";
}
}());
Fiddle