summaryrefslogtreecommitdiff
path: root/plugins/Minify/extlib/minify/min_unit_tests/_test_files/js/before.js
blob: cccdb9706e6bb5b7299e7ed89a1c9c32d8b68397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*! is.js

 (c) 2001 Douglas Crockford
 2001 June 3
*/

// is

// The -is- object is used to identify the browser.  Every browser edition
// identifies itself, but there is no standard way of doing it, and some of
// the identification is deceptive. This is because the authors of web
// browsers are liars. For example, Microsoft's IE browsers claim to be
// Mozilla 4. Netscape 6 claims to be version 5.

var is = {
    ie:      navigator.appName == 'Microsoft Internet Explorer',
    java:    navigator.javaEnabled(),
    ns:      navigator.appName == 'Netscape',
    ua:      navigator.userAgent.toLowerCase(),
    version: parseFloat(navigator.appVersion.substr(21)) ||
             parseFloat(navigator.appVersion),
    win:     navigator.platform == 'Win32'
}
/*!*
 * preserve this comment, too
 */
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
    is.ie = is.ns = false;
    is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
    is.ie = is.ns = false;
    is.gecko = true;
}

/*@cc_on
   /*@if (@_win32)
    if (is.ie && is.win)
        document.write("PASS: IE/win honored conditional comment.<br>");
   @else @*/
    if (is.ie && is.win)
        document.write("FAIL: IE/win did not honor multi-line conditional comment.<br>");
    else 
        document.write("PASS: Non-IE/win browser ignores multi-line conditional comment.<br>");
   /*@end
@*/

var recognizesCondComm = true;
//@cc_on/*
recognizesCondComm = false;
//@cc_on*/

if ((is.ie && is.win) == recognizesCondComm)
    document.write("PASS: IE/win honored single-line conditional comment.<br>");
else 
    document.write("FAIL: Non-IE/win browser did not ignore single-line conditional comment.<br>");