mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-28 21:05:43 +08:00
fix($sniffer): $sniffer to support non-vendor prefixes
This commit is contained in:
committed by
Misko Hevery
parent
d90a79632d
commit
be08c075bd
@@ -33,7 +33,7 @@ function $SnifferProvider() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transitions = !!(vendorPrefix + 'Transition' in bodyStyle);
|
transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -132,5 +132,54 @@ describe('$sniffer', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be false when there is no transition style', function() {
|
||||||
|
module(function($provide) {
|
||||||
|
var doc = {
|
||||||
|
body : {
|
||||||
|
style : {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$provide.value('$document', jqLite(doc));
|
||||||
|
});
|
||||||
|
inject(function($sniffer) {
|
||||||
|
expect($sniffer.supportsTransitions).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be true with vendor-specific transitions', function() {
|
||||||
|
module(function($provide) {
|
||||||
|
var transitionStyle = '1s linear all';
|
||||||
|
var doc = {
|
||||||
|
body : {
|
||||||
|
style : {
|
||||||
|
WebkitTransition : transitionStyle,
|
||||||
|
MozTransition : transitionStyle,
|
||||||
|
OTransition : transitionStyle
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$provide.value('$document', jqLite(doc));
|
||||||
|
});
|
||||||
|
inject(function($sniffer) {
|
||||||
|
expect($sniffer.supportsTransitions).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be true with w3c-style transitions', function() {
|
||||||
|
module(function($provide) {
|
||||||
|
var doc = {
|
||||||
|
body : {
|
||||||
|
style : {
|
||||||
|
transition : '1s linear all'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$provide.value('$document', jqLite(doc));
|
||||||
|
});
|
||||||
|
inject(function($sniffer) {
|
||||||
|
expect($sniffer.supportsTransitions).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user