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

fix($sniffer) & fix(ng-input): add check for older webkit browsers and extra milliseconds for iOS7 #6890

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ng/directive/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
timeout = $browser.defer(function() {
listener();
timeout = null;
});
},5); // Adding 5 milliseconds for iOS7
}
};

Expand Down
6 changes: 5 additions & 1 deletion src/ng/sniffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function $SnifferProvider() {
android =
int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
webkit =
int((/[a-z]*?webkit\/(\d+)/i.exec(lowercase(($window.navigator || {}).userAgent))
|| [])[1]),
document = $document[0] || {},
documentMode = document.documentMode,
vendorPrefix,
Expand Down Expand Up @@ -63,7 +66,8 @@ function $SnifferProvider() {
// so let's not use the history API also
// We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
// jshint -W018
history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
history : !!($window.history && $window.history.pushState && !(android < 4) && !boxee
&& !(webkit < 534)),
// jshint +W018
hashchange: 'onhashchange' in $window &&
// IE8 compatible mode lies
Expand Down
23 changes: 23 additions & 0 deletions test/ng/snifferSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,29 @@ describe('$sniffer', function() {
expect($sniffer.history).toBe(false);
});
});

it('should be false on Webkit versions older then 534.x.x', function() {
module(function($provide) {
var doc = {
body : {
style : {}
}
};
var win = {
history : {
pushState : noop
},
navigator : {
userAgent : 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; nl-nl) AppleWebkit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5'
}
};
$provide.value('$document', jqLite(doc));
$provide.value('$window', win);
});
inject(function($sniffer) {
expect($sniffer.history).toBe(false);
});
});
});

it('should provide the android version', function() {
Expand Down