[
  {
    "path": ".gitignore",
    "content": "node_modules\ndist\n"
  },
  {
    "path": ".jshintrc",
    "content": "{\n\t\"boss\": true,\n\t\"curly\": true,\n\t\"eqeqeq\": true,\n\t\"eqnull\": true,\n\t\"expr\": true,\n\t\"immed\": true,\n\t\"noarg\": true,\n\t\"smarttabs\": true,\n\t\"trailing\": true,\n\t\"undef\": true,\n\t\"unused\": true,\n\t\"node\": true,\n\t\"loopfunc\": true,\n\n\t\"browser\": true,\n\t\"qunit\": true,\n\n\t\"globals\": {\n\t\t\"loadCSS\": false,\n\t\t\"onloadCSS\": false\n\t}\n}\n"
  },
  {
    "path": ".npmignore",
    "content": "node_modules\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nnode_js:\n  - 12.6.0\nbefore_script:\n  - npm install\nscript: grunt -v\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to loadCSS\n\nContributions are appreciated. In order for us to consider including a contribution, it does have to meet a few criteria:\n\n* Code is specific to one issue (eg. feature, extension or bug)\n* Code is formatted according to JavaScript Style Guide.\n* Code has full test coverage and all tests pass.\n\n## Code to an Issue\n\nUse a separate git branch for each contribution. Give the branch a meaningful name.\nWhen you are contributing a new extensions use the name of this extension, like `dom-toggleclass`.\nOtherwise give it a descriptive name like `doc-generator` or reference a specific issue like `issues-12`.\nWhen the issue is resolved create a pull request to allow us to review and accept your contribution.\n\n## JavaScript Style Guide\n\nCode should be formatted according to the [jQuery JavaScript Style Guide](http://contribute.jquery.org/style-guide/).\n"
  },
  {
    "path": "Gruntfile.js",
    "content": "/* global module:false */\nmodule.exports = function(grunt) {\n\n\trequire( 'matchdep' ).filterDev( ['grunt-*', '!grunt-cli'] ).forEach( grunt.loadNpmTasks );\n\n\t// Project configuration.\n\tgrunt.initConfig({\n\t\tjshint: {\n\t\t\tall: {\n\t\t\t\toptions: {\n\t\t\t\t\tjshintrc: \".jshintrc\"\n\t\t\t\t},\n\n\t\t\t\tsrc: [\n\t\t\t\t\t'*.js',\n\t\t\t\t\t'test/**/*.js',\n\t\t\t\t\t'src/**/*.js',\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\tconcat: {\n\t\t\tdist: {\n\t\t\t\tfiles: {\n\t\t\t\t\t'dist/loadCSS.js': ['src/loadCSS.js'],\n\t\t\t\t\t'dist/onloadCSS.js': ['src/onloadCSS.js']\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tuglify: {\n\t\t\toptions: {\n\t\t\t\t\tpreserveComments: /^\\!/\n\t\t\t},\n\t\t\tdist: {\n\t\t\t\tfiles: {\n\t\t\t\t\t'dist/loadCSS.min.js': ['src/loadCSS.js'],\n\t\t\t\t\t'dist/onloadCSS.min.js': ['src/onloadCSS.js']\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tqunit: {\n\t\t\tfiles: ['test/qunit/**/*.html']\n\t\t}\n\t});\n\n\tgrunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);\n\tgrunt.registerTask('stage', ['default']);\n};\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) @scottjehl, 2016 Filament Group\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": ":warning: This project is archived and the repository is no longer maintained. \t\t\t\t\n\n# loadCSS\n\nA pattern for loading CSS asynchronously\n[c]2020 @scottjehl, @zachleat [Filament Group, Inc.](https://www.filamentgroup.com/)\nLicensed MIT\n\n## Why an ansychronous CSS loader?\n\nReferencing CSS stylesheets with `link[rel=stylesheet]` or `@import` causes browsers to delay page rendering while a stylesheet loads. When loading stylesheets that are not critical to the initial rendering of a page, this blocking behavior is undesirable. The pattern below allows us to fetch and apply CSS asynchronously. If necessary, this repo also offers a separate (and optional) JavaScript function for loading stylesheets dynamically.\n\n\n## How to use\n\nAs a primary pattern, we recommend loading asynchronous CSS like this from HTML:\n\n`<link rel=\"stylesheet\" href=\"/path/to/my.css\" media=\"print\" onload=\"this.media='all'; this.onload=null;\">`\n\nThis article explains why this approach is best: https://www.filamentgroup.com/lab/load-css-simpler/\n\nThat is probably all you need! But if you want to load a CSS file from a JavaScript function, read on...\n\n## Dynamic CSS loading with the loadCSS function\n\nThe [loadCSS.js](https://github.com/filamentgroup/loadCSS/blob/master/src/loadCSS.js) file exposes a global `loadCSS` function that you can call to load CSS files programmatically, if needed. This is handy for cases where you need to dynamically load CSS from script.\n\n``` javascript\nloadCSS( \"path/to/mystylesheet.css\" );\n```\n\nThe code above will insert a new CSS stylesheet `link` *after* the last stylesheet or script that it finds in the page, and the function will return a reference to that `link` element, should you want to reference it later in your script. Multiple calls to loadCSS will reference CSS files in the order they are called, but keep in mind that they may finish loading in a different order than they were called.\n\n## Function API\n\nThe loadCSS function has 3 optional arguments.\n\n- `before`: By default, loadCSS attempts to inject the stylesheet link *after* all CSS and JS in the page. However, if you desire a more specific location in your document, such as before a particular stylesheet link, you can use the `before` argument to specify a particular element to use as an insertion point. Your stylesheet will be inserted *before* the element you specify. For example, here's how that can be done by simply applying an `id` attribute to your `script`.\n```html\n<head>\n...\n<script id=\"loadcss\">\n  // load a CSS file just before the script element containing this code\n  loadCSS( \"path/to/mystylesheet.css\", document.getElementById(\"loadcss\") );\n</script>\n...\n</head>\n```\n\n- `media`: You can optionally pass a string to the media argument to set the `media=\"\"` of the stylesheet - the default value is `all`.\n- `attributes`: You can also optionally pass an Object of attribute name/attribute value pairs to set on the stylesheet. This can be used to specify Subresource Integrity attributes:\n```javascript\nloadCSS( \n  \"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\",\n  null,\n  null,\n  {\n    \"crossorigin\": \"anonymous\",\n    \"integrity\": \"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\"\n  }\n);\n```\n\n#### Using with `onload`\n\nOnload event support for `link` elements is spotty in some browsers, so if you need to add an onload callback, include [`onloadCSS` function](https://github.com/filamentgroup/loadCSS/blob/master/src/onloadCSS.js) on your page and use the `onloadCSS` function:\n\n```javascript\nvar stylesheet = loadCSS( \"path/to/mystylesheet.css\" );\nonloadCSS( stylesheet, function() {\n\tconsole.log( \"Stylesheet has loaded.\" );\n});\n```\n\n### Browser Support\n\nThe loadCSS patterns attempt to load a css file asynchronously in any JavaScript-capable browser. However, some older browsers such as Internet Explorer 8 and older will block rendering while the stylesheet is loading. This merely means that the stylesheet will load as if you referenced it with an ordinary link element.\n\n\n# Changes in version 3.0 (no more preload polyfill)\n\nAs of version 3.0, we no longer support or include a polyfill for a `rel=preload` markup pattern. This is because we have since determined that the markup pattern described at the top of this readme is simpler and better for performance, while the former preload pattern could sometimes conflict with resource priorities in ways that aren't helpful for loading CSS in a non-blocking way.\n\nTo update, you can change your preload markup to [this HTML pattern](https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use) and delete the JS from your build.\n\nSince this change breaks the API from prior versions, we made it a major version bump. That way, if you are still needing to use the now-deprecated preload pattern, you can keep your code pointing at prior versions that are still on NPM, such as version 2.1.0 https://github.com/filamentgroup/loadCSS/releases/tag/v2.1.0\n\n\n#### Contributions and bug fixes\n\nBoth are very much appreciated - especially bug fixes. As for contributions, the goals of this project are to keep things very simple and utilitarian, so if we don't accept a feature addition, it's not necessarily because it's a bad idea. It just may not meet the goals of the project. Thanks!\n"
  },
  {
    "path": "bower.json",
    "content": "{\n\t\"name\": \"loadcss\",\n\t\"main\": [\n\t\t\"src/loadCSS.js\"\n\t],\n\t\"ignore\": [\n\t\t\"**/.*\"\n\t]\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"fg-loadcss\",\n  \"version\": \"3.1.0\",\n  \"description\": \"A function for loading CSS asynchronously\",\n  \"main\": \"src/loadCSS.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/filamentgroup/loadCSS.git\"\n  },\n  \"author\": \"Filament Group <hello@filamentgroup.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/filamentgroup/loadCSS/issues\"\n  },\n  \"homepage\": \"https://github.com/filamentgroup/loadCSS\",\n  \"engines\": {\n    \"node\": \">= 11.9.0\"\n  },\n  \"devDependencies\": {\n    \"grunt\": \"^1.1.0\",\n    \"grunt-cli\": \"~1.3.2\",\n    \"grunt-contrib-concat\": \"^1.0.1\",\n    \"grunt-contrib-jshint\": \"~2.0.0\",\n    \"grunt-contrib-qunit\": \"^3.1.0\",\n    \"grunt-contrib-uglify\": \"^4.0.0\",\n    \"husky\": \"^1.3.1\",\n    \"matchdep\": \"^2.0.0\"\n  },\n  \"scripts\": {\n    \"start\": \"npx ./server.js\",\n    \"test\": \"npx grunt\"\n  },\n  \"husky\": {\n    \"hooks\": {\n      \"pre-commit\": \"npm test\"\n    }\n  }\n}\n"
  },
  {
    "path": "server.js",
    "content": "/* jshint esversion: 6 */\n\nconst fs = require('fs');\nconst http = require('http');\nconst path = require('path');\nconst port = 3000;\n\nconst server = http.createServer(requestHandler);\n\nserver.listen(port, (err) => {\n\tif (err) {\n\t\treturn console.error('could not run server', err);\n\t}\n\n\tconsole.log(`server is listening on ${port}`);\n});\n\n\nconst contentTypes = {\n\t'.css': 'text/css',\n\t'.html': 'text/html',\n\t'.js': 'application/javascript',\n};\n\nfunction requestHandler (request, response) {\n\tconsole.log(JSON.stringify(request.url));\n\ttry {\n\t\tresponse.setHeader('charset', 'UTF-8');\n\t\tresponse.setHeader('Cache-Control', 'max-age=500');\n\n\t\tif (!path.extname(request.url)) {\n\t\t\trequest.url += '/index.html';\n\t\t}\n\n\t\tresponse.setHeader('Content-type', contentTypes[path.extname(request.url)]);\n\n\t\tconst content = fs.readFileSync(\n\t\t\tpath.join('.', request.url)\n\t\t).toString().replace(/<!--#include virtual=\"([^\"]+)\" -->/g, (match, filepath) => fs.readFileSync(\n\t\t\tpath.resolve(path.dirname(path.join('.', request.url)), filepath)\n\t\t));\n\n\t\tif (request.url.endsWith('slow.css')) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tresponse.end( content );\n\t\t\t}, 5000);\n\t\t} else {\n\t\t\tresponse.end( content );\n\t\t}\n\t} catch (error) {\n\t\tconst errorMessage = (error.message && (error.message + '\\n' + error.stack)) || error;\n\n\t\tif (errorMessage.includes('ENOENT')) {\n\t\t\tresponse.statusCode = 404;\n\t\t} else {\n\t\t\tresponse.statusCode = 500;\n\t\t}\n\n\t\tresponse.end('<pre>' + errorMessage);\n\t}\n}\n"
  },
  {
    "path": "src/loadCSS.js",
    "content": "/*! loadCSS. [c]2020 Filament Group, Inc. MIT License */\n(function(w){\n\t\"use strict\";\n\t/* exported loadCSS */\n\tvar loadCSS = function( href, before, media, attributes ){\n\t\t// Arguments explained:\n\t\t// `href` [REQUIRED] is the URL for your CSS file.\n\t\t// `before` [OPTIONAL] is the element the script should use as a reference for injecting our stylesheet <link> before\n\t\t// By default, loadCSS attempts to inject the link after the last stylesheet or script in the DOM. However, you might desire a more specific location in your document.\n\t\t// `media` [OPTIONAL] is the media type or query of the stylesheet. By default it will be 'all'\n\t\t// `attributes` [OPTIONAL] is the Object of attribute name/attribute value pairs to set on the stylesheet's DOM Element.\n\t\tvar doc = w.document;\n\t\tvar ss = doc.createElement( \"link\" );\n\t\tvar ref;\n\t\tif( before ){\n\t\t\tref = before;\n\t\t}\n\t\telse {\n\t\t\tvar refs = ( doc.body || doc.getElementsByTagName( \"head\" )[ 0 ] ).childNodes;\n\t\t\tref = refs[ refs.length - 1];\n\t\t}\n\n\t\tvar sheets = doc.styleSheets;\n\t\t// Set any of the provided attributes to the stylesheet DOM Element.\n\t\tif( attributes ){\n\t\t\tfor( var attributeName in attributes ){\n\t\t\t\tif( attributes.hasOwnProperty( attributeName ) ){\n\t\t\t\t\tss.setAttribute( attributeName, attributes[attributeName] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tss.rel = \"stylesheet\";\n\t\tss.href = href;\n\t\t// temporarily set media to something inapplicable to ensure it'll fetch without blocking render\n\t\tss.media = \"only x\";\n\n\t\t// wait until body is defined before injecting link. This ensures a non-blocking load in IE11.\n\t\tfunction ready( cb ){\n\t\t\tif( doc.body ){\n\t\t\t\treturn cb();\n\t\t\t}\n\t\t\tsetTimeout(function(){\n\t\t\t\tready( cb );\n\t\t\t});\n\t\t}\n\t\t// Inject link\n\t\t\t// Note: the ternary preserves the existing behavior of \"before\" argument, but we could choose to change the argument to \"after\" in a later release and standardize on ref.nextSibling for all refs\n\t\t\t// Note: `insertBefore` is used instead of `appendChild`, for safety re: http://www.paulirish.com/2011/surefire-dom-element-insertion/\n\t\tready( function(){\n\t\t\tref.parentNode.insertBefore( ss, ( before ? ref : ref.nextSibling ) );\n\t\t});\n\t\t// A method (exposed on return object for external use) that mimics onload by polling document.styleSheets until it includes the new sheet.\n\t\tvar onloadcssdefined = function( cb ){\n\t\t\tvar resolvedHref = ss.href;\n\t\t\tvar i = sheets.length;\n\t\t\twhile( i-- ){\n\t\t\t\tif( sheets[ i ].href === resolvedHref ){\n\t\t\t\t\treturn cb();\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetTimeout(function() {\n\t\t\t\tonloadcssdefined( cb );\n\t\t\t});\n\t\t};\n\n\t\tfunction loadCB(){\n\t\t\tif( ss.addEventListener ){\n\t\t\t\tss.removeEventListener( \"load\", loadCB );\n\t\t\t}\n\t\t\tss.media = media || \"all\";\n\t\t}\n\n\t\t// once loaded, set link's media back to `all` so that the stylesheet applies once it loads\n\t\tif( ss.addEventListener ){\n\t\t\tss.addEventListener( \"load\", loadCB);\n\t\t}\n\t\tss.onloadcssdefined = onloadcssdefined;\n\t\tonloadcssdefined( loadCB );\n\t\treturn ss;\n\t};\n\t// commonjs\n\tif( typeof exports !== \"undefined\" ){\n\t\texports.loadCSS = loadCSS;\n\t}\n\telse {\n\t\tw.loadCSS = loadCSS;\n\t}\n}( typeof global !== \"undefined\" ? global : this ));\n"
  },
  {
    "path": "src/onloadCSS.js",
    "content": "/*! onloadCSS. (onload callback for loadCSS) [c]2017 Filament Group, Inc. MIT License */\n/* global navigator */\n/* exported onloadCSS */\nfunction onloadCSS( ss, callback ) {\n\tvar called;\n\tfunction newcb(){\n\t\t\tif( !called && callback ){\n\t\t\t\tcalled = true;\n\t\t\t\tcallback.call( ss );\n\t\t\t}\n\t}\n\tif( ss.addEventListener ){\n\t\tss.addEventListener( \"load\", newcb );\n\t}\n\tif( ss.attachEvent ){\n\t\tss.attachEvent( \"onload\", newcb );\n\t}\n\n\t// This code is for browsers that don’t support onload\n\t// No support for onload (it'll bind but never fire):\n\t//\t* Android 4.3 (Samsung Galaxy S4, Browserstack)\n\t//\t* Android 4.2 Browser (Samsung Galaxy SIII Mini GT-I8200L)\n\t//\t* Android 2.3 (Pantech Burst P9070)\n\n\t// Weak inference targets Android < 4.4\n \tif( \"isApplicationInstalled\" in navigator && \"onloadcssdefined\" in ss ) {\n\t\tss.onloadcssdefined( newcb );\n\t}\n}\n"
  },
  {
    "path": "test/.htaccess",
    "content": "# make sure our ssi includes work\nSSILegacyExprParser on\n\n# enabled SSI for .html files\nAddType text/html .html\nAddHandler server-parsed .html\nOptions Indexes Includes FollowSymlinks\n\n\n# ----------------------------------------------------------------------\n# | Expires headers                                                    |\n# ----------------------------------------------------------------------\n\n# Serve resources with far-future expires headers.\n#\n# (!) If you don't control versioning with filename-based\n# cache busting, you should consider lowering the cache times\n# to something like one week.\n#\n# https://httpd.apache.org/docs/current/mod/mod_expires.html\n\n<IfModule mod_expires.c>\n\n    ExpiresActive on\n    ExpiresDefault \"access plus 1 minutes\"\n\n</IfModule>\n"
  },
  {
    "path": "test/attributes.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<meta name=\"viewport\" content=\"width=device-width\">\n\t\t<title>Tests for \"link\" attributes</title>\n\t\t<script type=\"text/javascript\">\n\t\t\t<!--#include virtual=\"../src/loadCSS.js\" -->\n\t\t\t<!--#include virtual=\"../src/onloadCSS.js\" -->\n\t\t\t(function () {\n\t\t\t\tfunction loadBootstrapCSS( attributes ) {\n\t\t\t\t\tconst cacheBuster = Math.random();\n\t\t\t\t\treturn loadCSS( \n\t\t\t\t\t\t\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\" + '?cb=' + cacheBuster,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tattributes\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Load Bootstrap with \"incorrect\" integrity attribute:\n\t\t\t\tvar incorrectCSSIntegrity = loadBootstrapCSS( {\n\t\t\t\t\t\"crossorigin\": \"anonymous\",\n\t\t\t\t\t\"integrity\": \"sha384-incorrect-digest\"\n\t\t\t\t});\n\t\t\t\tincorrectCSSIntegrity.onerror = function( error ) {\n\t\t\t\t\tdocument.getElementById('incorrect-integrity').innerHTML = '<span class=\"text-success\">Success!</span> Resource not loaded.';\n\t\t\t\t}\n\t\t\t\tonloadCSS( incorrectCSSIntegrity, function() {\n\t\t\t\t\tdocument.getElementById('incorrect-integrity').innerHTML = '<span class=\"text-warning\">Warning:</span> Resource should not have loaded.';\n\t\t\t\t} );\n\n\t\t\t\t// Load Bootstrap with \"incorrect\" crossorigin attribute:\n\t\t\t\tvar incorrectCSSCrossOrigin = loadBootstrapCSS( {\n\t\t\t\t\t\"crossorigin\": \"use-credentials\",\n\t\t\t\t\t\"integrity\": \"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\"\n\t\t\t\t});\n\t\t\t\tincorrectCSSCrossOrigin.onerror = function( error ) {\n\t\t\t\t\tdocument.getElementById('incorrect-crossorigin').innerHTML = '<span class=\"text-success\">Success!</span> Resource not loaded.';\n\t\t\t\t}\n\t\t\t\tonloadCSS( incorrectCSSCrossOrigin, function() {\n\t\t\t\t\tdocument.getElementById('incorrect-crossorigin').innerHTML = '<span class=\"text-warning\">Warning:</span> Resource should not have loaded.';\n\t\t\t\t} );\n\n\t\t\t\t// Load Bootstrap with \"correct\" integrity attribute:\n\t\t\t\tvar correctCSSIntegrity = loadBootstrapCSS( {\n\t\t\t\t\t\"crossorigin\": \"anonymous\",\n\t\t\t\t\t\"integrity\": \"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\"\n\t\t\t\t} );\n\t\t\t\tcorrectCSSIntegrity.onerror = function( error ) {\n\t\t\t\t\tdocument.getElementById('correct-integrity').innerHTML = '<span class=\"text-warning\">Warning:</span> Resource should have loaded.';\n\t\t\t\t}\n\t\t\t\tonloadCSS( correctCSSIntegrity, function() {\n\t\t\t\t\tdocument.getElementById('correct-integrity').innerHTML = '<span class=\"text-success\">Success!</span> Resource loaded.';\n\t\t\t\t} );\n\t\t\t})();\n\t\t</script>\n\t</head>\n\t<body style=\"margin: 50px\">\n\t\t<h1>Tests for <code>link</code> attributes</h1>\n\t\t<p>Support for <a href=\"https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity\">Subresource Integrity</a> requires providing <code>integrity</code> and <code>crossorigin</code> attributes to the <code>link</code> Element.</p>\n\t\t<p>By supplying an Object of attribue name/attribute value pairs as the fourth argument to <code>loadCSS()</code>, attributes can be set on the stylesheet's DOM Element.</p>\n\t\t<pre><code>\nloadCSS( \n\t\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\",\n\tnull,\n\tnull,\n\t{\n\t\t\"title\": \"Bootstrap Styles\",\n\t\t\"type\": \"text/css\",\n\t\t\"crossorigin\": \"anonymous\",\n\t\t\"integrity\": \"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\"\n\t\t// etc.\n\t}\n);\n\t\t</code></pre>\n\t\t<p>The following tests aim to validate the behavior of the API using correct and incorrect configurations:</p>\n\n\t\t<table class=\"table\">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Test</th>\n\t\t\t\t\t<th>Result</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>Correct <code>integrity</code> digest</td>\n\t\t\t\t\t<td id=\"correct-integrity\">Running test...</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>Incorrect <code>integrity</code> digest</td>\n\t\t\t\t\t<td id=\"incorrect-integrity\">Running test...</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>Incorrect <code>crossorigin</code> attribute</td>\n\t\t\t\t\t<td id=\"incorrect-crossorigin\">Running test...</td>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t</table>\n\t</body>\n</html>\n"
  },
  {
    "path": "test/body.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Link in body Test</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n  <h1>Text before the link</h1>\n  <link rel=\"stylesheet\" href=\"slow.css\">\n  <h1>Text after the link</h1>\n</body>\n</html>\n"
  },
  {
    "path": "test/control.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Blocking Test</title>\n\t\t<meta charset=\"utf-8\">\n\t\t<link rel=\"stylesheet\" href=\"slow.css\">\n\t</head>\n\t<body>\n\t\t<p>This is a control test file to verify that an ordinary link to a slow-responding stylesheet will block render. If this text is not visible for 5 seconds or so, assumptions about CSS blocking render are valid in your browser.</p>\n\t</body>\n</html>\n"
  },
  {
    "path": "test/dom-append.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Blocking Test</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n  <p>This is a control test file to verify that a JavaScript appended link to a slow-responding stylesheet will block render. If this text is not visible for 5 seconds or so, assumptions about CSS blocking render are valid in your browser.</p>\n  <script>\n\t\t(function() {\n\t\t\tvar req = document.createElement(\"link\");\n\t\t\treq.rel = \"stylesheet\";\n\t\t\treq.href = \"slow.css\";\n\t\t\tdocument.body.appendChild(req);\n\t\t})();\n\t</script>\n</body>\n</html>\n"
  },
  {
    "path": "test/import-head.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Blocking Test</title>\n\t\t<meta charset=\"utf-8\">\n\t\t<style>\n\t\t@import url(\"slow.css\" );\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<p>This is a control test file to verify that an ordinary link to a slow-responding stylesheet will block render. If this text is not visible for 5 seconds or so, assumptions about CSS blocking render are valid in your browser.</p>\n</body>\n</html>\n"
  },
  {
    "path": "test/import.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Blocking Test</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<p>This is a control test file to verify that an ordinary link to a slow-responding stylesheet will block render. If this text is not visible for 5 seconds or so, assumptions about CSS blocking render are valid in your browser.</p>\n\t\t<style>\n\t\t@import url(\"slow.css\" );\n\t\t</style>\n</body>\n</html>\n"
  },
  {
    "path": "test/index.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>LoadCSS Diagnostic Test Files</title>\n\t\t<meta charset=\"utf-8\">\n\t\t<style>\n\t\t\t/* a few demo styles */\n\t\t\tbody {\n\t\t\t\tfont-family: sans-serif;\n\t\t\t\tmargin: 50px auto;\n\t\t\t\tmax-width: 40em;\n\t\t\t\tpadding: 0 20px;\n\t\t\t\tline-height: 1.5\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<h1>CSS Loading Diagnostic Tests</h1>\n\t\t<p>This directory contains a variety of files that employ various CSS loading techniques.\n\t\tMost files reference a CSS file that may include a 5-second server delay to mimic latency, when tested on a node server.\n\t\tThe delay makes it easier to determine if content is rendered before the CSS loads.</p>\n\n\t\t<p><a href=\"recommended.html\">Recommended Pattern</a></p>\n\n\n\t\t<h2>Standard Loading Tests</h2>\n\n\t\t<ul>\n\t\t\t<li><strong><a href=\"control.html\">Link in Head</a>:</strong> Does a link to a stylesheet from the head of the page block page rendering?</li>\n\t\t\t<li><strong><a href=\"body.html\">Link in Body</a>:</strong> Does a stylesheet link in the body of the page block all page rendering, rendering of content that comes after it, or not block at all?</li>\n\t\t\t<li><strong><a href=\"import-head.html\">@import in Head</a>:</strong> Does an inline @import reference from the head of the page block rendering?</li>\n\t\t\t<li><strong><a href=\"import.html\">@import in Body</a>:</strong> Does an inline @import reference from the body of the page block rendering of content below it?</li>\n\t\t\t<li><strong><a href=\"dom-append.html\">DOM appendChild</a>:</strong> Create a link element and append to the document.</li>\n\t\t\t<li><strong><a href=\"attributes.html\">Link attributes</a>:</strong> Do browsers supporting Subresource Integrity correctly handle link attributes?</li>\n\t\t</ul>\n\n\n\t\t<h2>LoadCSS Assisted Loading</h2>\n\n\t\t<ul>\n\t\t\t<li><strong><a href=\"test.html\">loadCSS Dynamic Load</a>:</strong> Stylesheet loaded with loadCSS() dynamically.</li>\n\t\t\t<li><strong><a href=\"test-onload.html\">loadCSS Dynamic Load with onload handler</a>:</strong> Same as above with onload script handler.</li>\n\t\t</ul>\n\n</body>\n</html>\n"
  },
  {
    "path": "test/mediatoggle.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>CSS link media toggle</title>\n\t\t<link rel=\"stylesheet\" href=\"slow.css\" media=\"print\" onload=\"this.media='all'; this.onload=null;\">\n\t\t<noscript><link rel=\"stylesheet\" href=\"slow.css\"></noscript>\n\t\t\n\t\t<style>\n\t\t\t/* a few demo styles */\n\t\t\tbody {\n\t\t\t\tfont-family: sans-serif;\n\t\t\t\tmargin: 50px auto;\n\t\t\t\tmax-width: 40em;\n\t\t\t\tpadding: 0 20px;\n\t\t\t\tline-height: 1.5\n\t\t\t}\n\t\t\tpre {\n\t\t\t\twhite-space: normal;\n\t\t\t\tbackground: #fff;\n\t\t\t\tpadding: 15px;\n\t\t\t\tborder: 1px solid rgba(0,0,0,.3);\n\t\t\t\tcolor: #333;\n\t\t\t}\n\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<p>This is a test page that references a stylesheet using a standard <code>link[rel=stylesheet] with a print media type, which is swapped to all media when loaded.</code>.<p>\n\n\t\t<p>That markup looks like this:</p>\n\t\t<pre><code>&lt;link rel=\"stylesheet\" href=\"slow.css\" media=\"print\" onload=\"this.media='all'\"&gt;</code></pre>\n\n\t\t<p>Note: When run locally, the CSS file  has a 5 second delay built into its server response time. If it is loaded in a non-blocking manner as desired, you should be able to read this text before the page is styled as white text on green background.</p>\n\n</body>\n</html>\n"
  },
  {
    "path": "test/new-high.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Recommended Pattern Test</title>\n\t\t<meta charset=\"utf-8\">\n        <link rel=\"alternate stylesheet preload\" href=\"slow.css\" title=\"styles\" as=\"style\" onload=\"this.title='';this.rel='stylesheet'\">\n\t</head>\n\t<body style=\"font-family: sans-serif;\">\n\n\t\t<p><a href=\"https://github.com/filamentgroup/loadCSS/\">LoadCSS Project</a></p>\n\n\t\t<h1>LoadCSS: High-Priority Asynchronous CSS Loading Demo</h1>\n\n\t\t<p>This test page demonstrates a new pattern for loading a stylesheet asynchronously at a low priority. The page will turn green when the CSS loads. </p>\n<pre><code>\n&lt;link rel=&quot;alternate stylesheet preload&quot; href=&quot;slow.css&quot; title=&quot;styles&quot; as=&quot;style&quot; onload=&quot;this.title=&#39;&#39;;this.rel=&#39;stylesheet&#39;&quot;&gt;\n</code></pre>\n        <p>Instead of the <a href=\"recommended.html\"> usual print toggle</a>, this page is loading CSS with rel=\"alternate stylesheet preload\", which will load async at a high priority. \n            On load, the rel is set to stylesheet and title is turned off, causing it to apply. \n\t\t\tWhat's nice about this pattern is you can lower the priority by removing the rel value of \"preload\" to decrease its priority from high to low. <a href=\"new-low.html\">View low priority async demo</a> </p>\n\n\n\t</body>\n</html>\n"
  },
  {
    "path": "test/new-low.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Recommended Pattern Test</title>\n\t\t<meta charset=\"utf-8\">\n        <link rel=\"alternate stylesheet\" href=\"slow.css\" title=\"styles\" as=\"style\" onload=\"this.title='';this.rel='stylesheet'\">\n\t</head>\n\t<body style=\"font-family: sans-serif;\">\n\n\t\t<p><a href=\"https://github.com/filamentgroup/loadCSS/\">LoadCSS Project</a></p>\n\n\t\t<h1>LoadCSS: Low-Priority Asynchronous CSS Loading Demo</h1>\n\n\t\t<p>This test page demonstrates a new pattern for loading a stylesheet asynchronously at a low priority. The page will turn green when the CSS loads. </p>\n<pre><code>\n&lt;link rel=&quot;alternate stylesheet&quot; href=&quot;slow.css&quot; title=&quot;styles&quot; as=&quot;style&quot; onload=&quot;this.title=&#39;&#39;;this.rel=&#39;stylesheet&#39;&quot;&gt;\n</code></pre>\n\t\t<p>Instead of the <a href=\"recommended.html\"> usual print toggle</a>, this page is loading CSS with rel=\"alternate stylesheet\", which will load async at a low priority. Onload, the rel is set to stylesheet and title is turned off, causing it to apply. \n\t\t\tWhat's nice about this pattern is you can add another rel value of \"preload\" to increase its priority from low to high. <a href=\"new-high.html\">View high priority async demo</a> </p>\n\n\n\t</body>\n</html>\n"
  },
  {
    "path": "test/qunit/files/preloadtest.css",
    "content": "// just a file\n"
  },
  {
    "path": "test/qunit/files/test.css",
    "content": ".foo {\n\tbackground: white;\n}\n.bar {\n\tbackground: rgb(0, 128, 0);\n}\n"
  },
  {
    "path": "test/qunit/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>LoadCSS Test Suite</title>\n\t<meta id=\"before-test\" name=\"\"></meta>\n\t<!-- Load local QUnit. -->\n\t<link rel=\"stylesheet\" href=\"./libs/qunit/qunit.css\" media=\"screen\">\n\t<script src=\"./libs/qunit/qunit.js\"></script>\n\t<!-- Load local lib and tests. -->\n\t<script src=\"../../src/loadCSS.js\" id=\"loadCSS\"></script>\n\t<script src=\"../../src/onloadCSS.js\"></script>\n\t<script src=\"./tests.js\"></script>\n</head>\n<body>\n\t<div id=\"qunit\"></div>\n\t<div id=\"qunit-fixture\">\n\n\t</div>\n</body>\n</html>\n"
  },
  {
    "path": "test/qunit/libs/qunit/qunit.css",
    "content": "/**\n * QUnit v1.11.0 - A JavaScript Unit Testing Framework\n *\n * http://qunitjs.com\n *\n * Copyright 2012 jQuery Foundation and other contributors\n * Released under the MIT license.\n * http://jquery.org/license\n */\n\n/** Font Family and Sizes */\n\n#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {\n\tfont-family: \"Helvetica Neue Light\", \"HelveticaNeue-Light\", \"Helvetica Neue\", Calibri, Helvetica, Arial, sans-serif;\n}\n\n#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }\n#qunit-tests { font-size: smaller; }\n\n\n/** Resets */\n\n#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {\n\tmargin: 0;\n\tpadding: 0;\n}\n\n\n/** Header */\n\n#qunit-header {\n\tpadding: 0.5em 0 0.5em 1em;\n\n\tcolor: #8699a4;\n\tbackground-color: #0d3349;\n\n\tfont-size: 1.5em;\n\tline-height: 1em;\n\tfont-weight: normal;\n\n\tborder-radius: 5px 5px 0 0;\n\t-moz-border-radius: 5px 5px 0 0;\n\t-webkit-border-top-right-radius: 5px;\n\t-webkit-border-top-left-radius: 5px;\n}\n\n#qunit-header a {\n\ttext-decoration: none;\n\tcolor: #c2ccd1;\n}\n\n#qunit-header a:hover,\n#qunit-header a:focus {\n\tcolor: #fff;\n}\n\n#qunit-testrunner-toolbar label {\n\tdisplay: inline-block;\n\tpadding: 0 .5em 0 .1em;\n}\n\n#qunit-banner {\n\theight: 5px;\n}\n\n#qunit-testrunner-toolbar {\n\tpadding: 0.5em 0 0.5em 2em;\n\tcolor: #5E740B;\n\tbackground-color: #eee;\n\toverflow: hidden;\n}\n\n#qunit-userAgent {\n\tpadding: 0.5em 0 0.5em 2.5em;\n\tbackground-color: #2b81af;\n\tcolor: #fff;\n\ttext-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;\n}\n\n#qunit-modulefilter-container {\n\tfloat: right;\n}\n\n/** Tests: Pass/Fail */\n\n#qunit-tests {\n\tlist-style-position: inside;\n}\n\n#qunit-tests li {\n\tpadding: 0.4em 0.5em 0.4em 2.5em;\n\tborder-bottom: 1px solid #fff;\n\tlist-style-position: inside;\n}\n\n#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running  {\n\tdisplay: none;\n}\n\n#qunit-tests li strong {\n\tcursor: pointer;\n}\n\n#qunit-tests li a {\n\tpadding: 0.5em;\n\tcolor: #c2ccd1;\n\ttext-decoration: none;\n}\n#qunit-tests li a:hover,\n#qunit-tests li a:focus {\n\tcolor: #000;\n}\n\n#qunit-tests li .runtime {\n\tfloat: right;\n\tfont-size: smaller;\n}\n\n.qunit-assert-list {\n\tmargin-top: 0.5em;\n\tpadding: 0.5em;\n\n\tbackground-color: #fff;\n\n\tborder-radius: 5px;\n\t-moz-border-radius: 5px;\n\t-webkit-border-radius: 5px;\n}\n\n.qunit-collapsed {\n\tdisplay: none;\n}\n\n#qunit-tests table {\n\tborder-collapse: collapse;\n\tmargin-top: .2em;\n}\n\n#qunit-tests th {\n\ttext-align: right;\n\tvertical-align: top;\n\tpadding: 0 .5em 0 0;\n}\n\n#qunit-tests td {\n\tvertical-align: top;\n}\n\n#qunit-tests pre {\n\tmargin: 0;\n\twhite-space: pre-wrap;\n\tword-wrap: break-word;\n}\n\n#qunit-tests del {\n\tbackground-color: #e0f2be;\n\tcolor: #374e0c;\n\ttext-decoration: none;\n}\n\n#qunit-tests ins {\n\tbackground-color: #ffcaca;\n\tcolor: #500;\n\ttext-decoration: none;\n}\n\n/*** Test Counts */\n\n#qunit-tests b.counts                       { color: black; }\n#qunit-tests b.passed                       { color: #5E740B; }\n#qunit-tests b.failed                       { color: #710909; }\n\n#qunit-tests li li {\n\tpadding: 5px;\n\tbackground-color: #fff;\n\tborder-bottom: none;\n\tlist-style-position: inside;\n}\n\n/*** Passing Styles */\n\n#qunit-tests li li.pass {\n\tcolor: #3c510c;\n\tbackground-color: #fff;\n\tborder-left: 10px solid #C6E746;\n}\n\n#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }\n#qunit-tests .pass .test-name               { color: #366097; }\n\n#qunit-tests .pass .test-actual,\n#qunit-tests .pass .test-expected           { color: #999999; }\n\n#qunit-banner.qunit-pass                    { background-color: #C6E746; }\n\n/*** Failing Styles */\n\n#qunit-tests li li.fail {\n\tcolor: #710909;\n\tbackground-color: #fff;\n\tborder-left: 10px solid #EE5757;\n\twhite-space: pre;\n}\n\n#qunit-tests > li:last-child {\n\tborder-radius: 0 0 5px 5px;\n\t-moz-border-radius: 0 0 5px 5px;\n\t-webkit-border-bottom-right-radius: 5px;\n\t-webkit-border-bottom-left-radius: 5px;\n}\n\n#qunit-tests .fail                          { color: #000000; background-color: #EE5757; }\n#qunit-tests .fail .test-name,\n#qunit-tests .fail .module-name             { color: #000000; }\n\n#qunit-tests .fail .test-actual             { color: #EE5757; }\n#qunit-tests .fail .test-expected           { color: green;   }\n\n#qunit-banner.qunit-fail                    { background-color: #EE5757; }\n\n\n/** Result */\n\n#qunit-testresult {\n\tpadding: 0.5em 0.5em 0.5em 2.5em;\n\n\tcolor: #2b81af;\n\tbackground-color: #D2E0E6;\n\n\tborder-bottom: 1px solid white;\n}\n#qunit-testresult .module-name {\n\tfont-weight: bold;\n}\n\n/** Fixture */\n\n#qunit-fixture {\n\tposition: absolute;\n\ttop: -10000px;\n\tleft: -10000px;\n\twidth: 1000px;\n\theight: 1000px;\n}\n"
  },
  {
    "path": "test/qunit/libs/qunit/qunit.js",
    "content": "/**\n * QUnit v1.11.0 - A JavaScript Unit Testing Framework\n *\n * http://qunitjs.com\n *\n * Copyright 2012 jQuery Foundation and other contributors\n * Released under the MIT license.\n * http://jquery.org/license\n */\n/* jshint ignore:start */\n\n(function( window ) {\n\nvar QUnit,\n\tassert,\n\tconfig,\n\tonErrorFnPrev,\n\ttestId = 0,\n\tfileName = (sourceFromStacktrace( 0 ) || \"\" ).replace(/(:\\d+)+\\)?/, \"\").replace(/.+\\//, \"\"),\n\ttoString = Object.prototype.toString,\n\thasOwn = Object.prototype.hasOwnProperty,\n\t// Keep a local reference to Date (GH-283)\n\tDate = window.Date,\n\tdefined = {\n\t\tsetTimeout: typeof window.setTimeout !== \"undefined\",\n\t\tsessionStorage: (function() {\n\t\t\tvar x = \"qunit-test-string\";\n\t\t\ttry {\n\t\t\t\tsessionStorage.setItem( x, x );\n\t\t\t\tsessionStorage.removeItem( x );\n\t\t\t\treturn true;\n\t\t\t} catch( e ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}())\n\t},\n\t/**\n\t * Provides a normalized error string, correcting an issue\n\t * with IE 7 (and prior) where Error.prototype.toString is\n\t * not properly implemented\n\t *\n\t * Based on http://es5.github.com/#x15.11.4.4\n\t *\n\t * @param {String|Error} error\n\t * @return {String} error message\n\t */\n\terrorString = function( error ) {\n\t\tvar name, message,\n\t\t\terrorString = error.toString();\n\t\tif ( errorString.substring( 0, 7 ) === \"[object\" ) {\n\t\t\tname = error.name ? error.name.toString() : \"Error\";\n\t\t\tmessage = error.message ? error.message.toString() : \"\";\n\t\t\tif ( name && message ) {\n\t\t\t\treturn name + \": \" + message;\n\t\t\t} else if ( name ) {\n\t\t\t\treturn name;\n\t\t\t} else if ( message ) {\n\t\t\t\treturn message;\n\t\t\t} else {\n\t\t\t\treturn \"Error\";\n\t\t\t}\n\t\t} else {\n\t\t\treturn errorString;\n\t\t}\n\t},\n\t/**\n\t * Makes a clone of an object using only Array or Object as base,\n\t * and copies over the own enumerable properties.\n\t *\n\t * @param {Object} obj\n\t * @return {Object} New object with only the own properties (recursively).\n\t */\n\tobjectValues = function( obj ) {\n\t\t// Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392.\n\t\t/*jshint newcap: false */\n\t\tvar key, val,\n\t\t\tvals = QUnit.is( \"array\", obj ) ? [] : {};\n\t\tfor ( key in obj ) {\n\t\t\tif ( hasOwn.call( obj, key ) ) {\n\t\t\t\tval = obj[key];\n\t\t\t\tvals[key] = val === Object(val) ? objectValues(val) : val;\n\t\t\t}\n\t\t}\n\t\treturn vals;\n\t};\n\nfunction Test( settings ) {\n\textend( this, settings );\n\tthis.assertions = [];\n\tthis.testNumber = ++Test.count;\n}\n\nTest.count = 0;\n\nTest.prototype = {\n\tinit: function() {\n\t\tvar a, b, li,\n\t\t\ttests = id( \"qunit-tests\" );\n\n\t\tif ( tests ) {\n\t\t\tb = document.createElement( \"strong\" );\n\t\t\tb.innerHTML = this.nameHtml;\n\n\t\t\t// `a` initialized at top of scope\n\t\t\ta = document.createElement( \"a\" );\n\t\t\ta.innerHTML = \"Rerun\";\n\t\t\ta.href = QUnit.url({ testNumber: this.testNumber });\n\n\t\t\tli = document.createElement( \"li\" );\n\t\t\tli.appendChild( b );\n\t\t\tli.appendChild( a );\n\t\t\tli.className = \"running\";\n\t\t\tli.id = this.id = \"qunit-test-output\" + testId++;\n\n\t\t\ttests.appendChild( li );\n\t\t}\n\t},\n\tsetup: function() {\n\t\tif ( this.module !== config.previousModule ) {\n\t\t\tif ( config.previousModule ) {\n\t\t\t\trunLoggingCallbacks( \"moduleDone\", QUnit, {\n\t\t\t\t\tname: config.previousModule,\n\t\t\t\t\tfailed: config.moduleStats.bad,\n\t\t\t\t\tpassed: config.moduleStats.all - config.moduleStats.bad,\n\t\t\t\t\ttotal: config.moduleStats.all\n\t\t\t\t});\n\t\t\t}\n\t\t\tconfig.previousModule = this.module;\n\t\t\tconfig.moduleStats = { all: 0, bad: 0 };\n\t\t\trunLoggingCallbacks( \"moduleStart\", QUnit, {\n\t\t\t\tname: this.module\n\t\t\t});\n\t\t} else if ( config.autorun ) {\n\t\t\trunLoggingCallbacks( \"moduleStart\", QUnit, {\n\t\t\t\tname: this.module\n\t\t\t});\n\t\t}\n\n\t\tconfig.current = this;\n\n\t\tthis.testEnvironment = extend({\n\t\t\tsetup: function() {},\n\t\t\tteardown: function() {}\n\t\t}, this.moduleTestEnvironment );\n\n\t\tthis.started = +new Date();\n\t\trunLoggingCallbacks( \"testStart\", QUnit, {\n\t\t\tname: this.testName,\n\t\t\tmodule: this.module\n\t\t});\n\n\t\t// allow utility functions to access the current test environment\n\t\t// TODO why??\n\t\tQUnit.current_testEnvironment = this.testEnvironment;\n\n\t\tif ( !config.pollution ) {\n\t\t\tsaveGlobal();\n\t\t}\n\t\tif ( config.notrycatch ) {\n\t\t\tthis.testEnvironment.setup.call( this.testEnvironment );\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.testEnvironment.setup.call( this.testEnvironment );\n\t\t} catch( e ) {\n\t\t\tQUnit.pushFailure( \"Setup failed on \" + this.testName + \": \" + ( e.message || e ), extractStacktrace( e, 1 ) );\n\t\t}\n\t},\n\trun: function() {\n\t\tconfig.current = this;\n\n\t\tvar running = id( \"qunit-testresult\" );\n\n\t\tif ( running ) {\n\t\t\trunning.innerHTML = \"Running: <br/>\" + this.nameHtml;\n\t\t}\n\n\t\tif ( this.async ) {\n\t\t\tQUnit.stop();\n\t\t}\n\n\t\tthis.callbackStarted = +new Date();\n\n\t\tif ( config.notrycatch ) {\n\t\t\tthis.callback.call( this.testEnvironment, QUnit.assert );\n\t\t\tthis.callbackRuntime = +new Date() - this.callbackStarted;\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.callback.call( this.testEnvironment, QUnit.assert );\n\t\t\tthis.callbackRuntime = +new Date() - this.callbackStarted;\n\t\t} catch( e ) {\n\t\t\tthis.callbackRuntime = +new Date() - this.callbackStarted;\n\n\t\t\tQUnit.pushFailure( \"Died on test #\" + (this.assertions.length + 1) + \" \" + this.stack + \": \" + ( e.message || e ), extractStacktrace( e, 0 ) );\n\t\t\t// else next test will carry the responsibility\n\t\t\tsaveGlobal();\n\n\t\t\t// Restart the tests if they're blocking\n\t\t\tif ( config.blocking ) {\n\t\t\t\tQUnit.start();\n\t\t\t}\n\t\t}\n\t},\n\tteardown: function() {\n\t\tconfig.current = this;\n\t\tif ( config.notrycatch ) {\n\t\t\tif ( typeof this.callbackRuntime === \"undefined\" ) {\n\t\t\t\tthis.callbackRuntime = +new Date() - this.callbackStarted;\n\t\t\t}\n\t\t\tthis.testEnvironment.teardown.call( this.testEnvironment );\n\t\t\treturn;\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tthis.testEnvironment.teardown.call( this.testEnvironment );\n\t\t\t} catch( e ) {\n\t\t\t\tQUnit.pushFailure( \"Teardown failed on \" + this.testName + \": \" + ( e.message || e ), extractStacktrace( e, 1 ) );\n\t\t\t}\n\t\t}\n\t\tcheckPollution();\n\t},\n\tfinish: function() {\n\t\tconfig.current = this;\n\t\tif ( config.requireExpects && this.expected === null ) {\n\t\t\tQUnit.pushFailure( \"Expected number of assertions to be defined, but expect() was not called.\", this.stack );\n\t\t} else if ( this.expected !== null && this.expected !== this.assertions.length ) {\n\t\t\tQUnit.pushFailure( \"Expected \" + this.expected + \" assertions, but \" + this.assertions.length + \" were run\", this.stack );\n\t\t} else if ( this.expected === null && !this.assertions.length ) {\n\t\t\tQUnit.pushFailure( \"Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.\", this.stack );\n\t\t}\n\n\t\tvar i, assertion, a, b, time, li, ol,\n\t\t\ttest = this,\n\t\t\tgood = 0,\n\t\t\tbad = 0,\n\t\t\ttests = id( \"qunit-tests\" );\n\n\t\tthis.runtime = +new Date() - this.started;\n\t\tconfig.stats.all += this.assertions.length;\n\t\tconfig.moduleStats.all += this.assertions.length;\n\n\t\tif ( tests ) {\n\t\t\tol = document.createElement( \"ol\" );\n\t\t\tol.className = \"qunit-assert-list\";\n\n\t\t\tfor ( i = 0; i < this.assertions.length; i++ ) {\n\t\t\t\tassertion = this.assertions[i];\n\n\t\t\t\tli = document.createElement( \"li\" );\n\t\t\t\tli.className = assertion.result ? \"pass\" : \"fail\";\n\t\t\t\tli.innerHTML = assertion.message || ( assertion.result ? \"okay\" : \"failed\" );\n\t\t\t\tol.appendChild( li );\n\n\t\t\t\tif ( assertion.result ) {\n\t\t\t\t\tgood++;\n\t\t\t\t} else {\n\t\t\t\t\tbad++;\n\t\t\t\t\tconfig.stats.bad++;\n\t\t\t\t\tconfig.moduleStats.bad++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// store result when possible\n\t\t\tif ( QUnit.config.reorder && defined.sessionStorage ) {\n\t\t\t\tif ( bad ) {\n\t\t\t\t\tsessionStorage.setItem( \"qunit-test-\" + this.module + \"-\" + this.testName, bad );\n\t\t\t\t} else {\n\t\t\t\t\tsessionStorage.removeItem( \"qunit-test-\" + this.module + \"-\" + this.testName );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( bad === 0 ) {\n\t\t\t\taddClass( ol, \"qunit-collapsed\" );\n\t\t\t}\n\n\t\t\t// `b` initialized at top of scope\n\t\t\tb = document.createElement( \"strong\" );\n\t\t\tb.innerHTML = this.nameHtml + \" <b class='counts'>(<b class='failed'>\" + bad + \"</b>, <b class='passed'>\" + good + \"</b>, \" + this.assertions.length + \")</b>\";\n\n\t\t\taddEvent(b, \"click\", function() {\n\t\t\t\tvar next = b.parentNode.lastChild,\n\t\t\t\t\tcollapsed = hasClass( next, \"qunit-collapsed\" );\n\t\t\t\t( collapsed ? removeClass : addClass )( next, \"qunit-collapsed\" );\n\t\t\t});\n\n\t\t\taddEvent(b, \"dblclick\", function( e ) {\n\t\t\t\tvar target = e && e.target ? e.target : window.event.srcElement;\n\t\t\t\tif ( target.nodeName.toLowerCase() === \"span\" || target.nodeName.toLowerCase() === \"b\" ) {\n\t\t\t\t\ttarget = target.parentNode;\n\t\t\t\t}\n\t\t\t\tif ( window.location && target.nodeName.toLowerCase() === \"strong\" ) {\n\t\t\t\t\twindow.location = QUnit.url({ testNumber: test.testNumber });\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// `time` initialized at top of scope\n\t\t\ttime = document.createElement( \"span\" );\n\t\t\ttime.className = \"runtime\";\n\t\t\ttime.innerHTML = this.runtime + \" ms\";\n\n\t\t\t// `li` initialized at top of scope\n\t\t\tli = id( this.id );\n\t\t\tli.className = bad ? \"fail\" : \"pass\";\n\t\t\tli.removeChild( li.firstChild );\n\t\t\ta = li.firstChild;\n\t\t\tli.appendChild( b );\n\t\t\tli.appendChild( a );\n\t\t\tli.appendChild( time );\n\t\t\tli.appendChild( ol );\n\n\t\t} else {\n\t\t\tfor ( i = 0; i < this.assertions.length; i++ ) {\n\t\t\t\tif ( !this.assertions[i].result ) {\n\t\t\t\t\tbad++;\n\t\t\t\t\tconfig.stats.bad++;\n\t\t\t\t\tconfig.moduleStats.bad++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\trunLoggingCallbacks( \"testDone\", QUnit, {\n\t\t\tname: this.testName,\n\t\t\tmodule: this.module,\n\t\t\tfailed: bad,\n\t\t\tpassed: this.assertions.length - bad,\n\t\t\ttotal: this.assertions.length,\n\t\t\tduration: this.runtime\n\t\t});\n\n\t\tQUnit.reset();\n\n\t\tconfig.current = undefined;\n\t},\n\n\tqueue: function() {\n\t\tvar bad,\n\t\t\ttest = this;\n\n\t\tsynchronize(function() {\n\t\t\ttest.init();\n\t\t});\n\t\tfunction run() {\n\t\t\t// each of these can by async\n\t\t\tsynchronize(function() {\n\t\t\t\ttest.setup();\n\t\t\t});\n\t\t\tsynchronize(function() {\n\t\t\t\ttest.run();\n\t\t\t});\n\t\t\tsynchronize(function() {\n\t\t\t\ttest.teardown();\n\t\t\t});\n\t\t\tsynchronize(function() {\n\t\t\t\ttest.finish();\n\t\t\t});\n\t\t}\n\n\t\t// `bad` initialized at top of scope\n\t\t// defer when previous test run passed, if storage is available\n\t\tbad = QUnit.config.reorder && defined.sessionStorage &&\n\t\t\t\t\t\t+sessionStorage.getItem( \"qunit-test-\" + this.module + \"-\" + this.testName );\n\n\t\tif ( bad ) {\n\t\t\trun();\n\t\t} else {\n\t\t\tsynchronize( run, true );\n\t\t}\n\t}\n};\n\n// Root QUnit object.\n// `QUnit` initialized at top of scope\nQUnit = {\n\n\t// call on start of module test to prepend name to all tests\n\tmodule: function( name, testEnvironment ) {\n\t\tconfig.currentModule = name;\n\t\tconfig.currentModuleTestEnvironment = testEnvironment;\n\t\tconfig.modules[name] = true;\n\t},\n\n\tasyncTest: function( testName, expected, callback ) {\n\t\tif ( arguments.length === 2 ) {\n\t\t\tcallback = expected;\n\t\t\texpected = null;\n\t\t}\n\n\t\tQUnit.test( testName, expected, callback, true );\n\t},\n\n\ttest: function( testName, expected, callback, async ) {\n\t\tvar test,\n\t\t\tnameHtml = \"<span class='test-name'>\" + escapeText( testName ) + \"</span>\";\n\n\t\tif ( arguments.length === 2 ) {\n\t\t\tcallback = expected;\n\t\t\texpected = null;\n\t\t}\n\n\t\tif ( config.currentModule ) {\n\t\t\tnameHtml = \"<span class='module-name'>\" + escapeText( config.currentModule ) + \"</span>: \" + nameHtml;\n\t\t}\n\n\t\ttest = new Test({\n\t\t\tnameHtml: nameHtml,\n\t\t\ttestName: testName,\n\t\t\texpected: expected,\n\t\t\tasync: async,\n\t\t\tcallback: callback,\n\t\t\tmodule: config.currentModule,\n\t\t\tmoduleTestEnvironment: config.currentModuleTestEnvironment,\n\t\t\tstack: sourceFromStacktrace( 2 )\n\t\t});\n\n\t\tif ( !validTest( test ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttest.queue();\n\t},\n\n\t// Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.\n\texpect: function( asserts ) {\n\t\tif (arguments.length === 1) {\n\t\t\tconfig.current.expected = asserts;\n\t\t} else {\n\t\t\treturn config.current.expected;\n\t\t}\n\t},\n\n\tstart: function( count ) {\n\t\t// QUnit hasn't been initialized yet.\n\t\t// Note: RequireJS (et al) may delay onLoad\n\t\tif ( config.semaphore === undefined ) {\n\t\t\tQUnit.begin(function() {\n\t\t\t\t// This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tQUnit.start( count );\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconfig.semaphore -= count || 1;\n\t\t// don't start until equal number of stop-calls\n\t\tif ( config.semaphore > 0 ) {\n\t\t\treturn;\n\t\t}\n\t\t// ignore if start is called more often then stop\n\t\tif ( config.semaphore < 0 ) {\n\t\t\tconfig.semaphore = 0;\n\t\t\tQUnit.pushFailure( \"Called start() while already started (QUnit.config.semaphore was 0 already)\", null, sourceFromStacktrace(2) );\n\t\t\treturn;\n\t\t}\n\t\t// A slight delay, to avoid any current callbacks\n\t\tif ( defined.setTimeout ) {\n\t\t\twindow.setTimeout(function() {\n\t\t\t\tif ( config.semaphore > 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( config.timeout ) {\n\t\t\t\t\tclearTimeout( config.timeout );\n\t\t\t\t}\n\n\t\t\t\tconfig.blocking = false;\n\t\t\t\tprocess( true );\n\t\t\t}, 13);\n\t\t} else {\n\t\t\tconfig.blocking = false;\n\t\t\tprocess( true );\n\t\t}\n\t},\n\n\tstop: function( count ) {\n\t\tconfig.semaphore += count || 1;\n\t\tconfig.blocking = true;\n\n\t\tif ( config.testTimeout && defined.setTimeout ) {\n\t\t\tclearTimeout( config.timeout );\n\t\t\tconfig.timeout = window.setTimeout(function() {\n\t\t\t\tQUnit.ok( false, \"Test timed out\" );\n\t\t\t\tconfig.semaphore = 1;\n\t\t\t\tQUnit.start();\n\t\t\t}, config.testTimeout );\n\t\t}\n\t}\n};\n\n// `assert` initialized at top of scope\n// Asssert helpers\n// All of these must either call QUnit.push() or manually do:\n// - runLoggingCallbacks( \"log\", .. );\n// - config.current.assertions.push({ .. });\n// We attach it to the QUnit object *after* we expose the public API,\n// otherwise `assert` will become a global variable in browsers (#341).\nassert = {\n\t/**\n\t * Asserts rough true-ish result.\n\t * @name ok\n\t * @function\n\t * @example ok( \"asdfasdf\".length > 5, \"There must be at least 5 chars\" );\n\t */\n\tok: function( result, msg ) {\n\t\tif ( !config.current ) {\n\t\t\tthrow new Error( \"ok() assertion outside test context, was \" + sourceFromStacktrace(2) );\n\t\t}\n\t\tresult = !!result;\n\n\t\tvar source,\n\t\t\tdetails = {\n\t\t\t\tmodule: config.current.module,\n\t\t\t\tname: config.current.testName,\n\t\t\t\tresult: result,\n\t\t\t\tmessage: msg\n\t\t\t};\n\n\t\tmsg = escapeText( msg || (result ? \"okay\" : \"failed\" ) );\n\t\tmsg = \"<span class='test-message'>\" + msg + \"</span>\";\n\n\t\tif ( !result ) {\n\t\t\tsource = sourceFromStacktrace( 2 );\n\t\t\tif ( source ) {\n\t\t\t\tdetails.source = source;\n\t\t\t\tmsg += \"<table><tr class='test-source'><th>Source: </th><td><pre>\" + escapeText( source ) + \"</pre></td></tr></table>\";\n\t\t\t}\n\t\t}\n\t\trunLoggingCallbacks( \"log\", QUnit, details );\n\t\tconfig.current.assertions.push({\n\t\t\tresult: result,\n\t\t\tmessage: msg\n\t\t});\n\t},\n\n\t/**\n\t * Assert that the first two arguments are equal, with an optional message.\n\t * Prints out both actual and expected values.\n\t * @name equal\n\t * @function\n\t * @example equal( format( \"Received {0} bytes.\", 2), \"Received 2 bytes.\", \"format() replaces {0} with next argument\" );\n\t */\n\tequal: function( actual, expected, message ) {\n\t\t/*jshint eqeqeq:false */\n\t\tQUnit.push( expected == actual, actual, expected, message );\n\t},\n\n\t/**\n\t * @name notEqual\n\t * @function\n\t */\n\tnotEqual: function( actual, expected, message ) {\n\t\t/*jshint eqeqeq:false */\n\t\tQUnit.push( expected != actual, actual, expected, message );\n\t},\n\n\t/**\n\t * @name propEqual\n\t * @function\n\t */\n\tpropEqual: function( actual, expected, message ) {\n\t\tactual = objectValues(actual);\n\t\texpected = objectValues(expected);\n\t\tQUnit.push( QUnit.equiv(actual, expected), actual, expected, message );\n\t},\n\n\t/**\n\t * @name notPropEqual\n\t * @function\n\t */\n\tnotPropEqual: function( actual, expected, message ) {\n\t\tactual = objectValues(actual);\n\t\texpected = objectValues(expected);\n\t\tQUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );\n\t},\n\n\t/**\n\t * @name deepEqual\n\t * @function\n\t */\n\tdeepEqual: function( actual, expected, message ) {\n\t\tQUnit.push( QUnit.equiv(actual, expected), actual, expected, message );\n\t},\n\n\t/**\n\t * @name notDeepEqual\n\t * @function\n\t */\n\tnotDeepEqual: function( actual, expected, message ) {\n\t\tQUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );\n\t},\n\n\t/**\n\t * @name strictEqual\n\t * @function\n\t */\n\tstrictEqual: function( actual, expected, message ) {\n\t\tQUnit.push( expected === actual, actual, expected, message );\n\t},\n\n\t/**\n\t * @name notStrictEqual\n\t * @function\n\t */\n\tnotStrictEqual: function( actual, expected, message ) {\n\t\tQUnit.push( expected !== actual, actual, expected, message );\n\t},\n\n\t\"throws\": function( block, expected, message ) {\n\t\tvar actual,\n\t\t\texpectedOutput = expected,\n\t\t\tok = false;\n\n\t\t// 'expected' is optional\n\t\tif ( typeof expected === \"string\" ) {\n\t\t\tmessage = expected;\n\t\t\texpected = null;\n\t\t}\n\n\t\tconfig.current.ignoreGlobalErrors = true;\n\t\ttry {\n\t\t\tblock.call( config.current.testEnvironment );\n\t\t} catch (e) {\n\t\t\tactual = e;\n\t\t}\n\t\tconfig.current.ignoreGlobalErrors = false;\n\n\t\tif ( actual ) {\n\t\t\t// we don't want to validate thrown error\n\t\t\tif ( !expected ) {\n\t\t\t\tok = true;\n\t\t\t\texpectedOutput = null;\n\t\t\t// expected is a regexp\n\t\t\t} else if ( QUnit.objectType( expected ) === \"regexp\" ) {\n\t\t\t\tok = expected.test( errorString( actual ) );\n\t\t\t// expected is a constructor\n\t\t\t} else if ( actual instanceof expected ) {\n\t\t\t\tok = true;\n\t\t\t// expected is a validation function which returns true is validation passed\n\t\t\t} else if ( expected.call( {}, actual ) === true ) {\n\t\t\t\texpectedOutput = null;\n\t\t\t\tok = true;\n\t\t\t}\n\n\t\t\tQUnit.push( ok, actual, expectedOutput, message );\n\t\t} else {\n\t\t\tQUnit.pushFailure( message, null, 'No exception was thrown.' );\n\t\t}\n\t}\n};\n\n/**\n * @deprecate since 1.8.0\n * Kept assertion helpers in root for backwards compatibility.\n */\nextend( QUnit, assert );\n\n/**\n * @deprecated since 1.9.0\n * Kept root \"raises()\" for backwards compatibility.\n * (Note that we don't introduce assert.raises).\n */\nQUnit.raises = assert[ \"throws\" ];\n\n/**\n * @deprecated since 1.0.0, replaced with error pushes since 1.3.0\n * Kept to avoid TypeErrors for undefined methods.\n */\nQUnit.equals = function() {\n\tQUnit.push( false, false, false, \"QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead\" );\n};\nQUnit.same = function() {\n\tQUnit.push( false, false, false, \"QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead\" );\n};\n\n// We want access to the constructor's prototype\n(function() {\n\tfunction F() {}\n\tF.prototype = QUnit;\n\tQUnit = new F();\n\t// Make F QUnit's constructor so that we can add to the prototype later\n\tQUnit.constructor = F;\n}());\n\n/**\n * Config object: Maintain internal state\n * Later exposed as QUnit.config\n * `config` initialized at top of scope\n */\nconfig = {\n\t// The queue of tests to run\n\tqueue: [],\n\n\t// block until document ready\n\tblocking: true,\n\n\t// when enabled, show only failing tests\n\t// gets persisted through sessionStorage and can be changed in UI via checkbox\n\thidepassed: false,\n\n\t// by default, run previously failed tests first\n\t// very useful in combination with \"Hide passed tests\" checked\n\treorder: true,\n\n\t// by default, modify document.title when suite is done\n\taltertitle: true,\n\n\t// when enabled, all tests must call expect()\n\trequireExpects: false,\n\n\t// add checkboxes that are persisted in the query-string\n\t// when enabled, the id is set to `true` as a `QUnit.config` property\n\turlConfig: [\n\t\t{\n\t\t\tid: \"noglobals\",\n\t\t\tlabel: \"Check for Globals\",\n\t\t\ttooltip: \"Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings.\"\n\t\t},\n\t\t{\n\t\t\tid: \"notrycatch\",\n\t\t\tlabel: \"No try-catch\",\n\t\t\ttooltip: \"Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings.\"\n\t\t}\n\t],\n\n\t// Set of all modules.\n\tmodules: {},\n\n\t// logging callback queues\n\tbegin: [],\n\tdone: [],\n\tlog: [],\n\ttestStart: [],\n\ttestDone: [],\n\tmoduleStart: [],\n\tmoduleDone: []\n};\n\n// Export global variables, unless an 'exports' object exists,\n// in that case we assume we're in CommonJS (dealt with on the bottom of the script)\nif ( typeof exports === \"undefined\" ) {\n\textend( window, QUnit );\n\n\t// Expose QUnit object\n\twindow.QUnit = QUnit;\n}\n\n// Initialize more QUnit.config and QUnit.urlParams\n(function() {\n\tvar i,\n\t\tlocation = window.location || { search: \"\", protocol: \"file:\" },\n\t\tparams = location.search.slice( 1 ).split( \"&\" ),\n\t\tlength = params.length,\n\t\turlParams = {},\n\t\tcurrent;\n\n\tif ( params[ 0 ] ) {\n\t\tfor ( i = 0; i < length; i++ ) {\n\t\t\tcurrent = params[ i ].split( \"=\" );\n\t\t\tcurrent[ 0 ] = decodeURIComponent( current[ 0 ] );\n\t\t\t// allow just a key to turn on a flag, e.g., test.html?noglobals\n\t\t\tcurrent[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;\n\t\t\turlParams[ current[ 0 ] ] = current[ 1 ];\n\t\t}\n\t}\n\n\tQUnit.urlParams = urlParams;\n\n\t// String search anywhere in moduleName+testName\n\tconfig.filter = urlParams.filter;\n\n\t// Exact match of the module name\n\tconfig.module = urlParams.module;\n\n\tconfig.testNumber = parseInt( urlParams.testNumber, 10 ) || null;\n\n\t// Figure out if we're running the tests from a server or not\n\tQUnit.isLocal = location.protocol === \"file:\";\n}());\n\n// Extend QUnit object,\n// these after set here because they should not be exposed as global functions\nextend( QUnit, {\n\tassert: assert,\n\n\tconfig: config,\n\n\t// Initialize the configuration options\n\tinit: function() {\n\t\textend( config, {\n\t\t\tstats: { all: 0, bad: 0 },\n\t\t\tmoduleStats: { all: 0, bad: 0 },\n\t\t\tstarted: +new Date(),\n\t\t\tupdateRate: 1000,\n\t\t\tblocking: false,\n\t\t\tautostart: true,\n\t\t\tautorun: false,\n\t\t\tfilter: \"\",\n\t\t\tqueue: [],\n\t\t\tsemaphore: 1\n\t\t});\n\n\t\tvar tests, banner, result,\n\t\t\tqunit = id( \"qunit\" );\n\n\t\tif ( qunit ) {\n\t\t\tqunit.innerHTML =\n\t\t\t\t\"<h1 id='qunit-header'>\" + escapeText( document.title ) + \"</h1>\" +\n\t\t\t\t\"<h2 id='qunit-banner'></h2>\" +\n\t\t\t\t\"<div id='qunit-testrunner-toolbar'></div>\" +\n\t\t\t\t\"<h2 id='qunit-userAgent'></h2>\" +\n\t\t\t\t\"<ol id='qunit-tests'></ol>\";\n\t\t}\n\n\t\ttests = id( \"qunit-tests\" );\n\t\tbanner = id( \"qunit-banner\" );\n\t\tresult = id( \"qunit-testresult\" );\n\n\t\tif ( tests ) {\n\t\t\ttests.innerHTML = \"\";\n\t\t}\n\n\t\tif ( banner ) {\n\t\t\tbanner.className = \"\";\n\t\t}\n\n\t\tif ( result ) {\n\t\t\tresult.parentNode.removeChild( result );\n\t\t}\n\n\t\tif ( tests ) {\n\t\t\tresult = document.createElement( \"p\" );\n\t\t\tresult.id = \"qunit-testresult\";\n\t\t\tresult.className = \"result\";\n\t\t\ttests.parentNode.insertBefore( result, tests );\n\t\t\tresult.innerHTML = \"Running...<br/>&nbsp;\";\n\t\t}\n\t},\n\n\t// Resets the test setup. Useful for tests that modify the DOM.\n\treset: function() {\n\t\tvar fixture = id( \"qunit-fixture\" );\n\t\tif ( fixture ) {\n\t\t\tfixture.innerHTML = config.fixture;\n\t\t}\n\t},\n\n\t// Trigger an event on an element.\n\t// @example triggerEvent( document.body, \"click\" );\n\ttriggerEvent: function( elem, type, event ) {\n\t\tif ( document.createEvent ) {\n\t\t\tevent = document.createEvent( \"MouseEvents\" );\n\t\t\tevent.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,\n\t\t\t\t0, 0, 0, 0, 0, false, false, false, false, 0, null);\n\n\t\t\telem.dispatchEvent( event );\n\t\t} else if ( elem.fireEvent ) {\n\t\t\telem.fireEvent( \"on\" + type );\n\t\t}\n\t},\n\n\t// Safe object type checking\n\tis: function( type, obj ) {\n\t\treturn QUnit.objectType( obj ) === type;\n\t},\n\n\tobjectType: function( obj ) {\n\t\tif ( typeof obj === \"undefined\" ) {\n\t\t\t\treturn \"undefined\";\n\t\t// consider: typeof null === object\n\t\t}\n\t\tif ( obj === null ) {\n\t\t\t\treturn \"null\";\n\t\t}\n\n\t\tvar match = toString.call( obj ).match(/^\\[object\\s(.*)\\]$/),\n\t\t\ttype = match && match[1] || \"\";\n\n\t\tswitch ( type ) {\n\t\t\tcase \"Number\":\n\t\t\t\tif ( isNaN(obj) ) {\n\t\t\t\t\treturn \"nan\";\n\t\t\t\t}\n\t\t\t\treturn \"number\";\n\t\t\tcase \"String\":\n\t\t\tcase \"Boolean\":\n\t\t\tcase \"Array\":\n\t\t\tcase \"Date\":\n\t\t\tcase \"RegExp\":\n\t\t\tcase \"Function\":\n\t\t\t\treturn type.toLowerCase();\n\t\t}\n\t\tif ( typeof obj === \"object\" ) {\n\t\t\treturn \"object\";\n\t\t}\n\t\treturn undefined;\n\t},\n\n\tpush: function( result, actual, expected, message ) {\n\t\tif ( !config.current ) {\n\t\t\tthrow new Error( \"assertion outside test context, was \" + sourceFromStacktrace() );\n\t\t}\n\n\t\tvar output, source,\n\t\t\tdetails = {\n\t\t\t\tmodule: config.current.module,\n\t\t\t\tname: config.current.testName,\n\t\t\t\tresult: result,\n\t\t\t\tmessage: message,\n\t\t\t\tactual: actual,\n\t\t\t\texpected: expected\n\t\t\t};\n\n\t\tmessage = escapeText( message ) || ( result ? \"okay\" : \"failed\" );\n\t\tmessage = \"<span class='test-message'>\" + message + \"</span>\";\n\t\toutput = message;\n\n\t\tif ( !result ) {\n\t\t\texpected = escapeText( QUnit.jsDump.parse(expected) );\n\t\t\tactual = escapeText( QUnit.jsDump.parse(actual) );\n\t\t\toutput += \"<table><tr class='test-expected'><th>Expected: </th><td><pre>\" + expected + \"</pre></td></tr>\";\n\n\t\t\tif ( actual !== expected ) {\n\t\t\t\toutput += \"<tr class='test-actual'><th>Result: </th><td><pre>\" + actual + \"</pre></td></tr>\";\n\t\t\t\toutput += \"<tr class='test-diff'><th>Diff: </th><td><pre>\" + QUnit.diff( expected, actual ) + \"</pre></td></tr>\";\n\t\t\t}\n\n\t\t\tsource = sourceFromStacktrace();\n\n\t\t\tif ( source ) {\n\t\t\t\tdetails.source = source;\n\t\t\t\toutput += \"<tr class='test-source'><th>Source: </th><td><pre>\" + escapeText( source ) + \"</pre></td></tr>\";\n\t\t\t}\n\n\t\t\toutput += \"</table>\";\n\t\t}\n\n\t\trunLoggingCallbacks( \"log\", QUnit, details );\n\n\t\tconfig.current.assertions.push({\n\t\t\tresult: !!result,\n\t\t\tmessage: output\n\t\t});\n\t},\n\n\tpushFailure: function( message, source, actual ) {\n\t\tif ( !config.current ) {\n\t\t\tthrow new Error( \"pushFailure() assertion outside test context, was \" + sourceFromStacktrace(2) );\n\t\t}\n\n\t\tvar output,\n\t\t\tdetails = {\n\t\t\t\tmodule: config.current.module,\n\t\t\t\tname: config.current.testName,\n\t\t\t\tresult: false,\n\t\t\t\tmessage: message\n\t\t\t};\n\n\t\tmessage = escapeText( message ) || \"error\";\n\t\tmessage = \"<span class='test-message'>\" + message + \"</span>\";\n\t\toutput = message;\n\n\t\toutput += \"<table>\";\n\n\t\tif ( actual ) {\n\t\t\toutput += \"<tr class='test-actual'><th>Result: </th><td><pre>\" + escapeText( actual ) + \"</pre></td></tr>\";\n\t\t}\n\n\t\tif ( source ) {\n\t\t\tdetails.source = source;\n\t\t\toutput += \"<tr class='test-source'><th>Source: </th><td><pre>\" + escapeText( source ) + \"</pre></td></tr>\";\n\t\t}\n\n\t\toutput += \"</table>\";\n\n\t\trunLoggingCallbacks( \"log\", QUnit, details );\n\n\t\tconfig.current.assertions.push({\n\t\t\tresult: false,\n\t\t\tmessage: output\n\t\t});\n\t},\n\n\turl: function( params ) {\n\t\tparams = extend( extend( {}, QUnit.urlParams ), params );\n\t\tvar key,\n\t\t\tquerystring = \"?\";\n\n\t\tfor ( key in params ) {\n\t\t\tif ( !hasOwn.call( params, key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tquerystring += encodeURIComponent( key ) + \"=\" +\n\t\t\t\tencodeURIComponent( params[ key ] ) + \"&\";\n\t\t}\n\t\treturn window.location.protocol + \"//\" + window.location.host +\n\t\t\twindow.location.pathname + querystring.slice( 0, -1 );\n\t},\n\n\textend: extend,\n\tid: id,\n\taddEvent: addEvent\n\t// load, equiv, jsDump, diff: Attached later\n});\n\n/**\n * @deprecated: Created for backwards compatibility with test runner that set the hook function\n * into QUnit.{hook}, instead of invoking it and passing the hook function.\n * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.\n * Doing this allows us to tell if the following methods have been overwritten on the actual\n * QUnit object.\n */\nextend( QUnit.constructor.prototype, {\n\n\t// Logging callbacks; all receive a single argument with the listed properties\n\t// run test/logs.html for any related changes\n\tbegin: registerLoggingCallback( \"begin\" ),\n\n\t// done: { failed, passed, total, runtime }\n\tdone: registerLoggingCallback( \"done\" ),\n\n\t// log: { result, actual, expected, message }\n\tlog: registerLoggingCallback( \"log\" ),\n\n\t// testStart: { name }\n\ttestStart: registerLoggingCallback( \"testStart\" ),\n\n\t// testDone: { name, failed, passed, total, duration }\n\ttestDone: registerLoggingCallback( \"testDone\" ),\n\n\t// moduleStart: { name }\n\tmoduleStart: registerLoggingCallback( \"moduleStart\" ),\n\n\t// moduleDone: { name, failed, passed, total }\n\tmoduleDone: registerLoggingCallback( \"moduleDone\" )\n});\n\nif ( typeof document === \"undefined\" || document.readyState === \"complete\" ) {\n\tconfig.autorun = true;\n}\n\nQUnit.load = function() {\n\trunLoggingCallbacks( \"begin\", QUnit, {} );\n\n\t// Initialize the config, saving the execution queue\n\tvar banner, filter, i, label, len, main, ol, toolbar, userAgent, val,\n\t\turlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter,\n\t\tnumModules = 0,\n\t\tmoduleFilterHtml = \"\",\n\t\turlConfigHtml = \"\",\n\t\toldconfig = extend( {}, config );\n\n\tQUnit.init();\n\textend(config, oldconfig);\n\n\tconfig.blocking = false;\n\n\tlen = config.urlConfig.length;\n\n\tfor ( i = 0; i < len; i++ ) {\n\t\tval = config.urlConfig[i];\n\t\tif ( typeof val === \"string\" ) {\n\t\t\tval = {\n\t\t\t\tid: val,\n\t\t\t\tlabel: val,\n\t\t\t\ttooltip: \"[no tooltip available]\"\n\t\t\t};\n\t\t}\n\t\tconfig[ val.id ] = QUnit.urlParams[ val.id ];\n\t\turlConfigHtml += \"<input id='qunit-urlconfig-\" + escapeText( val.id ) +\n\t\t\t\"' name='\" + escapeText( val.id ) +\n\t\t\t\"' type='checkbox'\" + ( config[ val.id ] ? \" checked='checked'\" : \"\" ) +\n\t\t\t\" title='\" + escapeText( val.tooltip ) +\n\t\t\t\"'><label for='qunit-urlconfig-\" + escapeText( val.id ) +\n\t\t\t\"' title='\" + escapeText( val.tooltip ) + \"'>\" + val.label + \"</label>\";\n\t}\n\n\tmoduleFilterHtml += \"<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' \" +\n\t\t( config.module === undefined  ? \"selected='selected'\" : \"\" ) +\n\t\t\">< All Modules ></option>\";\n\n\tfor ( i in config.modules ) {\n\t\tif ( config.modules.hasOwnProperty( i ) ) {\n\t\t\tnumModules += 1;\n\t\t\tmoduleFilterHtml += \"<option value='\" + escapeText( encodeURIComponent(i) ) + \"' \" +\n\t\t\t\t( config.module === i ? \"selected='selected'\" : \"\" ) +\n\t\t\t\t\">\" + escapeText(i) + \"</option>\";\n\t\t}\n\t}\n\tmoduleFilterHtml += \"</select>\";\n\n\t// `userAgent` initialized at top of scope\n\tuserAgent = id( \"qunit-userAgent\" );\n\tif ( userAgent ) {\n\t\tuserAgent.innerHTML = navigator.userAgent;\n\t}\n\n\t// `banner` initialized at top of scope\n\tbanner = id( \"qunit-header\" );\n\tif ( banner ) {\n\t\tbanner.innerHTML = \"<a href='\" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + \"'>\" + banner.innerHTML + \"</a> \";\n\t}\n\n\t// `toolbar` initialized at top of scope\n\ttoolbar = id( \"qunit-testrunner-toolbar\" );\n\tif ( toolbar ) {\n\t\t// `filter` initialized at top of scope\n\t\tfilter = document.createElement( \"input\" );\n\t\tfilter.type = \"checkbox\";\n\t\tfilter.id = \"qunit-filter-pass\";\n\n\t\taddEvent( filter, \"click\", function() {\n\t\t\tvar tmp,\n\t\t\t\tol = document.getElementById( \"qunit-tests\" );\n\n\t\t\tif ( filter.checked ) {\n\t\t\t\tol.className = ol.className + \" hidepass\";\n\t\t\t} else {\n\t\t\t\ttmp = \" \" + ol.className.replace( /[\\n\\t\\r]/g, \" \" ) + \" \";\n\t\t\t\tol.className = tmp.replace( / hidepass /, \" \" );\n\t\t\t}\n\t\t\tif ( defined.sessionStorage ) {\n\t\t\t\tif (filter.checked) {\n\t\t\t\t\tsessionStorage.setItem( \"qunit-filter-passed-tests\", \"true\" );\n\t\t\t\t} else {\n\t\t\t\t\tsessionStorage.removeItem( \"qunit-filter-passed-tests\" );\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( \"qunit-filter-passed-tests\" ) ) {\n\t\t\tfilter.checked = true;\n\t\t\t// `ol` initialized at top of scope\n\t\t\tol = document.getElementById( \"qunit-tests\" );\n\t\t\tol.className = ol.className + \" hidepass\";\n\t\t}\n\t\ttoolbar.appendChild( filter );\n\n\t\t// `label` initialized at top of scope\n\t\tlabel = document.createElement( \"label\" );\n\t\tlabel.setAttribute( \"for\", \"qunit-filter-pass\" );\n\t\tlabel.setAttribute( \"title\", \"Only show tests and assertons that fail. Stored in sessionStorage.\" );\n\t\tlabel.innerHTML = \"Hide passed tests\";\n\t\ttoolbar.appendChild( label );\n\n\t\turlConfigCheckboxesContainer = document.createElement(\"span\");\n\t\turlConfigCheckboxesContainer.innerHTML = urlConfigHtml;\n\t\turlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName(\"input\");\n\t\t// For oldIE support:\n\t\t// * Add handlers to the individual elements instead of the container\n\t\t// * Use \"click\" instead of \"change\"\n\t\t// * Fallback from event.target to event.srcElement\n\t\taddEvents( urlConfigCheckboxes, \"click\", function( event ) {\n\t\t\tvar params = {},\n\t\t\t\ttarget = event.target || event.srcElement;\n\t\t\tparams[ target.name ] = target.checked ? true : undefined;\n\t\t\twindow.location = QUnit.url( params );\n\t\t});\n\t\ttoolbar.appendChild( urlConfigCheckboxesContainer );\n\n\t\tif (numModules > 1) {\n\t\t\tmoduleFilter = document.createElement( 'span' );\n\t\t\tmoduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' );\n\t\t\tmoduleFilter.innerHTML = moduleFilterHtml;\n\t\t\taddEvent( moduleFilter.lastChild, \"change\", function() {\n\t\t\t\tvar selectBox = moduleFilter.getElementsByTagName(\"select\")[0],\n\t\t\t\t\tselectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);\n\n\t\t\t\twindow.location = QUnit.url( { module: ( selectedModule === \"\" ) ? undefined : selectedModule } );\n\t\t\t});\n\t\t\ttoolbar.appendChild(moduleFilter);\n\t\t}\n\t}\n\n\t// `main` initialized at top of scope\n\tmain = id( \"qunit-fixture\" );\n\tif ( main ) {\n\t\tconfig.fixture = main.innerHTML;\n\t}\n\n\tif ( config.autostart ) {\n\t\tQUnit.start();\n\t}\n};\n\naddEvent( window, \"load\", QUnit.load );\n\n// `onErrorFnPrev` initialized at top of scope\n// Preserve other handlers\nonErrorFnPrev = window.onerror;\n\n// Cover uncaught exceptions\n// Returning true will surpress the default browser handler,\n// returning false will let it run.\nwindow.onerror = function ( error, filePath, linerNr ) {\n\tvar ret = false;\n\tif ( onErrorFnPrev ) {\n\t\tret = onErrorFnPrev( error, filePath, linerNr );\n\t}\n\n\t// Treat return value as window.onerror itself does,\n\t// Only do our handling if not surpressed.\n\tif ( ret !== true ) {\n\t\tif ( QUnit.config.current ) {\n\t\t\tif ( QUnit.config.current.ignoreGlobalErrors ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tQUnit.pushFailure( error, filePath + \":\" + linerNr );\n\t\t} else {\n\t\t\tQUnit.test( \"global failure\", extend( function() {\n\t\t\t\tQUnit.pushFailure( error, filePath + \":\" + linerNr );\n\t\t\t}, { validTest: validTest } ) );\n\t\t}\n\t\treturn false;\n\t}\n\n\treturn ret;\n};\n\nfunction done() {\n\tconfig.autorun = true;\n\n\t// Log the last module results\n\tif ( config.currentModule ) {\n\t\trunLoggingCallbacks( \"moduleDone\", QUnit, {\n\t\t\tname: config.currentModule,\n\t\t\tfailed: config.moduleStats.bad,\n\t\t\tpassed: config.moduleStats.all - config.moduleStats.bad,\n\t\t\ttotal: config.moduleStats.all\n\t\t});\n\t}\n\n\tvar i, key,\n\t\tbanner = id( \"qunit-banner\" ),\n\t\ttests = id( \"qunit-tests\" ),\n\t\truntime = +new Date() - config.started,\n\t\tpassed = config.stats.all - config.stats.bad,\n\t\thtml = [\n\t\t\t\"Tests completed in \",\n\t\t\truntime,\n\t\t\t\" milliseconds.<br/>\",\n\t\t\t\"<span class='passed'>\",\n\t\t\tpassed,\n\t\t\t\"</span> assertions of <span class='total'>\",\n\t\t\tconfig.stats.all,\n\t\t\t\"</span> passed, <span class='failed'>\",\n\t\t\tconfig.stats.bad,\n\t\t\t\"</span> failed.\"\n\t\t].join( \"\" );\n\n\tif ( banner ) {\n\t\tbanner.className = ( config.stats.bad ? \"qunit-fail\" : \"qunit-pass\" );\n\t}\n\n\tif ( tests ) {\n\t\tid( \"qunit-testresult\" ).innerHTML = html;\n\t}\n\n\tif ( config.altertitle && typeof document !== \"undefined\" && document.title ) {\n\t\t// show ✖ for good, ✔ for bad suite result in title\n\t\t// use escape sequences in case file gets loaded with non-utf-8-charset\n\t\tdocument.title = [\n\t\t\t( config.stats.bad ? \"\\u2716\" : \"\\u2714\" ),\n\t\t\tdocument.title.replace( /^[\\u2714\\u2716] /i, \"\" )\n\t\t].join( \" \" );\n\t}\n\n\t// clear own sessionStorage items if all tests passed\n\tif ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) {\n\t\t// `key` & `i` initialized at top of scope\n\t\tfor ( i = 0; i < sessionStorage.length; i++ ) {\n\t\t\tkey = sessionStorage.key( i++ );\n\t\t\tif ( key.indexOf( \"qunit-test-\" ) === 0 ) {\n\t\t\t\tsessionStorage.removeItem( key );\n\t\t\t}\n\t\t}\n\t}\n\n\t// scroll back to top to show results\n\tif ( window.scrollTo ) {\n\t\twindow.scrollTo(0, 0);\n\t}\n\n\trunLoggingCallbacks( \"done\", QUnit, {\n\t\tfailed: config.stats.bad,\n\t\tpassed: passed,\n\t\ttotal: config.stats.all,\n\t\truntime: runtime\n\t});\n}\n\n/** @return Boolean: true if this test should be ran */\nfunction validTest( test ) {\n\tvar include,\n\t\tfilter = config.filter && config.filter.toLowerCase(),\n\t\tmodule = config.module && config.module.toLowerCase(),\n\t\tfullName = (test.module + \": \" + test.testName).toLowerCase();\n\n\t// Internally-generated tests are always valid\n\tif ( test.callback && test.callback.validTest === validTest ) {\n\t\tdelete test.callback.validTest;\n\t\treturn true;\n\t}\n\n\tif ( config.testNumber ) {\n\t\treturn test.testNumber === config.testNumber;\n\t}\n\n\tif ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {\n\t\treturn false;\n\t}\n\n\tif ( !filter ) {\n\t\treturn true;\n\t}\n\n\tinclude = filter.charAt( 0 ) !== \"!\";\n\tif ( !include ) {\n\t\tfilter = filter.slice( 1 );\n\t}\n\n\t// If the filter matches, we need to honour include\n\tif ( fullName.indexOf( filter ) !== -1 ) {\n\t\treturn include;\n\t}\n\n\t// Otherwise, do the opposite\n\treturn !include;\n}\n\n// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)\n// Later Safari and IE10 are supposed to support error.stack as well\n// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack\nfunction extractStacktrace( e, offset ) {\n\toffset = offset === undefined ? 3 : offset;\n\n\tvar stack, include, i;\n\n\tif ( e.stacktrace ) {\n\t\t// Opera\n\t\treturn e.stacktrace.split( \"\\n\" )[ offset + 3 ];\n\t} else if ( e.stack ) {\n\t\t// Firefox, Chrome\n\t\tstack = e.stack.split( \"\\n\" );\n\t\tif (/^error$/i.test( stack[0] ) ) {\n\t\t\tstack.shift();\n\t\t}\n\t\tif ( fileName ) {\n\t\t\tinclude = [];\n\t\t\tfor ( i = offset; i < stack.length; i++ ) {\n\t\t\t\tif ( stack[ i ].indexOf( fileName ) !== -1 ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tinclude.push( stack[ i ] );\n\t\t\t}\n\t\t\tif ( include.length ) {\n\t\t\t\treturn include.join( \"\\n\" );\n\t\t\t}\n\t\t}\n\t\treturn stack[ offset ];\n\t} else if ( e.sourceURL ) {\n\t\t// Safari, PhantomJS\n\t\t// hopefully one day Safari provides actual stacktraces\n\t\t// exclude useless self-reference for generated Error objects\n\t\tif ( /qunit.js$/.test( e.sourceURL ) ) {\n\t\t\treturn;\n\t\t}\n\t\t// for actual exceptions, this is useful\n\t\treturn e.sourceURL + \":\" + e.line;\n\t}\n}\nfunction sourceFromStacktrace( offset ) {\n\ttry {\n\t\tthrow new Error();\n\t} catch ( e ) {\n\t\treturn extractStacktrace( e, offset );\n\t}\n}\n\n/**\n * Escape text for attribute or text content.\n */\nfunction escapeText( s ) {\n\tif ( !s ) {\n\t\treturn \"\";\n\t}\n\ts = s + \"\";\n\t// Both single quotes and double quotes (for attributes)\n\treturn s.replace( /['\"<>&]/g, function( s ) {\n\t\tswitch( s ) {\n\t\t\tcase '\\'':\n\t\t\t\treturn '&#039;';\n\t\t\tcase '\"':\n\t\t\t\treturn '&quot;';\n\t\t\tcase '<':\n\t\t\t\treturn '&lt;';\n\t\t\tcase '>':\n\t\t\t\treturn '&gt;';\n\t\t\tcase '&':\n\t\t\t\treturn '&amp;';\n\t\t}\n\t});\n}\n\nfunction synchronize( callback, last ) {\n\tconfig.queue.push( callback );\n\n\tif ( config.autorun && !config.blocking ) {\n\t\tprocess( last );\n\t}\n}\n\nfunction process( last ) {\n\tfunction next() {\n\t\tprocess( last );\n\t}\n\tvar start = new Date().getTime();\n\tconfig.depth = config.depth ? config.depth + 1 : 1;\n\n\twhile ( config.queue.length && !config.blocking ) {\n\t\tif ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {\n\t\t\tconfig.queue.shift()();\n\t\t} else {\n\t\t\twindow.setTimeout( next, 13 );\n\t\t\tbreak;\n\t\t}\n\t}\n\tconfig.depth--;\n\tif ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {\n\t\tdone();\n\t}\n}\n\nfunction saveGlobal() {\n\tconfig.pollution = [];\n\n\tif ( config.noglobals ) {\n\t\tfor ( var key in window ) {\n\t\t\t// in Opera sometimes DOM element ids show up here, ignore them\n\t\t\tif ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconfig.pollution.push( key );\n\t\t}\n\t}\n}\n\nfunction checkPollution() {\n\tvar newGlobals,\n\t\tdeletedGlobals,\n\t\told = config.pollution;\n\n\tsaveGlobal();\n\n\tnewGlobals = diff( config.pollution, old );\n\tif ( newGlobals.length > 0 ) {\n\t\tQUnit.pushFailure( \"Introduced global variable(s): \" + newGlobals.join(\", \") );\n\t}\n\n\tdeletedGlobals = diff( old, config.pollution );\n\tif ( deletedGlobals.length > 0 ) {\n\t\tQUnit.pushFailure( \"Deleted global variable(s): \" + deletedGlobals.join(\", \") );\n\t}\n}\n\n// returns a new Array with the elements that are in a but not in b\nfunction diff( a, b ) {\n\tvar i, j,\n\t\tresult = a.slice();\n\n\tfor ( i = 0; i < result.length; i++ ) {\n\t\tfor ( j = 0; j < b.length; j++ ) {\n\t\t\tif ( result[i] === b[j] ) {\n\t\t\t\tresult.splice( i, 1 );\n\t\t\t\ti--;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction extend( a, b ) {\n\tfor ( var prop in b ) {\n\t\tif ( b[ prop ] === undefined ) {\n\t\t\tdelete a[ prop ];\n\n\t\t// Avoid \"Member not found\" error in IE8 caused by setting window.constructor\n\t\t} else if ( prop !== \"constructor\" || a !== window ) {\n\t\t\ta[ prop ] = b[ prop ];\n\t\t}\n\t}\n\n\treturn a;\n}\n\n/**\n * @param {HTMLElement} elem\n * @param {string} type\n * @param {Function} fn\n */\nfunction addEvent( elem, type, fn ) {\n\t// Standards-based browsers\n\tif ( elem.addEventListener ) {\n\t\telem.addEventListener( type, fn, false );\n\t// IE\n\t} else {\n\t\telem.attachEvent( \"on\" + type, fn );\n\t}\n}\n\n/**\n * @param {Array|NodeList} elems\n * @param {string} type\n * @param {Function} fn\n */\nfunction addEvents( elems, type, fn ) {\n\tvar i = elems.length;\n\twhile ( i-- ) {\n\t\taddEvent( elems[i], type, fn );\n\t}\n}\n\nfunction hasClass( elem, name ) {\n\treturn (\" \" + elem.className + \" \").indexOf(\" \" + name + \" \") > -1;\n}\n\nfunction addClass( elem, name ) {\n\tif ( !hasClass( elem, name ) ) {\n\t\telem.className += (elem.className ? \" \" : \"\") + name;\n\t}\n}\n\nfunction removeClass( elem, name ) {\n\tvar set = \" \" + elem.className + \" \";\n\t// Class name may appear multiple times\n\twhile ( set.indexOf(\" \" + name + \" \") > -1 ) {\n\t\tset = set.replace(\" \" + name + \" \" , \" \");\n\t}\n\t// If possible, trim it for prettiness, but not neccecarily\n\telem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set );\n}\n\nfunction id( name ) {\n\treturn !!( typeof document !== \"undefined\" && document && document.getElementById ) &&\n\t\tdocument.getElementById( name );\n}\n\nfunction registerLoggingCallback( key ) {\n\treturn function( callback ) {\n\t\tconfig[key].push( callback );\n\t};\n}\n\n// Supports deprecated method of completely overwriting logging callbacks\nfunction runLoggingCallbacks( key, scope, args ) {\n\tvar i, callbacks;\n\tif ( QUnit.hasOwnProperty( key ) ) {\n\t\tQUnit[ key ].call(scope, args );\n\t} else {\n\t\tcallbacks = config[ key ];\n\t\tfor ( i = 0; i < callbacks.length; i++ ) {\n\t\t\tcallbacks[ i ].call( scope, args );\n\t\t}\n\t}\n}\n\n// Test for equality any JavaScript type.\n// Author: Philippe Rathé <prathe@gmail.com>\nQUnit.equiv = (function() {\n\n\t// Call the o related callback with the given arguments.\n\tfunction bindCallbacks( o, callbacks, args ) {\n\t\tvar prop = QUnit.objectType( o );\n\t\tif ( prop ) {\n\t\t\tif ( QUnit.objectType( callbacks[ prop ] ) === \"function\" ) {\n\t\t\t\treturn callbacks[ prop ].apply( callbacks, args );\n\t\t\t} else {\n\t\t\t\treturn callbacks[ prop ]; // or undefined\n\t\t\t}\n\t\t}\n\t}\n\n\t// the real equiv function\n\tvar innerEquiv,\n\t\t// stack to decide between skip/abort functions\n\t\tcallers = [],\n\t\t// stack to avoiding loops from circular referencing\n\t\tparents = [],\n\n\t\tgetProto = Object.getPrototypeOf || function ( obj ) {\n\t\t\treturn obj.__proto__;\n\t\t},\n\t\tcallbacks = (function () {\n\n\t\t\t// for string, boolean, number and null\n\t\t\tfunction useStrictEquality( b, a ) {\n\t\t\t\t/*jshint eqeqeq:false */\n\t\t\t\tif ( b instanceof a.constructor || a instanceof b.constructor ) {\n\t\t\t\t\t// to catch short annotaion VS 'new' annotation of a\n\t\t\t\t\t// declaration\n\t\t\t\t\t// e.g. var i = 1;\n\t\t\t\t\t// var j = new Number(1);\n\t\t\t\t\treturn a == b;\n\t\t\t\t} else {\n\t\t\t\t\treturn a === b;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t\"string\": useStrictEquality,\n\t\t\t\t\"boolean\": useStrictEquality,\n\t\t\t\t\"number\": useStrictEquality,\n\t\t\t\t\"null\": useStrictEquality,\n\t\t\t\t\"undefined\": useStrictEquality,\n\n\t\t\t\t\"nan\": function( b ) {\n\t\t\t\t\treturn isNaN( b );\n\t\t\t\t},\n\n\t\t\t\t\"date\": function( b, a ) {\n\t\t\t\t\treturn QUnit.objectType( b ) === \"date\" && a.valueOf() === b.valueOf();\n\t\t\t\t},\n\n\t\t\t\t\"regexp\": function( b, a ) {\n\t\t\t\t\treturn QUnit.objectType( b ) === \"regexp\" &&\n\t\t\t\t\t\t// the regex itself\n\t\t\t\t\t\ta.source === b.source &&\n\t\t\t\t\t\t// and its modifers\n\t\t\t\t\t\ta.global === b.global &&\n\t\t\t\t\t\t// (gmi) ...\n\t\t\t\t\t\ta.ignoreCase === b.ignoreCase &&\n\t\t\t\t\t\ta.multiline === b.multiline &&\n\t\t\t\t\t\ta.sticky === b.sticky;\n\t\t\t\t},\n\n\t\t\t\t// - skip when the property is a method of an instance (OOP)\n\t\t\t\t// - abort otherwise,\n\t\t\t\t// initial === would have catch identical references anyway\n\t\t\t\t\"function\": function() {\n\t\t\t\t\tvar caller = callers[callers.length - 1];\n\t\t\t\t\treturn caller !== Object && typeof caller !== \"undefined\";\n\t\t\t\t},\n\n\t\t\t\t\"array\": function( b, a ) {\n\t\t\t\t\tvar i, j, len, loop;\n\n\t\t\t\t\t// b could be an object literal here\n\t\t\t\t\tif ( QUnit.objectType( b ) !== \"array\" ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tlen = a.length;\n\t\t\t\t\tif ( len !== b.length ) {\n\t\t\t\t\t\t// safe and faster\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// track reference to avoid circular references\n\t\t\t\t\tparents.push( a );\n\t\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\t\tloop = false;\n\t\t\t\t\t\tfor ( j = 0; j < parents.length; j++ ) {\n\t\t\t\t\t\t\tif ( parents[j] === a[i] ) {\n\t\t\t\t\t\t\t\tloop = true;// dont rewalk array\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( !loop && !innerEquiv(a[i], b[i]) ) {\n\t\t\t\t\t\t\tparents.pop();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tparents.pop();\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\n\t\t\t\t\"object\": function( b, a ) {\n\t\t\t\t\tvar i, j, loop,\n\t\t\t\t\t\t// Default to true\n\t\t\t\t\t\teq = true,\n\t\t\t\t\t\taProperties = [],\n\t\t\t\t\t\tbProperties = [];\n\n\t\t\t\t\t// comparing constructors is more strict than using\n\t\t\t\t\t// instanceof\n\t\t\t\t\tif ( a.constructor !== b.constructor ) {\n\t\t\t\t\t\t// Allow objects with no prototype to be equivalent to\n\t\t\t\t\t\t// objects with Object as their constructor.\n\t\t\t\t\t\tif ( !(( getProto(a) === null && getProto(b) === Object.prototype ) ||\n\t\t\t\t\t\t\t( getProto(b) === null && getProto(a) === Object.prototype ) ) ) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// stack constructor before traversing properties\n\t\t\t\t\tcallers.push( a.constructor );\n\t\t\t\t\t// track reference to avoid circular references\n\t\t\t\t\tparents.push( a );\n\n\t\t\t\t\tfor ( i in a ) { // be strict: don't ensures hasOwnProperty\n\t\t\t\t\t\t\t\t\t// and go deep\n\t\t\t\t\t\tloop = false;\n\t\t\t\t\t\tfor ( j = 0; j < parents.length; j++ ) {\n\t\t\t\t\t\t\tif ( parents[j] === a[i] ) {\n\t\t\t\t\t\t\t\t// don't go down the same path twice\n\t\t\t\t\t\t\t\tloop = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\taProperties.push(i); // collect a's properties\n\n\t\t\t\t\t\tif (!loop && !innerEquiv( a[i], b[i] ) ) {\n\t\t\t\t\t\t\teq = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcallers.pop(); // unstack, we are done\n\t\t\t\t\tparents.pop();\n\n\t\t\t\t\tfor ( i in b ) {\n\t\t\t\t\t\tbProperties.push( i ); // collect b's properties\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ensures identical properties name\n\t\t\t\t\treturn eq && innerEquiv( aProperties.sort(), bProperties.sort() );\n\t\t\t\t}\n\t\t\t};\n\t\t}());\n\n\tinnerEquiv = function() { // can take multiple arguments\n\t\tvar args = [].slice.apply( arguments );\n\t\tif ( args.length < 2 ) {\n\t\t\treturn true; // end transition\n\t\t}\n\n\t\treturn (function( a, b ) {\n\t\t\tif ( a === b ) {\n\t\t\t\treturn true; // catch the most you can\n\t\t\t} else if ( a === null || b === null || typeof a === \"undefined\" ||\n\t\t\t\t\ttypeof b === \"undefined\" ||\n\t\t\t\t\tQUnit.objectType(a) !== QUnit.objectType(b) ) {\n\t\t\t\treturn false; // don't lose time with error prone cases\n\t\t\t} else {\n\t\t\t\treturn bindCallbacks(a, callbacks, [ b, a ]);\n\t\t\t}\n\n\t\t\t// apply transition with (1..n) arguments\n\t\t}( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) );\n\t};\n\n\treturn innerEquiv;\n}());\n\n/**\n * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |\n * http://flesler.blogspot.com Licensed under BSD\n * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008\n *\n * @projectDescription Advanced and extensible data dumping for Javascript.\n * @version 1.0.0\n * @author Ariel Flesler\n * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}\n */\nQUnit.jsDump = (function() {\n\tfunction quote( str ) {\n\t\treturn '\"' + str.toString().replace( /\"/g, '\\\\\"' ) + '\"';\n\t}\n\tfunction literal( o ) {\n\t\treturn o + \"\";\n\t}\n\tfunction join( pre, arr, post ) {\n\t\tvar s = jsDump.separator(),\n\t\t\tbase = jsDump.indent(),\n\t\t\tinner = jsDump.indent(1);\n\t\tif ( arr.join ) {\n\t\t\tarr = arr.join( \",\" + s + inner );\n\t\t}\n\t\tif ( !arr ) {\n\t\t\treturn pre + post;\n\t\t}\n\t\treturn [ pre, inner + arr, base + post ].join(s);\n\t}\n\tfunction array( arr, stack ) {\n\t\tvar i = arr.length, ret = new Array(i);\n\t\tthis.up();\n\t\twhile ( i-- ) {\n\t\t\tret[i] = this.parse( arr[i] , undefined , stack);\n\t\t}\n\t\tthis.down();\n\t\treturn join( \"[\", ret, \"]\" );\n\t}\n\n\tvar reName = /^function (\\w+)/,\n\t\tjsDump = {\n\t\t\t// type is used mostly internally, you can fix a (custom)type in advance\n\t\t\tparse: function( obj, type, stack ) {\n\t\t\t\tstack = stack || [ ];\n\t\t\t\tvar inStack, res,\n\t\t\t\t\tparser = this.parsers[ type || this.typeOf(obj) ];\n\n\t\t\t\ttype = typeof parser;\n\t\t\t\tinStack = inArray( obj, stack );\n\n\t\t\t\tif ( inStack !== -1 ) {\n\t\t\t\t\treturn \"recursion(\" + (inStack - stack.length) + \")\";\n\t\t\t\t}\n\t\t\t\tif ( type === \"function\" )  {\n\t\t\t\t\tstack.push( obj );\n\t\t\t\t\tres = parser.call( this, obj, stack );\n\t\t\t\t\tstack.pop();\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t\treturn ( type === \"string\" ) ? parser : this.parsers.error;\n\t\t\t},\n\t\t\ttypeOf: function( obj ) {\n\t\t\t\tvar type;\n\t\t\t\tif ( obj === null ) {\n\t\t\t\t\ttype = \"null\";\n\t\t\t\t} else if ( typeof obj === \"undefined\" ) {\n\t\t\t\t\ttype = \"undefined\";\n\t\t\t\t} else if ( QUnit.is( \"regexp\", obj) ) {\n\t\t\t\t\ttype = \"regexp\";\n\t\t\t\t} else if ( QUnit.is( \"date\", obj) ) {\n\t\t\t\t\ttype = \"date\";\n\t\t\t\t} else if ( QUnit.is( \"function\", obj) ) {\n\t\t\t\t\ttype = \"function\";\n\t\t\t\t} else if ( typeof obj.setInterval !== undefined && typeof obj.document !== \"undefined\" && typeof obj.nodeType === \"undefined\" ) {\n\t\t\t\t\ttype = \"window\";\n\t\t\t\t} else if ( obj.nodeType === 9 ) {\n\t\t\t\t\ttype = \"document\";\n\t\t\t\t} else if ( obj.nodeType ) {\n\t\t\t\t\ttype = \"node\";\n\t\t\t\t} else if (\n\t\t\t\t\t// native arrays\n\t\t\t\t\ttoString.call( obj ) === \"[object Array]\" ||\n\t\t\t\t\t// NodeList objects\n\t\t\t\t\t( typeof obj.length === \"number\" && typeof obj.item !== \"undefined\" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === \"undefined\" ) ) )\n\t\t\t\t) {\n\t\t\t\t\ttype = \"array\";\n\t\t\t\t} else if ( obj.constructor === Error.prototype.constructor ) {\n\t\t\t\t\ttype = \"error\";\n\t\t\t\t} else {\n\t\t\t\t\ttype = typeof obj;\n\t\t\t\t}\n\t\t\t\treturn type;\n\t\t\t},\n\t\t\tseparator: function() {\n\t\t\t\treturn this.multiline ?\tthis.HTML ? \"<br />\" : \"\\n\" : this.HTML ? \"&nbsp;\" : \" \";\n\t\t\t},\n\t\t\t// extra can be a number, shortcut for increasing-calling-decreasing\n\t\t\tindent: function( extra ) {\n\t\t\t\tif ( !this.multiline ) {\n\t\t\t\t\treturn \"\";\n\t\t\t\t}\n\t\t\t\tvar chr = this.indentChar;\n\t\t\t\tif ( this.HTML ) {\n\t\t\t\t\tchr = chr.replace( /\\t/g, \"   \" ).replace( / /g, \"&nbsp;\" );\n\t\t\t\t}\n\t\t\t\treturn new Array( this._depth_ + (extra||0) ).join(chr);\n\t\t\t},\n\t\t\tup: function( a ) {\n\t\t\t\tthis._depth_ += a || 1;\n\t\t\t},\n\t\t\tdown: function( a ) {\n\t\t\t\tthis._depth_ -= a || 1;\n\t\t\t},\n\t\t\tsetParser: function( name, parser ) {\n\t\t\t\tthis.parsers[name] = parser;\n\t\t\t},\n\t\t\t// The next 3 are exposed so you can use them\n\t\t\tquote: quote,\n\t\t\tliteral: literal,\n\t\t\tjoin: join,\n\t\t\t//\n\t\t\t_depth_: 1,\n\t\t\t// This is the list of parsers, to modify them, use jsDump.setParser\n\t\t\tparsers: {\n\t\t\t\twindow: \"[Window]\",\n\t\t\t\tdocument: \"[Document]\",\n\t\t\t\terror: function(error) {\n\t\t\t\t\treturn \"Error(\\\"\" + error.message + \"\\\")\";\n\t\t\t\t},\n\t\t\t\tunknown: \"[Unknown]\",\n\t\t\t\t\"null\": \"null\",\n\t\t\t\t\"undefined\": \"undefined\",\n\t\t\t\t\"function\": function( fn ) {\n\t\t\t\t\tvar ret = \"function\",\n\t\t\t\t\t\t// functions never have name in IE\n\t\t\t\t\t\tname = \"name\" in fn ? fn.name : (reName.exec(fn) || [])[1];\n\n\t\t\t\t\tif ( name ) {\n\t\t\t\t\t\tret += \" \" + name;\n\t\t\t\t\t}\n\t\t\t\t\tret += \"( \";\n\n\t\t\t\t\tret = [ ret, QUnit.jsDump.parse( fn, \"functionArgs\" ), \"){\" ].join( \"\" );\n\t\t\t\t\treturn join( ret, QUnit.jsDump.parse(fn,\"functionCode\" ), \"}\" );\n\t\t\t\t},\n\t\t\t\tarray: array,\n\t\t\t\tnodelist: array,\n\t\t\t\t\"arguments\": array,\n\t\t\t\tobject: function( map, stack ) {\n\t\t\t\t\tvar ret = [ ], keys, key, val, i;\n\t\t\t\t\tQUnit.jsDump.up();\n\t\t\t\t\tkeys = [];\n\t\t\t\t\tfor ( key in map ) {\n\t\t\t\t\t\tkeys.push( key );\n\t\t\t\t\t}\n\t\t\t\t\tkeys.sort();\n\t\t\t\t\tfor ( i = 0; i < keys.length; i++ ) {\n\t\t\t\t\t\tkey = keys[ i ];\n\t\t\t\t\t\tval = map[ key ];\n\t\t\t\t\t\tret.push( QUnit.jsDump.parse( key, \"key\" ) + \": \" + QUnit.jsDump.parse( val, undefined, stack ) );\n\t\t\t\t\t}\n\t\t\t\t\tQUnit.jsDump.down();\n\t\t\t\t\treturn join( \"{\", ret, \"}\" );\n\t\t\t\t},\n\t\t\t\tnode: function( node ) {\n\t\t\t\t\tvar len, i, val,\n\t\t\t\t\t\topen = QUnit.jsDump.HTML ? \"&lt;\" : \"<\",\n\t\t\t\t\t\tclose = QUnit.jsDump.HTML ? \"&gt;\" : \">\",\n\t\t\t\t\t\ttag = node.nodeName.toLowerCase(),\n\t\t\t\t\t\tret = open + tag,\n\t\t\t\t\t\tattrs = node.attributes;\n\n\t\t\t\t\tif ( attrs ) {\n\t\t\t\t\t\tfor ( i = 0, len = attrs.length; i < len; i++ ) {\n\t\t\t\t\t\t\tval = attrs[i].nodeValue;\n\t\t\t\t\t\t\t// IE6 includes all attributes in .attributes, even ones not explicitly set.\n\t\t\t\t\t\t\t// Those have values like undefined, null, 0, false, \"\" or \"inherit\".\n\t\t\t\t\t\t\tif ( val && val !== \"inherit\" ) {\n\t\t\t\t\t\t\t\tret += \" \" + attrs[i].nodeName + \"=\" + QUnit.jsDump.parse( val, \"attribute\" );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tret += close;\n\n\t\t\t\t\t// Show content of TextNode or CDATASection\n\t\t\t\t\tif ( node.nodeType === 3 || node.nodeType === 4 ) {\n\t\t\t\t\t\tret += node.nodeValue;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn ret + open + \"/\" + tag + close;\n\t\t\t\t},\n\t\t\t\t// function calls it internally, it's the arguments part of the function\n\t\t\t\tfunctionArgs: function( fn ) {\n\t\t\t\t\tvar args,\n\t\t\t\t\t\tl = fn.length;\n\n\t\t\t\t\tif ( !l ) {\n\t\t\t\t\t\treturn \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\targs = new Array(l);\n\t\t\t\t\twhile ( l-- ) {\n\t\t\t\t\t\t// 97 is 'a'\n\t\t\t\t\t\targs[l] = String.fromCharCode(97+l);\n\t\t\t\t\t}\n\t\t\t\t\treturn \" \" + args.join( \", \" ) + \" \";\n\t\t\t\t},\n\t\t\t\t// object calls it internally, the key part of an item in a map\n\t\t\t\tkey: quote,\n\t\t\t\t// function calls it internally, it's the content of the function\n\t\t\t\tfunctionCode: \"[code]\",\n\t\t\t\t// node calls it internally, it's an html attribute value\n\t\t\t\tattribute: quote,\n\t\t\t\tstring: quote,\n\t\t\t\tdate: quote,\n\t\t\t\tregexp: literal,\n\t\t\t\tnumber: literal,\n\t\t\t\t\"boolean\": literal\n\t\t\t},\n\t\t\t// if true, entities are escaped ( <, >, \\t, space and \\n )\n\t\t\tHTML: false,\n\t\t\t// indentation unit\n\t\t\tindentChar: \"  \",\n\t\t\t// if true, items in a collection, are separated by a \\n, else just a space.\n\t\t\tmultiline: true\n\t\t};\n\n\treturn jsDump;\n}());\n\n// from jquery.js\nfunction inArray( elem, array ) {\n\tif ( array.indexOf ) {\n\t\treturn array.indexOf( elem );\n\t}\n\n\tfor ( var i = 0, length = array.length; i < length; i++ ) {\n\t\tif ( array[ i ] === elem ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\n/*\n * Javascript Diff Algorithm\n *  By John Resig (http://ejohn.org/)\n *  Modified by Chu Alan \"sprite\"\n *\n * Released under the MIT license.\n *\n * More Info:\n *  http://ejohn.org/projects/javascript-diff-algorithm/\n *\n * Usage: QUnit.diff(expected, actual)\n *\n * QUnit.diff( \"the quick brown fox jumped over\", \"the quick fox jumps over\" ) == \"the  quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over\"\n */\nQUnit.diff = (function() {\n\t/*jshint eqeqeq:false, eqnull:true */\n\tfunction diff( o, n ) {\n\t\tvar i,\n\t\t\tns = {},\n\t\t\tos = {};\n\n\t\tfor ( i = 0; i < n.length; i++ ) {\n\t\t\tif ( !hasOwn.call( ns, n[i] ) ) {\n\t\t\t\tns[ n[i] ] = {\n\t\t\t\t\trows: [],\n\t\t\t\t\to: null\n\t\t\t\t};\n\t\t\t}\n\t\t\tns[ n[i] ].rows.push( i );\n\t\t}\n\n\t\tfor ( i = 0; i < o.length; i++ ) {\n\t\t\tif ( !hasOwn.call( os, o[i] ) ) {\n\t\t\t\tos[ o[i] ] = {\n\t\t\t\t\trows: [],\n\t\t\t\t\tn: null\n\t\t\t\t};\n\t\t\t}\n\t\t\tos[ o[i] ].rows.push( i );\n\t\t}\n\n\t\tfor ( i in ns ) {\n\t\t\tif ( !hasOwn.call( ns, i ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) {\n\t\t\t\tn[ ns[i].rows[0] ] = {\n\t\t\t\t\ttext: n[ ns[i].rows[0] ],\n\t\t\t\t\trow: os[i].rows[0]\n\t\t\t\t};\n\t\t\t\to[ os[i].rows[0] ] = {\n\t\t\t\t\ttext: o[ os[i].rows[0] ],\n\t\t\t\t\trow: ns[i].rows[0]\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tfor ( i = 0; i < n.length - 1; i++ ) {\n\t\t\tif ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&\n\t\t\t\t\t\tn[ i + 1 ] == o[ n[i].row + 1 ] ) {\n\n\t\t\t\tn[ i + 1 ] = {\n\t\t\t\t\ttext: n[ i + 1 ],\n\t\t\t\t\trow: n[i].row + 1\n\t\t\t\t};\n\t\t\t\to[ n[i].row + 1 ] = {\n\t\t\t\t\ttext: o[ n[i].row + 1 ],\n\t\t\t\t\trow: i + 1\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tfor ( i = n.length - 1; i > 0; i-- ) {\n\t\t\tif ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&\n\t\t\t\t\t\tn[ i - 1 ] == o[ n[i].row - 1 ]) {\n\n\t\t\t\tn[ i - 1 ] = {\n\t\t\t\t\ttext: n[ i - 1 ],\n\t\t\t\t\trow: n[i].row - 1\n\t\t\t\t};\n\t\t\t\to[ n[i].row - 1 ] = {\n\t\t\t\t\ttext: o[ n[i].row - 1 ],\n\t\t\t\t\trow: i - 1\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\to: o,\n\t\t\tn: n\n\t\t};\n\t}\n\n\treturn function( o, n ) {\n\t\to = o.replace( /\\s+$/, \"\" );\n\t\tn = n.replace( /\\s+$/, \"\" );\n\n\t\tvar i, pre,\n\t\t\tstr = \"\",\n\t\t\tout = diff( o === \"\" ? [] : o.split(/\\s+/), n === \"\" ? [] : n.split(/\\s+/) ),\n\t\t\toSpace = o.match(/\\s+/g),\n\t\t\tnSpace = n.match(/\\s+/g);\n\n\t\tif ( oSpace == null ) {\n\t\t\toSpace = [ \" \" ];\n\t\t}\n\t\telse {\n\t\t\toSpace.push( \" \" );\n\t\t}\n\n\t\tif ( nSpace == null ) {\n\t\t\tnSpace = [ \" \" ];\n\t\t}\n\t\telse {\n\t\t\tnSpace.push( \" \" );\n\t\t}\n\n\t\tif ( out.n.length === 0 ) {\n\t\t\tfor ( i = 0; i < out.o.length; i++ ) {\n\t\t\t\tstr += \"<del>\" + out.o[i] + oSpace[i] + \"</del>\";\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif ( out.n[0].text == null ) {\n\t\t\t\tfor ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) {\n\t\t\t\t\tstr += \"<del>\" + out.o[n] + oSpace[n] + \"</del>\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( i = 0; i < out.n.length; i++ ) {\n\t\t\t\tif (out.n[i].text == null) {\n\t\t\t\t\tstr += \"<ins>\" + out.n[i] + nSpace[i] + \"</ins>\";\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// `pre` initialized at top of scope\n\t\t\t\t\tpre = \"\";\n\n\t\t\t\t\tfor ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {\n\t\t\t\t\t\tpre += \"<del>\" + out.o[n] + oSpace[n] + \"</del>\";\n\t\t\t\t\t}\n\t\t\t\t\tstr += \" \" + out.n[i].text + nSpace[i] + pre;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn str;\n\t};\n}());\n\n// for CommonJS enviroments, export everything\nif ( typeof exports !== \"undefined\" ) {\n\textend( exports, QUnit );\n}\n\n// get at whatever the global object is, like window in browsers\n}( (function() {return this;}.call()) ));\n"
  },
  {
    "path": "test/qunit/tests.js",
    "content": "(function(window) {\n\t/*\n\t\t======== A Handy Little QUnit Reference ========\n\t\thttp://api.qunitjs.com/\n\n\t\tTest methods:\n\t\t\tmodule(name, {[setup][ ,teardown]})\n\t\t\ttest(name, callback)\n\t\t\texpect(numberOfAssertions)\n\t\t\tstop(increment)\n\t\t\tstart(decrement)\n\t\tTest assertions:\n\t\t\tok(value, [message])\n\t\t\tequal(actual, expected, [message])\n\t\t\tnotEqual(actual, expected, [message])\n\t\t\tdeepEqual(actual, expected, [message])\n\t\t\tnotDeepEqual(actual, expected, [message])\n\t\t\tstrictEqual(actual, expected, [message])\n\t\t\tnotStrictEqual(actual, expected, [message])\n\t\t\tthrows(block, [expected], [message])\n\t*/\n\n\t// initial value of media attr\n\tvar initialMedia = \"only x\";\n\n\ttest( 'function loadCSS exists', function(){\n\t\texpect(2);\n\t\tok( window.loadCSS, \"loadCSS should exist on the window object\" );\n\t\tok( typeof window.loadCSS === \"function\", \"loadCSS should be a function\" );\n\t});\n\n\tasyncTest( 'loadCSS loads a CSS file', function(){\n\t\texpect(1);\n\t\tvar ss = loadCSS(\"files/test.css\");\n\t\tonloadCSS( ss, function(){\n\t\t\tok(\"stylesheet loaded successfully\");\n\t\t\tstart();\n\t\t});\n\t});\n\n\tasyncTest( 'loadCSS loads a CSS file with a relative path', function(){\n\t\texpect(1);\n\t\tvar ss = loadCSS(\"../../test/qunit/files/test.css\");\n\t\tonloadCSS( ss, function(){\n\t\t\tok(\"stylesheet loaded successfully\");\n\t\t\tstart();\n\t\t});\n\t});\n\n\tasyncTest( 'loadCSS loads a CSS file with specific attributes', function(){\n\t\texpect(3);\n\t\tvar attributes = {\n\t\t\ttitle: \"Default Style\",\n\t\t\ttype: \"text/css\"\n\t\t};\n\t\tvar ss = loadCSS(\"files/test.css\", null, null, attributes);\n\t\tonloadCSS( ss, function(){\n\t\t\tok(\"stylesheet loaded successfully\");\n\t\t\tequal(ss.title, attributes.title, \"'title' attribute should be '\" + attributes.title + \"'\");\n\t\t\tequal(ss.type, attributes.type, \"'type' attribute should be '\" + attributes.type + \"'\");\n\t\t\tstart();\n\t\t});\n\t});\n\n\tasyncTest( 'loadCSS sets media type before and after the stylesheet is loaded', function(){\n\t\texpect(2);\n\t\tvar ss = loadCSS(\"files/test.css\");\n\t\tok(ss.media, initialMedia, \"media type begins as\" + initialMedia );\n\t\tonloadCSS( ss, function(){\n\t\t\tequal(ss.media, \"all\", \"media type is all\");\n\t\t\tstart();\n\t\t});\n\t});\n\n\tasyncTest( 'loadCSS sets media type to a custom value if specified, after load', function(){\n\t\texpect(2);\n\t\tvar med = \"print\";\n\t\tvar ss = loadCSS(\"files/test.css\", null, med);\n\t\tok(ss.media, initialMedia, \"media type begins as \" + initialMedia );\n\t\tonloadCSS( ss, function(){\n\t\t\tequal(ss.media, med, \"media type is \" + med);\n\t\t\tstart();\n\t\t});\n\t});\n\n\ttest( 'loadCSS injects before a particular specified element', function(){\n\t\texpect(1);\n\t\tvar elem = window.document.getElementById(\"before-test\");\n\t\tvar ss = loadCSS(\"files/test.css\", elem);\n\t\tequal(ss.nextElementSibling, elem );\n\t});\n\n\tasyncTest( 'onloadCSS callback fires after css is loaded', function(){\n\t\texpect(1);\n\t\tvar getStyles = window.getComputedStyle ? function (node) { return window.getComputedStyle(node, null); } : function (node) { return node.currentStyle; };\n\t\tvar elem = window.document.createElement(\"div\");\n\t\telem.className = \"bar\";\n\t\tdocument.body.appendChild( elem );\n\t\tvar ss = loadCSS(\"files/test.css?1\");\n\t\tonloadCSS( ss, function(){\n\t\t\tequal(getStyles(elem).backgroundColor, 'rgb(0, 128, 0)', 'background is green' );\n\t\t\tstart();\n\t\t} );\n\t});\n\n\n}(window));\n"
  },
  {
    "path": "test/recommended.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Recommended Pattern Test</title>\n\t\t<meta charset=\"utf-8\">\n        <link rel=\"stylesheet\" href=\"slow.css\" media=\"print\" onload=\"this.media='all'; this.onload=null;\">\n\t</head>\n\t<body>\n\t\t<p>This is a test file to demonstrate the recommended pattern for loading a stylesheet asynchronously.</p>\n\t</body>\n</html>\n"
  },
  {
    "path": "test/slow.css",
    "content": "/* This file was delivered after a purposeful 5 second delay to demonstrate latency. */\nbody { background: green; color: #fff; }\na { color: #fff;}"
  },
  {
    "path": "test/test-onload.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Blocking Test</title>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>\n\t\t<!--#include virtual=\"../src/loadCSS.js\" -->\n\t\t<!--#include virtual=\"../src/onloadCSS.js\" -->\n\t\tvar ss = loadCSS( \"slow.css\" );\n\t\tonloadCSS( ss, function() {\n\t\t\tdocument.body.innerHTML += '<h1>onload!!!</h1>';\n\t\t});\n\t\t</script>\n\t</head>\n\t<body>\n\t\t<p>This is a test to see whether or not a loadCSS call will block render. This page uses loadCss to load a CSS file that has a 5 second delay built into its server response time. If loadCSS works properly, you should be able to read this text before the page is styled as white text on green background.</p>\n\n</body>\n</html>\n"
  },
  {
    "path": "test/test.html",
    "content": "<!doctype HTML>\n<html>\n\t<head>\n\t\t<title>Blocking Test</title>\n\t\t<meta charset=\"utf-8\">\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tbackground: #ccc;\n\t\t\t}\n\t\t</style>\n\t\t<script>\n\t\t<!--#include virtual=\"../src/loadCSS.js\" -->\n\t\tloadCSS( \"slow.css\" );\n\t\t</script>\n\t</head>\n\t<body>\n\t\t<p>This is a test to see whether or not a loadCSS call will block render. This page uses loadCss to load a CSS file that has a 5 second delay built into its server response time. If loadCSS works properly, you should be able to read this text before the page is styled as white text on green background.</p>\n\n</body>\n</html>\n"
  }
]