Skip to content

Commit be08c07

Browse files
matskomhevery
authored andcommitted
fix($sniffer): $sniffer to support non-vendor prefixes
1 parent d90a796 commit be08c07

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/ng/sniffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function $SnifferProvider() {
3333
break;
3434
}
3535
}
36-
transitions = !!(vendorPrefix + 'Transition' in bodyStyle);
36+
transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
3737
}
3838

3939

test/ng/snifferSpec.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,54 @@ describe('$sniffer', function() {
132132
});
133133
});
134134

135+
it('should be false when there is no transition style', function() {
136+
module(function($provide) {
137+
var doc = {
138+
body : {
139+
style : {}
140+
}
141+
};
142+
$provide.value('$document', jqLite(doc));
143+
});
144+
inject(function($sniffer) {
145+
expect($sniffer.supportsTransitions).toBe(false);
146+
});
147+
});
148+
149+
it('should be true with vendor-specific transitions', function() {
150+
module(function($provide) {
151+
var transitionStyle = '1s linear all';
152+
var doc = {
153+
body : {
154+
style : {
155+
WebkitTransition : transitionStyle,
156+
MozTransition : transitionStyle,
157+
OTransition : transitionStyle
158+
}
159+
}
160+
};
161+
$provide.value('$document', jqLite(doc));
162+
});
163+
inject(function($sniffer) {
164+
expect($sniffer.supportsTransitions).toBe(true);
165+
});
166+
});
167+
168+
it('should be true with w3c-style transitions', function() {
169+
module(function($provide) {
170+
var doc = {
171+
body : {
172+
style : {
173+
transition : '1s linear all'
174+
}
175+
}
176+
};
177+
$provide.value('$document', jqLite(doc));
178+
});
179+
inject(function($sniffer) {
180+
expect($sniffer.supportsTransitions).toBe(true);
181+
});
182+
});
183+
135184
});
136185
});

0 commit comments

Comments
 (0)