Skip to content

Commit

Permalink
Merge pull request #22 from victoriafrench/master
Browse files Browse the repository at this point in the history
Core changes and updates to supported browsers
  • Loading branch information
deavial committed Jan 14, 2016
2 parents 4fc9cf4 + 726f2e8 commit 6341c36
Show file tree
Hide file tree
Showing 23 changed files with 11,642 additions and 100 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
### HEAD

* Support for IE 11
* Support for IE 12 preview
* Support for Edge
* Support for tagging undetected or unknown browsers.
* Added support for require, commmonjs, and amd

### 1.1.2 (January 13, 2016)

* Removed unused variable declarations
* Deprecated window.Defunctr in favor of window.defunctr
* Updated .gitignore with support for webstorm
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Defunctr has the ability to exclude testing and tagging by appending any of the

### Classes created by Defunctr

* `.undetected-browser` or `.no-undetected-browser`: Defines if Defunctr is unable to detect the browser.
* `.ie` or `.no-ie`: Defines if the browser is Internet Explorer. This feature is always on.
* `.edge` or `.no-edge`: Defines if the browser is Microsoft Edge. (Edge is Not and IE Browser)
* `.chrome` or `.no-chrome`: Defines if the browser is Chrome.
* `.safari` or `.no-safari`: Defines if the browser is Safari.
* `.webkit` or `.no-webkit`: Defines if the browser is Webkit including Chrome, Safari, and Opera Next.
Expand All @@ -28,25 +30,33 @@ Defunctr has the ability to exclude testing and tagging by appending any of the
* `.ie-version-7` and `.no-ie-version-7`: Defines if the browser is IE 7.
* `.ie-version-8` and `.no-ie-version-8`: Defines if the browser is IE 8.
* `.ie-version-9` and `.no-ie-version-9`: Defines if the browser is IE 9.
* `.ie-version-10` and `.no-ie-version-10`: Defines if the browser is IE 10.
* `.ie-version-11` and `.no-ie-version-11`: Defines if the browser is IE 11.
* `.ie-version-12` and `.no-ie-version-12`: Defines if the browser is IE12.
* `.ie-gt-6` and `.no-ie-gt-6`: Defines if the browser is IE 7+.
* `.ie-gt-7` and `.no-ie-gt-7`: Defines if the browser is IE 8+.
* `.ie-gt-8` and `.no-ie-gt-8`: Defines if the browser is IE 9+.
* `.ie-gt-9` and `.no-ie-gt-9`: Defines if the browser is IE 10+.
* `.ie-gt-10` and `.no-ie-gt-10`: Defines if the browser is IE 11+.
* `.ie-gt-11` and `.no-ie-gt-11`: Defines if the browser is IE 12+.
* `.ie-lt-7` and `.no-ie-lt-7`: Defines if the browser is less than IE 7.
* `.ie-lt-8` and `.no-ie-lt-8`: Defines if the browser is less than IE 8.
* `.ie-lt-9` and `.no-ie-lt-9`: Defines if the browser is less than IE 9.
* `.ie-lt-10` and `.no-ie-lt-10`: Defines if the browser is less than IE 10.
* `.ie-lt-11` and `.no-ie-lt-11`: Defines if the browser is less than IE 11.
* `.ie-lt-12` and `.no-ie-lt-12`: Defines if the browser is less than IE 12.

### Limitations on this release
### Things to know about this release

* Microsoft Edge is not detected
* Internet Explorer can only be detected from version 5.0+
* Microsoft Edge is detected as Microsoft Edge not Internet Explorer.
* Opera can only be detected from version 8.0+
* Opera Next is detected as Opera-Next not Opera.
* Firefox can only be detected from version 0.8+
* Safari can only be detected from version 3.0+
* Chrome can only be detected from version 1.0+
* Experimental support for KHtml
* Only IE gives version information
* Experimental support for KHtml.
* Only Internet Explorer is supported for version information.

### License

