(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.quixote = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],2:[function(require,module,exports){ (function (setImmediate,clearImmediate){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; var slice = Array.prototype.slice; var immediateIds = {}; var nextImmediateId = 0; // DOM APIs, for completeness exports.setTimeout = function() { return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); }; exports.setInterval = function() { return new Timeout(apply.call(setInterval, window, arguments), clearInterval); }; exports.clearTimeout = exports.clearInterval = function(timeout) { timeout.close(); }; function Timeout(id, clearFn) { this._id = id; this._clearFn = clearFn; } Timeout.prototype.unref = Timeout.prototype.ref = function() {}; Timeout.prototype.close = function() { this._clearFn.call(window, this._id); }; // Does not start the time, just sets up the members needed. exports.enroll = function(item, msecs) { clearTimeout(item._idleTimeoutId); item._idleTimeout = msecs; }; exports.unenroll = function(item) { clearTimeout(item._idleTimeoutId); item._idleTimeout = -1; }; exports._unrefActive = exports.active = function(item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; if (msecs >= 0) { item._idleTimeoutId = setTimeout(function onTimeout() { if (item._onTimeout) item._onTimeout(); }, msecs); } }; // That's not how node.js implements it but the exposed api is the same. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { var id = nextImmediateId++; var args = arguments.length < 2 ? false : slice.call(arguments, 1); immediateIds[id] = true; nextTick(function onNextTick() { if (immediateIds[id]) { // fn.call() is faster so we optimize for the common use-case // @see http://jsperf.com/call-apply-segu if (args) { fn.apply(null, args); } else { fn.call(null); } // Prevent ids from leaking exports.clearImmediate(id); } }); return id; }; exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { delete immediateIds[id]; }; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) },{"process/browser.js":1,"timers":2}],3:[function(require,module,exports){ // Copyright (c) 2015 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file. "use strict"; var ensure = require("./util/ensure.js"); var oop = require("./util/oop.js"); var shim = require("./util/shim.js"); var Me = module.exports = function Assertable() { ensure.unreachable("Assertable is abstract and should not be constructed directly."); }; Me.extend = oop.extendFn(Me); oop.makeAbstract(Me, []); Me.prototype.assert = function assert(expected, message) { ensure.signature(arguments, [ Object, [undefined, String] ]); if (message === undefined) message = "Differences found"; var diff = this.diff(expected); if (diff !== "") throw new Error(message + ":\n" + diff + "\n"); }; Me.prototype.diff = function diff(expected) { ensure.signature(arguments, [ Object ]); var result = []; var keys = shim.Object.keys(expected); var key, oneDiff, descriptor; for (var i = 0; i < keys.length; i++) { key = keys[i]; descriptor = this[key]; ensure.that( descriptor !== undefined, this + " doesn't have a property named '" + key + "'. Did you misspell it?" ); oneDiff = descriptor.diff(expected[key]); if (oneDiff !== "") result.push(oneDiff); } return result.join("\n"); }; },{"./util/ensure.js":26,"./util/oop.js":27,"./util/shim.js":28}],4:[function(require,module,exports){ // Copyright Titanium I.T. LLC. "use strict"; var ensure = require("./util/ensure.js"); var QFrame = require("./q_frame.js"); var Size = require("./values/size.js"); var FRAME_WIDTH = 1500; var FRAME_HEIGHT = 200; var features = null; exports.enlargesFrameToPageSize = createDetectionMethod("enlargesFrame"); exports.enlargesFonts = createDetectionMethod("enlargesFonts"); exports.misreportsClipAutoProperty = createDetectionMethod("misreportsClipAuto"); exports.misreportsAutoValuesInClipProperty = createDetectionMethod("misreportsClipValues"); exports.roundsOffPixelCalculations = createDetectionMethod("roundsOffPixelCalculations"); exports.detectBrowserFeatures = function(callback) { var frame = QFrame.create(document.body, { width: FRAME_WIDTH, height: FRAME_HEIGHT }, function(err) { if (err) { return callback(new Error("Error while creating Quixote browser feature detection frame: " + err)); } return detectFeatures(frame, function(err) { frame.remove(); return callback(err); }); }); }; function detectFeatures(frame, callback) { try { features = {}; features.enlargesFrame = detectFrameEnlargement(frame, FRAME_WIDTH); features.misreportsClipAuto = detectReportedClipAuto(frame); features.misreportsClipValues = detectReportedClipPropertyValues(frame); features.roundsOffPixelCalculations = detectRoundsOffPixelCalculations(frame); detectFontEnlargement(frame, FRAME_WIDTH, function(result) { features.enlargesFonts = result; frame.remove(); return callback(null); }); } catch(err) { features = null; return callback(new Error("Error during Quixote browser feature detection: " + err)); } } function createDetectionMethod(propertyName) { return function() { ensure.signature(arguments, []); ensure.that( features !== null, "Must call quixote.createFrame() before using Quixote browser feature detection." ); return features[propertyName]; }; } function detectFrameEnlargement(frame, frameWidth) { frame.reset(); frame.add("
force scrolling
"); return !frame.viewport().width.value().equals(Size.create(frameWidth)); } function detectReportedClipAuto(frame) { frame.reset(); var element = frame.add("
"); var clip = element.getRawStyle("clip"); return clip !== "auto"; } function detectReportedClipPropertyValues(frame) { frame.reset(); var element = frame.add("
"); var clip = element.getRawStyle("clip"); // WORKAROUND IE 8: Provides 'clipTop' etc. instead of 'clip' property if (clip === "" && element.getRawStyle("clip-top") === "auto") return false; return clip !== "rect(auto, auto, auto, auto)" && clip !== "rect(auto auto auto auto)"; } function detectRoundsOffPixelCalculations(frame) { var element = frame.add("
"); var size = element.calculatePixelValue("0.5em"); if (size === 7.5) return false; if (size === 8) return true; ensure.unreachable("Failure in roundsOffPixelValues() detection: expected 7.5 or 8, but got " + size); } function detectFontEnlargement(frame, frameWidth, callback) { ensure.that(frameWidth >= 1500, "Detector frame width must be larger than screen to detect font enlargement"); frame.reset(); // WORKAROUND IE 8: we use a
because the
"); var text = frame.add("

arbitrary text

"); frame.add("

must have two p tags to work

"); // WORKAROUND IE 8: need to force reflow or getting font-size may fail below // This seems to occur when IE is running in a slow VirtualBox VM. There is no test for this line. frame.forceReflow(); // WORKAROUND Safari 8.0.0: timeout required because font is enlarged asynchronously setTimeout(function() { var fontSize = text.getRawStyle("font-size"); ensure.that(fontSize !== "", "Expected font-size to be a value"); // WORKAROUND IE 8: ignores