Skip to content
Open
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
30 changes: 30 additions & 0 deletions detect/dialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(function(has, addtest){

var toString = {}.toString,
FUNCTION_CLASS = "[object Function]";

if(!has("dom")){ return; }

var dialog = document.createElement("dialog");

addtest("dialog", function(){
return toString.call(dialog.show) == FUNCTION_CLASS;
});

addtest("dialog-open", function(){
return ("open" in dialog);
});

addtest("dialog-show", function(){
return toString.call(dialog.show) == FUNCTION_CLASS;
});

addtest("dialog-show-modal", function(){
return toString.call(dialog.showModal) == FUNCTION_CLASS;
});

addtest("dialog-close", function(){
return toString.call(dialog.close) == FUNCTION_CLASS;
});

})(has, has.add);
23 changes: 23 additions & 0 deletions detect/notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(function(has, addtest){

var toString = {}.toString,
FUNCTION_CLASS = "[object Function]";

if(!has("dom")){ return; }

addtest("notification", function(){
return toString.call(window.Notification) === FUNCTION_CLASS ||
toString.call(window.webkitNotifications) === FUNCTION_CLASS;
});

has.add("notification-checkpermission", function () {
return toString.call(window.Notification.permission) === FUNCTION_CLASS ||
toString.call(window.webkitNotifications.checkPermission) === FUNCTION_CLASS;
});

has.add("notification-requestpermission", function () {
return toString.call(window.Notification.requestPermission) === FUNCTION_CLASS ||
toString.call(window.webkitNotifications.requestPermission) === FUNCTION_CLASS;
});

})(has, has.add);
20 changes: 20 additions & 0 deletions detect/url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function (has, addtest) {

var toString = {}.toString,
FUNCTION_CLASS = "[object Function]";

// See if URL is available
addtest("native-url", function (g) {
return has.isHostType(g, "URL");
});

// Test for URL's methods
addtest("url-create-object-url", function () {
return toString.call(URL.createObjectURL) == FUNCTION_CLASS;
});

addtest("url-revoke-object-url", function () {
return toString.call(URL.revokeObjectURL) == FUNCTION_CLASS;
});

})(has, has.add);