Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($sniffer): ensure older versions of webkit work for animations
Browse files Browse the repository at this point in the history
  • Loading branch information
matsko authored and mhevery committed Aug 19, 2013
1 parent b7a5449 commit b1a43cd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ng/sniffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function $SnifferProvider() {
break;
}
}

if(!vendorPrefix) {
vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
}

transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));

Expand Down
33 changes: 33 additions & 0 deletions test/ng/snifferSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ describe('$sniffer', function() {
});
});

it('should still work for an older version of Webkit', function() {
module(function($provide) {
var doc = {
body : {
style : {
WebkitOpacity: '0'
}
}
};
$provide.value('$document', jqLite(doc));
});
inject(function($sniffer) {
expect($sniffer.vendorPrefix).toBe('webkit');
});
});

});

describe('animations', function() {
Expand Down Expand Up @@ -201,6 +217,23 @@ describe('$sniffer', function() {
expect($sniffer.animations).toBe(true);
});
});

it('should be true when an older version of Webkit is used', function() {
module(function($provide) {
var doc = {
body : {
style : {
WebkitOpacity: '0'
}
}
};
$provide.value('$document', jqLite(doc));
});
inject(function($sniffer) {
expect($sniffer.animations).toBe(false);
});
});

});

describe('transitions', function() {
Expand Down

0 comments on commit b1a43cd

Please sign in to comment.