Expand Down
Binary file added nuget/Defunctr.1.2.0-pre.nupkg
Binary file not shown.
Binary file added nuget/Defunctr.1.2.0.nupkg
Binary file not shown.
2 changes: 1 addition & 1 deletion nuget/Defunctr.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Defunctr is a module for Modernizr that will detect the current browser using feature detection. It will then append browser informational classes to the head element of the page, giving the designer the ability to override CSS styles without using older browser hacks. Changing the browsers compatability mode will cause the correct classes to be applied and changing a user-agent will have not effect on the class generation.</description>
<summary>Defunctr is a module for Modernizr that will append browser versioning information into the head element of your web pages using feature detection.</summary>
<releaseNotes>Minor fixes to variable declarations.</releaseNotes>
<releaseNotes>Support for Requirejs, Commonjs, and AMD environments is now supported. New detections for IE 10, 11, and 12. Detection support for Edge added. Fix for IE 11 compatabilty mode 5 being reported as multiple versions of IE.</releaseNotes>
<copyright>2013 - @@year @@copyright</copyright>
<tags>Modernizr, Browser Detection, HTML5, Shiv</tags>
<dependencies>
Expand Down
10 changes: 5 additions & 5 deletions nuget/Defunctr.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Defunctr</id>
<version>1.1.2</version>
<version>1.2.0</version>
<title>Defunctr</title>
<authors>Cinecove</authors>
<owners>Cinecove</owners>
<projectUrl>https://github.com/cinecove/defunctr</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Defunctr is a module for Modernizr that will detect the current browser using feature detection. It will then append browser informational classes to the head element of the page, giving the designer the ability to override CSS styles without using older browser hacks. Changing the browsers compatability mode will cause the correct classes to be applied and changing a user-agent will have not effect on the class generation.</description>
<summary>Defunctr is a module for Modernizr that will append browser versioning information into the head element of your web pages using feature detection.</summary>
<releaseNotes>Minor fixes to variable declarations.</releaseNotes>
<releaseNotes>Support for Requirejs, Commonjs, and AMD environments is now supported. New detections for IE 10, 11, and 12. Detection support for Edge added. Fix for IE 11 compatabilty mode 5 being reported as multiple versions of IE.</releaseNotes>
<copyright>2013 - 2016 Cinecove Digital, LLC and other contributors</copyright>
<tags>Modernizr, Browser Detection, HTML5, Shiv</tags>
<dependencies>
<dependency id="Modernizr" version="2.6.2" />
</dependencies>
</metadata>
<files>
<file src="..\release\defunctr-1.1.2.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.2.js" />
<file src="..\release\defunctr-1.1.2.map" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.2.map" />
<file src="..\release\defunctr-1.1.2.min.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.2.min.js" />
<file src="..\release\defunctr-1.2.0.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.2.0.js" />
<file src="..\release\defunctr-1.2.0.map" target="content\Scripts\Vendor\Defunctr\defunctr-1.2.0.map" />
<file src="..\release\defunctr-1.2.0.min.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.2.0.min.js" />
</files>
</package>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "defunctr",
"title": "Defunctr",
"description": "JavaScript library for web browser detection by feature detection.",
"version": "1.1.3-pre",
"version": "1.2.1-pre",
"main": "src/defunctr.js",
"homepage": "https://github.com/cinecove/defunctr",
"author": {
Expand Down
169 changes: 169 additions & 0 deletions release/defunctr-1.2.0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/*!
* Defunctr 1.2.0
* https://github.com/cinecove/defunctr
*
* Copyright 2012 - 2016 Cinecove Digital, LLC and other contributors
* Released under the MIT license
* https://github.com/cinecove/defunctr/blob/master/LICENSE.md
*
* Build Date: 2016-01-14T02:14:22
*/

(function (context, window, factory) {
function requireDocument(document) {
if (!document) {
throw new Error("Defunctr requires a window with a document.");
return false;
} else {
return true;
}
}

var modn = window.Modernizr;

if (typeof define === "function" && define.amd) {
/* amd support */
if (requireDocument(window.document)) {
define("defunctr", ["Modernizr"], function (modernizr) {
return factory(context, window, window.document, modernizr);
});
}
} else if (typeof module === "object" && typeof module.exports === "object") {
/* require and node support */
module.exports = window.document ? factory(context, window, window.document, modn, true) : function(w) {
if (requireDocument(w.document)) {
return factory(context, w, w.document, modn);
}
};
} else if (typeof exports === "object" && exports) {
/* other commonjs types */
exports = window.document ? factory(context, window, window.document, modn, true) : function(w) {
if (requireDocument(w.document)) {
return factory(context, w, w.document, modn);
}
};
} else {
factory(context, window, window.document, modn);
}
}(this, typeof window !== "undefined" ? window : this, function (context, window, document, modernizr, noGlobal) {
if (!modernizr && typeof require !== undefined) {
modernizr = require("Modernizr");
}
if (typeof modernizr === 'undefined') {
throw new Error("Modernizr was not found.");
}

var version = '1.2.0',
r = {},
docElement = document.documentElement,
defunctr = 'defunctr',
prefix = '',
gtoff = docElement.className.indexOf('defunctr-gt-off') > 0,
ltoff = docElement.className.indexOf('defunctr-lt-off') > 0,
voff = docElement.className.indexOf('defunctr-version-off') > 0,
onlyie = docElement.className.indexOf('defunctr-ie-only') > 0,
tests = [];

r.detective = (function (window, document) {
var r = {};
r.isWebkit = (function (document) { return 'WebkitTransform' in document.documentElement.style && typeof window.msWriteProfilerMark === 'undefined'; /* v 1+ */})(document);
r.isOpera = (function (window) { return !!(window.opera && window.opera.version); /* 8.0+ */ })(window);
r.isIE = (function (window) { return 'ActiveXObject' in window; /*return (document.all != undefined) && !self.isOpera;*/ })(window);
r.isFirefox = (function (document) { return 'MozBoxSizing' in document.documentElement.style; /* 0.8+ */ })(document);
r.isSafari = (function (window) { return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; /*v 3+ */ })(window);
r.isKhtml = (function (document) { return 'KhtmlMarquee' in document.documentElement.style })(document);
r.isOperaNext = (function (self, navigator) { return self.isWebkit && /(Opera|OPR)/.test(navigator.userAgent); })(r, navigator);
r.isChrome = (function (self) { return !self.isSafari && !self.isOperaNext && self.isWebkit; })(r);
r.isEdge = (function (self, window, document) { return !('ActiveXObject' in window) && (typeof window.Event === 'function') && (typeof window.msWriteProfilerMark !== 'undefined'); })(r, window, document);
r.isUndetected = (function (self) { return !((self.isWebkit) || (self.isOpera) || (self.isIE) || (self.isFirefox) || (self.isSafari) || (self.isKhtml) || (self.isOperaNext) || (self.isEdge)); })(r);

r.ieAboveVersion5 = (function (self, window) { return self.isIE && (typeof document.compatMode !== 'undefined' && document.compatMode !== 'BackCompat'); })(r, window);
r.ieAboveVersion6 = (function (self, window) { return self.isIE && self.ieAboveVersion5 && (typeof window.XMLHttpRequest !== 'undefined'); })(r, window);
r.ieAboveVersion7 = (function (self, document) { return r.isIE && (typeof document.querySelector !== 'undefined'); })(r, document);
r.ieAboveVersion8 = (function (self, window) { return self.isIE && (typeof document.addEventListener !== 'undefined'); })(r, window);
r.ieAboveVersion9 = (function (self, window) { return self.isIE && (typeof window.atob !== 'undefined'); })(r, window);
r.ieAboveVersion10 = (function (self, window) { return self.isIE && (typeof window.atob !== 'undefined') && (typeof window.ActiveXObject === 'undefined'); })(r, window);
r.ieAboveVersion11 = (function (self, window) { return self.isIE && (typeof window.Event === 'function'); })(r, window);

r.ieBelowVersion6 = (function (self, document) { return self.isIE && (typeof document.compatMode === 'undefined' || document.compatMode === 'BackCompat'); })(r, document);
r.ieBelowVersion7 = (function (self, window) { return self.isIE && (typeof window.XMLHttpRequest === 'undefined' || document.compatMode === 'BackCompat'); })(r, window);
r.ieBelowVersion8 = (function (self, document) { return self.isIE && (typeof document.querySelector === 'undefined'); })(r, document);
r.ieBelowVersion9 = (function (self, document) { return self.isIE && (typeof document.addEventListener === 'undefined'); })(r, document);
r.ieBelowVersion10 = (function (self, window) { return self.isIE && (typeof window.atob === 'undefined'); })(r, window);
r.ieBelowVersion11 = (function (self, window) { return self.isIE && (window.atob !== undefined) && (typeof window.ActiveXObject !== 'undefined'); })(r, window);
r.ieBelowVersion12 = (function (self, window) { return self.isIE && (typeof window.Event !== 'function'); })(r, window);

r.ieIsVersion6 = (function (self) { return self.ieAboveVersion5 && self.ieBelowVersion7; })(r);
r.ieIsVersion7 = (function (self) { return self.ieAboveVersion6 && self.ieBelowVersion8; })(r);
r.ieIsVersion8 = (function (self) { return self.ieAboveVersion7 && self.ieBelowVersion9; })(r);
r.ieIsVersion9 = (function (self) { return self.ieAboveVersion8 && self.ieBelowVersion10; })(r);
r.ieIsVersion10 = (function (self) { return self.ieAboveVersion9 && self.ieBelowVersion11; })(r);
r.ieIsVersion11 = (function (self) { return self.ieAboveVersion10 && self.ieBelowVersion12; })(r);


r.chromeIsAbove15 = (function (window) { return !!(window.chrome && window.chrome.webstore && window.chrome.webstore.install); })(window);


r.standardsCompliant = (function (self) { return r.ieAboveVersion9 || !r.isIE; })(r);
return r;
})(window, document);

tests[prefix + 'ie'] = function () { return r.detective.isIE; };
if (!onlyie) {
tests[prefix + 'chrome'] = function () { return r.detective.isChrome; };
tests[prefix + 'safari'] = function () { return r.detective.isSafari; };
tests[prefix + 'opera'] = function () { return r.detective.isOpera; };
tests[prefix + 'opera-next'] = function() { return r.detective.isOperaNext; };
tests[prefix + 'firefox'] = function () { return r.detective.isFirefox; };
tests[prefix + 'khtml'] = function () { return r.detective.isKhtml; };
tests[prefix + 'webkit'] = function () { return r.detective.isWebkit; };
tests[prefix + 'edge'] = function () { return r.detective.isEdge; };
tests[prefix + 'undetected-broweser'] = function () { return r.detective.isUndetected; };
}

if (!ltoff) {
tests[prefix + 'ie-lt-6'] = function () { return r.detective.ieBelowVersion6; };
tests[prefix + 'ie-lt-7'] = function () { return r.detective.ieBelowVersion7; };
tests[prefix + 'ie-lt-8'] = function () { return r.detective.ieBelowVersion8; };
tests[prefix + 'ie-lt-9'] = function () { return r.detective.ieBelowVersion9; };
tests[prefix + 'ie-lt-10'] = function () { return r.detective.ieBelowVersion10; };
tests[prefix + 'ie-lt-11'] = function () { return r.detective.ieBelowVersion11; };
tests[prefix + 'ie-lt-12'] = function () { return r.detective.ieBelowVersion12; };
}

if (!gtoff) {
tests[prefix + 'ie-gt-6'] = function () { return r.detective.ieAboveVersion6; };
tests[prefix + 'ie-gt-7'] = function () { return r.detective.ieAboveVersion7; };
tests[prefix + 'ie-gt-8'] = function () { return r.detective.ieAboveVersion8; };
tests[prefix + 'ie-gt-9'] = function () { return r.detective.ieAboveVersion9; };
tests[prefix + 'ie-gt-10'] = function () { return r.detective.ieAboveVersion10; };
tests[prefix + 'ie-gt-11'] = function () { return r.detective.ieAboveVersion11; };
}

if (!voff) {
tests[prefix + 'ie-version-7'] = function () { return r.detective.ieIsVersion7; };
tests[prefix + 'ie-version-8'] = function () { return r.detective.ieIsVersion8; };
tests[prefix + 'ie-version-9'] = function () { return r.detective.ieIsVersion9; };
tests[prefix + 'ie-version-10'] = function () { return r.detective.ieIsVersion10; };
tests[prefix + 'ie-version-11'] = function () { return r.detective.ieIsVersion11; };
}

r.version = version;

for (var key in tests) {
modernizr.addTest(key, tests[key]);
}

docElement.className = docElement.className.replace(/\bdefunctr-gt-off\b/, '');
docElement.className = docElement.className.replace(/\bdefunctr-lt-off\b/, '');
docElement.className = docElement.className.replace(/\bdefunctr-version-off\b/, '');
docElement.className = docElement.className.replace(/\bdefunctr-ie-only\b/, '');

if (!noGlobal) {
window.defunctr = window.Defuntr = r;
}

return r;
}));


Loading

0 comments on commit 6341c36

Please sign in to comment.